From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ivan Shmakov Newsgroups: gmane.emacs.bugs Subject: bug#19068: Mail file vars aren't derived from customized message-directory Date: Fri, 30 Jan 2015 13:45:38 +0000 Message-ID: <877fw4jsal.fsf@violet.siamics.net> References: <83r3udmuvp.fsf@gnu.org> <87bnlgk9eu.fsf@violet.siamics.net> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1422625585 22574 80.91.229.3 (30 Jan 2015 13:46:25 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 Jan 2015 13:46:25 +0000 (UTC) To: 19068@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Jan 30 14:46:21 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YHBtq-0002u8-4i for geb-bug-gnu-emacs@m.gmane.org; Fri, 30 Jan 2015 14:46:18 +0100 Original-Received: from localhost ([::1]:36824 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHBtp-00026U-GG for geb-bug-gnu-emacs@m.gmane.org; Fri, 30 Jan 2015 08:46:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35653) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHBti-000263-3y for bug-gnu-emacs@gnu.org; Fri, 30 Jan 2015 08:46:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YHBtd-0004QP-Dj for bug-gnu-emacs@gnu.org; Fri, 30 Jan 2015 08:46:10 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38422) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YHBtb-0004Ps-6I for bug-gnu-emacs@gnu.org; Fri, 30 Jan 2015 08:46:05 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1YHBtZ-0003Af-WB; Fri, 30 Jan 2015 08:46:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bugs@gnus.org Resent-Date: Fri, 30 Jan 2015 13:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19068 X-GNU-PR-Package: emacs,gnus X-GNU-PR-Keywords: Original-Received: via spool by 19068-submit@debbugs.gnu.org id=B19068.142262555512173 (code B ref 19068); Fri, 30 Jan 2015 13:46:01 +0000 Original-Received: (at 19068) by debbugs.gnu.org; 30 Jan 2015 13:45:55 +0000 Original-Received: from localhost ([127.0.0.1]:57894 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YHBtS-0003AH-Ho for submit@debbugs.gnu.org; Fri, 30 Jan 2015 08:45:54 -0500 Original-Received: from fely.am-1.org ([78.47.74.50]:41306) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YHBtO-0003A4-Ou for 19068@debbugs.gnu.org; Fri, 30 Jan 2015 08:45:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=B68+vArDeU17wOp31iJg5P0JmU8jaP+eJ6PqB/gYSRc=; b=qk+p3HHgcERiYb2s04r1yYFMx2kdlBKVELQoyIuN1FWBRwy3DmgxyrdD+i86RRiYIL+f+/pzxg3dRMRw6AtW/k6kxgn/Iwn9Wy9D/p6qDxyGP8CCJ7ZuKiIpUEu/9KdZn7rDvRna4dp27UQP7stGqgG92WpTOkwZPOs+ZSVX5IU=; Original-Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YHBtL-0000NC-W9 for 19068@debbugs.gnu.org; Fri, 30 Jan 2015 13:45:48 +0000 Original-Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YHBtD-0001ri-LD for 19068@debbugs.gnu.org; Fri, 30 Jan 2015 20:45:39 +0700 Mail-Followup-To: 19068@debbugs.gnu.org In-Reply-To: <87bnlgk9eu.fsf@violet.siamics.net> (Ivan Shmakov's message of "Fri, 30 Jan 2015 07:35:53 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:98904 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>>>> Ivan Shmakov writes: [=E2=80=A6] > I [hereby] suggest using nil as the default for the variables whose > defaults derive from message-directory, =E2=80=93 something along the li= nes > of the (untested) patch MIMEd. > * lisp/gnus/message.el (subr-x): Require feature. > (message-auto-save-directory): Default to nil. This of course will not work, as this variable already uses nil to mean =E2=80=9Cdo not auto save,=E2=80=9D so we need some other value (s= ay, 'auto) for the purpose. Please consider the revised patch MIMEd. * lisp/gnus/message.el (subr-x): Require feature. (message-auto-save-directory): Default to 'auto. (message-auto-save-directory): New function. (message-set-auto-save-file-name): Use it. --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A --=-=-= Content-Type: text/diff Content-Disposition: inline diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index de7e9ba..da5c871 100644 --- 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,15 +1332,16 @@ :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 'auto "*Directory where Message auto-saves buffers if Gnus isn't running. -If nil, Message won't auto-save." +If nil, Message won't auto-save. +If 'auto, derive from `message-directory'." + :version "25.1" :group 'message-buffers :link '(custom-manual "(message)Various Message Variables") - :type '(choice directory (const :tag "Don't auto-save" nil))) + :type '(choice directory + (const :tag "Don't auto-save" nil) + (const :tag "Derive from `message-directory'" auto))) (defcustom message-default-charset (and (not (mm-multibyte-p)) 'iso-8859-1) @@ -6666,12 +6668,28 @@ ;; 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 it is +a string or 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 ((or (stringp message-auto-save-directory) + (not message-auto-save-directory)) + message-auto-save-directory) + ((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 +6707,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))) --=-=-=--