comparison lisp/mail/sendmail.el @ 45423:9bee1f5d919f

(mail-recover-1): Remove (debug). (mail-signature): Fix :type. (mail-default-directory): New user option. (mail, mail-recover): Use that option.
author Markus Rost <rost@math.uni-bielefeld.de>
date Mon, 20 May 2002 16:05:28 +0000
parents 20c79f08a7da
children 49fb7a41adff
comparison
equal deleted inserted replaced
45422:a466970fd1ee 45423:9bee1f5d919f
255 If a string, that string is inserted. 255 If a string, that string is inserted.
256 (To make a proper signature, the string should begin with \\n\\n-- \\n, 256 (To make a proper signature, the string should begin with \\n\\n-- \\n,
257 which is the standard way to delimit a signature in a message.) 257 which is the standard way to delimit a signature in a message.)
258 Otherwise, it should be an expression; it is evaluated 258 Otherwise, it should be an expression; it is evaluated
259 and should insert whatever you want to insert." 259 and should insert whatever you want to insert."
260 :type '(choice (const "None" nil) 260 :type '(choice (const :tag "None" nil)
261 (const :tag "Use `.signature' file" t) 261 (const :tag "Use `.signature' file" t)
262 (string :tag "String to insert") 262 (string :tag "String to insert")
263 (sexp :tag "Expression to evaluate")) 263 (sexp :tag "Expression to evaluate"))
264 :group 'sendmail) 264 :group 'sendmail)
265 (put 'mail-signature 'risky-local-variable t) 265 (put 'mail-signature 'risky-local-variable t)
266 266
267 (defcustom mail-signature-file "~/.signature" 267 (defcustom mail-signature-file "~/.signature"
268 "*File containing the text inserted at end of mail buffer." 268 "*File containing the text inserted at end of mail buffer."
269 :type 'file 269 :type 'file
270 :group 'sendmail)
271
272 ;;;###autoload
273 (defcustom mail-default-directory "~/"
274 "*Directory for mail buffers.
275 Value of `default-directory' for mail buffers.
276 This directory is used for auto-save files of mail buffers."
277 :type '(directory :tag "Directory")
270 :group 'sendmail) 278 :group 'sendmail)
271 279
272 (defvar mail-reply-action nil) 280 (defvar mail-reply-action nil)
273 (defvar mail-send-actions nil 281 (defvar mail-send-actions nil
274 "A list of actions to be performed upon successful sending of a message.") 282 "A list of actions to be performed upon successful sending of a message.")
1511 ;;; (if (and buffer-auto-save-file-name 1519 ;;; (if (and buffer-auto-save-file-name
1512 ;;; (file-exists-p buffer-auto-save-file-name)) 1520 ;;; (file-exists-p buffer-auto-save-file-name))
1513 ;;; (message "Auto save file for draft message exists; consider M-x mail-recover")) 1521 ;;; (message "Auto save file for draft message exists; consider M-x mail-recover"))
1514 ;;; t)) 1522 ;;; t))
1515 (pop-to-buffer "*mail*") 1523 (pop-to-buffer "*mail*")
1516 ;; Put the auto-save file in the home dir 1524 ;; Avoid danger that the auto-save file can't be written.
1517 ;; to avoid any danger that it can't be written. 1525 (let ((dir (expand-file-name
1518 (if (file-exists-p (expand-file-name "~/")) 1526 (file-name-as-directory mail-default-directory))))
1519 (setq default-directory (expand-file-name "~/"))) 1527 (if (file-exists-p dir)
1528 (setq default-directory dir)))
1520 ;; Only call auto-save-mode if necessary, to avoid changing auto-save file. 1529 ;; Only call auto-save-mode if necessary, to avoid changing auto-save file.
1521 (if (or (and auto-save-default (not buffer-auto-save-file-name)) 1530 (if (or (and auto-save-default (not buffer-auto-save-file-name))
1522 (and (not auto-save-default) buffer-auto-save-file-name)) 1531 (and (not auto-save-default) buffer-auto-save-file-name))
1523 (auto-save-mode auto-save-default)) 1532 (auto-save-mode auto-save-default))
1524 (mail-mode) 1533 (mail-mode)
1561 ;; "#<RANDOM-STUFF>#" to the buffer name, where RANDOM-STUFF 1570 ;; "#<RANDOM-STUFF>#" to the buffer name, where RANDOM-STUFF
1562 ;; is the result of (make-temp-name ""). 1571 ;; is the result of (make-temp-name "").
1563 (setq non-random-len 1572 (setq non-random-len
1564 (- (length file-name) (length (make-temp-name "")) 1)) 1573 (- (length file-name) (length (make-temp-name "")) 1))
1565 (setq wildcard (concat (substring file-name 0 non-random-len) "*")) 1574 (setq wildcard (concat (substring file-name 0 non-random-len) "*"))
1566 (debug)
1567 (if (null (file-expand-wildcards wildcard)) 1575 (if (null (file-expand-wildcards wildcard))
1568 (message "There are no auto-saved drafts to recover") 1576 (message "There are no auto-saved drafts to recover")
1569 ;; Bind dired-trivial-filenames to t because all auto-save file 1577 ;; Bind dired-trivial-filenames to t because all auto-save file
1570 ;; names are normally ``trivial'', so Dired will set point after 1578 ;; names are normally ``trivial'', so Dired will set point after
1571 ;; all the files, at buffer bottom. We want it on the first 1579 ;; all the files, at buffer bottom. We want it on the first
1631 (interactive) 1639 (interactive)
1632 ;; In case they invoke us from some random buffer... 1640 ;; In case they invoke us from some random buffer...
1633 (switch-to-buffer "*mail*") 1641 (switch-to-buffer "*mail*")
1634 ;; If *mail* didn't exist, set its directory, so that auto-saved 1642 ;; If *mail* didn't exist, set its directory, so that auto-saved
1635 ;; drafts will be found. 1643 ;; drafts will be found.
1636 (if (file-exists-p (expand-file-name "~/")) 1644 (let ((dir (expand-file-name
1637 (setq default-directory "~/")) 1645 (file-name-as-directory mail-default-directory))))
1646 (if (file-exists-p dir)
1647 (setq default-directory dir)))
1638 (or (eq major-mode 'mail-mode) 1648 (or (eq major-mode 'mail-mode)
1639 (mail-mode)) 1649 (mail-mode))
1640 (let ((file-name buffer-auto-save-file-name)) 1650 (let ((file-name buffer-auto-save-file-name))
1641 (cond ((and file-name (file-exists-p file-name)) 1651 (cond ((and file-name (file-exists-p file-name))
1642 (let ((dispbuf 1652 (let ((dispbuf