GNU bug report logs -
#19068
Mail file vars aren't derived from customized message-directory
Previous Next
Reported by: "Kelly Dean" <kelly <at> prtime.org>
Date: Sun, 16 Nov 2014 12:24:01 UTC
Severity: minor
Tags: notabug
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
>>>>> Kelly Dean <kelly <at> prtime.org> writes:
>>>>> Eli Zaretskii wrote:
>>> Also, grep -r "~/Mail/" emacs-24.4/lisp/ | grep 'el:' gives 19
>>> hits, all of which are inappropriate if ~/Mail isn't supposed to be
>>> hardcoded. If ~/Mail is supposed to be hardcoded, then the
>>> message-directory variable should be removed, to avoid misleading
>>> users.
>> This is a red herring: all of these hits are either in comments or
>> in default values of other defcustoms.
> If a user renames his ⌜Mail⌝ directory to ⌜mail⌝, then he'll want all
> the things that previously used ⌜Mail⌝ to use ⌜mail⌝. Manually
> changing them all is tedious and error-prone, so it'd be nice to have
> one place to make the change. In Emacs, message-directory advertises
> itself as that place.
Only as long as message-mode (or anything deriving from it) is
considered.
I tend to think that defcustom’s :set does not fit for this
case, and instead suggest using nil as the default for the
variables whose defaults derive from message-directory, –
something along the lines of the (untested) patch MIMEd.
* lisp/gnus/message.el (subr-x): Require feature.
(message-auto-save-directory): Default to nil.
(message-auto-save-directory): New function.
(message-set-auto-save-file-name): Use it.
> I lowercased my mail directory name both because it's easier to type
> that way (don't have to press shift),
Seconded.
> and because some other things already use the lowercase version by
> default, and there was no reason to use both upper- and lower-case
> versions.
--
FSF associate member #7257 np. Face Another Day — Jogeir Liljedahl 230E 334A
[Message part 2 (text/diff, inline)]
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -29,7 +29,8 @@
;;; Code:
(eval-when-compile
- (require 'cl))
+ (require 'cl)
+ (require 'subr-x)) ; For when-let.
(require 'mailheader)
(require 'gmm-utils)
@@ -1331,12 +1332,10 @@
:group 'message-various
:type '(repeat function))
-(defcustom message-auto-save-directory
- (if (file-writable-p message-directory)
- (file-name-as-directory (expand-file-name "drafts" message-directory))
- "~/")
+(defcustom message-auto-save-directory nil
"*Directory where Message auto-saves buffers if Gnus isn't running.
If nil, Message won't auto-save."
+ :version 25.1
:group 'message-buffers
:link '(custom-manual "(message)Various Message Variables")
:type '(choice directory (const :tag "Don't auto-save" nil)))
@@ -6666,12 +6665,24 @@ defun message-setup-1 (headers &optional yank-action actions return-action)
;; rmail-start-mail expects message-mail to return t (Bug#9392)
t)
+(defun message-auto-save-directory nil
+ "Return message auto save directory.
+Return the value of the `message-auto-save-directory' variable if non-nil.
+Otherwise, if `message-directory' is non-nil, return a suitable
+directory name under it if it is writeable, or "~/" if not.
+Return nil if all the above fails."
+ (cond ((not message-directory) nil)
+ ((file-writable-p message-directory)
+ (file-name-as-directory
+ (expand-file-name "drafts" message-directory)))
+ (t "~/")))
+
(defun message-set-auto-save-file-name ()
"Associate the message buffer with a file in the drafts directory."
- (when message-auto-save-directory
+ (when-let ((dir (message-auto-save-directory)))
(unless (file-directory-p
- (directory-file-name message-auto-save-directory))
- (make-directory message-auto-save-directory t))
+ (directory-file-name dir))
+ (make-directory dir t))
(if (gnus-alive-p)
(setq message-draft-article
(nndraft-request-associate-buffer "drafts"))
@@ -6689,7 +6700,7 @@ defun message-set-auto-save-file-name ()
"message"
"*message*")
(format-time-string "-%Y%m%d-%H%M%S"))
- message-auto-save-directory))
+ dir))
(setq buffer-auto-save-file-name (make-auto-save-file-name)))
(clear-visited-file-modtime)
(setq buffer-file-coding-system message-draft-coding-system)))
This bug report was last modified 10 years and 155 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.