From: Stefan Kangas <stefankangas@gmail.com>
To: 75306@debbugs.gnu.org
Cc: Michael Albinus <michael.albinus@gmx.de>
Subject: bug#75306: 31.0.50; Make `small-temporary-file-directory` variable obsolete
Date: Thu, 2 Jan 2025 21:23:12 -0600 [thread overview]
Message-ID: <CADwFkmk4TS4qGMT3bFguMo=7qU_-CF-pD+04johYb1B=9wZiyw@mail.gmail.com> (raw)
[-- 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
next reply other threads:[~2025-01-03 3:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-03 3:23 Stefan Kangas [this message]
2025-01-03 5:56 ` bug#75306: 31.0.50; Make `small-temporary-file-directory` variable obsolete 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADwFkmk4TS4qGMT3bFguMo=7qU_-CF-pD+04johYb1B=9wZiyw@mail.gmail.com' \
--to=stefankangas@gmail.com \
--cc=75306@debbugs.gnu.org \
--cc=michael.albinus@gmx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).