unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#75306: 31.0.50; Make `small-temporary-file-directory` variable obsolete
@ 2025-01-03  3:23 Stefan Kangas
  2025-01-03  5:56 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
  0 siblings, 1 reply; 14+ messages in thread
From: Stefan Kangas @ 2025-01-03  3:23 UTC (permalink / raw)
  To: 75306; +Cc: Michael Albinus

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

Severity: wishlist

The variable `small-temporary-file-directory` was created in 2000 for
MS-DOS systems and systems with widely different specs than what we run
now.  Putting temporary files on a RAM disk should be done by the system
administrator (usually the user themselves), for example by simply using
tmpfs for _all_ temporary files (not just "small" ones, whatever that
means).

I think the variable doesn't make much sense these days, and should be
made obsolete.  Note that it is barely used in Emacs and third-party
packages.

However, Tramp recently started using the variable as a place to create
OpenSSH Unix domain sockets.  May I suggest that Tramp uses some other
variable for this purpose, perhaps a Tramp specific one?

I've attached a diff that makes the variable obsolete and removes all
uses, for reference.

[-- Attachment #2: rmvar.diff --]
[-- Type: text/x-patch, Size: 5838 bytes --]

diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 620d16ddf11..b8314bbac37 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -599,11 +599,9 @@ Backup
 
 @vindex backup-enable-predicate
 @vindex temporary-file-directory
-@vindex small-temporary-file-directory
   The default value of the @code{backup-enable-predicate} variable
 prevents backup files being written for files in the directories used
-for temporary files, specified by @code{temporary-file-directory} or
-@code{small-temporary-file-directory}.
+for temporary files, specified by @code{temporary-file-directory}.
 
   You can explicitly tell Emacs to make another backup file from a
 buffer, even though that buffer has been saved before.  If you save
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 1064f347a12..645827de85e 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -2803,21 +2803,6 @@ Unique File Names
 non-@code{nil}.
 @end defopt
 
-@defopt small-temporary-file-directory
-This variable specifies the directory name for
-creating certain temporary files, which are likely to be small.
-
-If you want to write a temporary file which is likely to be small, you
-should compute the directory like this:
-
-@example
-(make-temp-file
-  (expand-file-name @var{prefix}
-                    (or small-temporary-file-directory
-                        temporary-file-directory)))
-@end example
-@end defopt
-
 @defun make-temp-name base-name
 This function generates a string that might be a unique file
 name.  The name starts with @var{base-name}, and has several random
diff --git a/lisp/files.el b/lisp/files.el
index 72128ea4af2..98e66aac1ea 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -229,6 +229,8 @@ small-temporary-file-directory
   :group 'files
   :initialize #'custom-initialize-delay
   :type '(choice (const nil) directory))
+(make-obsolete-variable 'small-temporary-file-directory
+                        'temporary-file-directory "31.1")
 
 ;; The system null device. (Should reference NULL_DEVICE from C.)
 (defvar null-device (purecopy "/dev/null") "The system null device.")
@@ -5592,8 +5594,7 @@ backup-directory-alist
 
 (defun normal-backup-enable-predicate (name)
   "Default `backup-enable-predicate' function.
-Checks for files in `temporary-file-directory',
-`small-temporary-file-directory', and \"/tmp\"."
+Checks for files in `temporary-file-directory' and \"/tmp\"."
   (let ((temporary-file-directory temporary-file-directory)
 	caseless)
     ;; On MS-Windows, file-truename will convert short 8+3 aliases to
@@ -5611,14 +5612,7 @@ normal-backup-enable-predicate
 					  name 0 nil)))
 	       ;; Directory is under /tmp.
 	       (and (not (eq comp t))
-		    (< comp (- (length "/tmp")))))
-	     (if small-temporary-file-directory
-		 (let ((comp (compare-strings small-temporary-file-directory
-					      0 nil
-					      name 0 nil caseless)))
-		   ;; Directory is under small-temporary-file-directory.
-		   (and (not (eq comp t))
-			(< comp (- (length small-temporary-file-directory))))))))))
+		    (< comp (- (length "/tmp")))))))))
 
 (defun make-backup-file-name (file)
   "Create the non-numeric backup file name for FILE.
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 823ff81cb56..8252169783c 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -4940,8 +4940,7 @@ tramp-ssh-controlmaster-options
 	     (expand-file-name
 	      (if (tramp-ssh-option-exists-p vec "ControlPath=tramp.%C")
 		  "tramp.%%C" "tramp.%%r@%%h:%%p")
-	      (or small-temporary-file-directory
-		  tramp-compat-temporary-file-directory))))
+	      tramp-compat-temporary-file-directory)))
 
          ;; ControlPersist option is introduced in OpenSSH 5.6.
 	 (when (and (not (eq tramp-use-connection-share 'suppress))
diff --git a/lisp/progmodes/cmacexp.el b/lisp/progmodes/cmacexp.el
index 35ebf506dfb..eaee29b8649 100644
--- a/lisp/progmodes/cmacexp.el
+++ b/lisp/progmodes/cmacexp.el
@@ -275,8 +275,7 @@ c-macro-expansion
 	(exit-status 0)
 	(tempname (make-temp-file
 		   (expand-file-name "cmacexp"
-				     (or small-temporary-file-directory
-					 temporary-file-directory)))))
+				     temporary-file-directory))))
     (unwind-protect
 	(save-excursion
 	  (save-restriction
diff --git a/lisp/simple.el b/lisp/simple.el
index b0490bb36d4..741229c9d60 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -4646,8 +4646,7 @@ shell-command
                  (and error-buffer
                       (make-temp-file
                        (expand-file-name "scor"
-                                         (or small-temporary-file-directory
-                                             temporary-file-directory))))))
+                                         temporary-file-directory)))))
 	    (barf-if-buffer-read-only)
 	    (push-mark nil t)
             (shell-command-save-pos-or-erase 'output-to-current-buffer)
@@ -4968,8 +4967,7 @@ shell-command-on-region
 	 (if error-buffer
 	     (make-temp-file
 	      (expand-file-name "scor"
-				(or small-temporary-file-directory
-				    temporary-file-directory)))
+				temporary-file-directory))
 	   nil))
 	exit-status)
     ;; Unless a single contiguous chunk is selected, operate on multiple chunks.
diff --git a/lisp/vc/vc-rcs.el b/lisp/vc/vc-rcs.el
index 07c7f37cbe5..cdeced20db9 100644
--- a/lisp/vc/vc-rcs.el
+++ b/lisp/vc/vc-rcs.el
@@ -886,8 +886,7 @@ vc-rcs-update-changelog
 	;; Presumably not portable to non-Unixy systems, along with rcs2log:
 	(tempfile (make-temp-file
 		   (expand-file-name "vc"
-				     (or small-temporary-file-directory
-					 temporary-file-directory))))
+				     temporary-file-directory)))
         (login-name (or user-login-name
                         (format "uid%d" (number-to-string (user-uid)))))
 	(full-name (or add-log-full-name

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-01-05  8:18 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-03  3:23 bug#75306: 31.0.50; Make `small-temporary-file-directory` variable obsolete Stefan Kangas
2025-01-03  5:56 ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-03  8:26   ` Stefan Kangas
2025-01-03  8:49     ` Eli Zaretskii
2025-01-03  8:39   ` Eli Zaretskii
2025-01-03  9:15     ` Stefan Kangas
2025-01-03 11:46       ` Eli Zaretskii
2025-01-04  9:54   ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-04  9:54   ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]   ` <87ttaezyyp.fsf@>
2025-01-04 11:26     ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-04 22:16       ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
2025-01-04 22:16       ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]       ` <6779b38c.050a0220.be2ea.a6e0SMTPIN_ADDED_BROKEN@mx.google.com>
2025-01-05  5:30         ` Stefan Kangas
     [not found]       ` <8734hyw7g4.fsf@>
2025-01-05  8:18         ` Michael Albinus via Bug reports for GNU Emacs, the Swiss army knife of text editors

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).