aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2021-04-11 22:55:18 -0400
committerStefan Monnier2021-04-11 22:55:18 -0400
commitccfd6a975e377db6f0ebb9ad6eb0798cff169ce9 (patch)
tree020669a574ade66e84ba501c9d9b444650afc960
parenta89da3f00840bf95d92f9959f62fd1a0f7d26566 (diff)
downloademacs-ccfd6a975e377db6f0ebb9ad6eb0798cff169ce9.tar.gz
emacs-ccfd6a975e377db6f0ebb9ad6eb0798cff169ce9.zip
* lisp/gnus/message.el: Give non-nil defaults for function vars
Also prefer #' to quote functions. (message-send-rename-function, message-reply-to-function) (message-wide-reply-to-function, message-followup-to-function): Use a non-nil default value so it can be used with `add-function`. (message-do-send-housekeeping): Tweak accordingly. (message-get-reply-headers): Simplify by η-reduction.
-rw-r--r--lisp/gnus/message.el180
1 files changed, 90 insertions, 90 deletions
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index fad4ef3dcf6..f3b830cf849 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -120,12 +120,13 @@
120 :group 'message-buffers 120 :group 'message-buffers
121 :type 'integer) 121 :type 'integer)
122 122
123(defcustom message-send-rename-function nil 123(defcustom message-send-rename-function #'message-default-send-rename-function
124 "Function called to rename the buffer after sending it." 124 "Function called to rename the buffer after sending it."
125 :group 'message-buffers 125 :group 'message-buffers
126 :type '(choice function (const nil))) 126 :version "28.1"
127 :type 'function)
127 128
128(defcustom message-fcc-handler-function 'message-output 129(defcustom message-fcc-handler-function #'message-output
129 "A function called to save outgoing articles. 130 "A function called to save outgoing articles.
130This function will be called with the name of the file to store the 131This function will be called with the name of the file to store the
131article in. The default function is `message-output' which saves in Unix 132article in. The default function is `message-output' which saves in Unix
@@ -418,7 +419,7 @@ you can explicitly override this setting by calling
418 :type 'string 419 :type 'string
419 :group 'message-various) 420 :group 'message-various)
420 421
421(defcustom message-cross-post-note-function 'message-cross-post-insert-note 422(defcustom message-cross-post-note-function #'message-cross-post-insert-note
422 "Function to use to insert note about Crosspost or Followup-To. 423 "Function to use to insert note about Crosspost or Followup-To.
423The function will be called with four arguments. The function should not only 424The function will be called with four arguments. The function should not only
424insert a note, but also ensure old notes are deleted. See the documentation 425insert a note, but also ensure old notes are deleted. See the documentation
@@ -756,7 +757,7 @@ See also `send-mail-function'."
756 :link '(custom-manual "(message)Mail Variables") 757 :link '(custom-manual "(message)Mail Variables")
757 :group 'message-mail) 758 :group 'message-mail)
758 759
759(defcustom message-send-news-function 'message-send-news 760(defcustom message-send-news-function #'message-send-news
760 "Function to call to send the current buffer as news. 761 "Function to call to send the current buffer as news.
761The headers should be delimited by a line whose contents match the 762The headers should be delimited by a line whose contents match the
762variable `mail-header-separator'." 763variable `mail-header-separator'."
@@ -765,29 +766,32 @@ variable `mail-header-separator'."
765 :link '(custom-manual "(message)News Variables") 766 :link '(custom-manual "(message)News Variables")
766 :type 'function) 767 :type 'function)
767 768
768(defcustom message-reply-to-function nil 769(defcustom message-reply-to-function #'ignore
769 "If non-nil, function that should return a list of headers. 770 "If non-nil, function that should return a list of headers.
770This function should pick out addresses from the To, Cc, and From headers 771This function should pick out addresses from the To, Cc, and From headers
771and respond with new To and Cc headers." 772and respond with new To and Cc headers."
772 :group 'message-interface 773 :group 'message-interface
773 :link '(custom-manual "(message)Reply") 774 :link '(custom-manual "(message)Reply")
774 :type '(choice function (const nil))) 775 :version "28.1"
776 :type 'function)
775 777
776(defcustom message-wide-reply-to-function nil 778(defcustom message-wide-reply-to-function #'ignore
777 "If non-nil, function that should return a list of headers. 779 "If non-nil, function that should return a list of headers.
778This function should pick out addresses from the To, Cc, and From headers 780This function should pick out addresses from the To, Cc, and From headers
779and respond with new To and Cc headers." 781and respond with new To and Cc headers."
780 :group 'message-interface 782 :group 'message-interface
781 :link '(custom-manual "(message)Wide Reply") 783 :link '(custom-manual "(message)Wide Reply")
782 :type '(choice function (const nil))) 784 :version "28.1"
785 :type 'function)
783 786
784(defcustom message-followup-to-function nil 787(defcustom message-followup-to-function #'ignore
785 "If non-nil, function that should return a list of headers. 788 "If non-nil, function that should return a list of headers.
786This function should pick out addresses from the To, Cc, and From headers 789This function should pick out addresses from the To, Cc, and From headers
787and respond with new To and Cc headers." 790and respond with new To and Cc headers."
788 :group 'message-interface 791 :group 'message-interface
789 :link '(custom-manual "(message)Followup") 792 :link '(custom-manual "(message)Followup")
790 :type '(choice function (const nil))) 793 :version "28.1"
794 :type 'function)
791 795
792(defcustom message-extra-wide-headers nil 796(defcustom message-extra-wide-headers nil
793 "If non-nil, a list of additional address headers. 797 "If non-nil, a list of additional address headers.
@@ -1021,7 +1025,7 @@ the signature is inserted."
1021 :version "22.1" 1025 :version "22.1"
1022 :group 'message-various) 1026 :group 'message-various)
1023 1027
1024(defcustom message-citation-line-function 'message-insert-citation-line 1028(defcustom message-citation-line-function #'message-insert-citation-line
1025 "Function called to insert the \"Whomever writes:\" line. 1029 "Function called to insert the \"Whomever writes:\" line.
1026 1030
1027Predefined functions include `message-insert-citation-line' and 1031Predefined functions include `message-insert-citation-line' and
@@ -1103,7 +1107,7 @@ Used by `message-yank-original' via `message-yank-cite'."
1103 :link '(custom-manual "(message)Insertion Variables") 1107 :link '(custom-manual "(message)Insertion Variables")
1104 :type 'integer) 1108 :type 'integer)
1105 1109
1106(defcustom message-cite-function 'message-cite-original-without-signature 1110(defcustom message-cite-function #'message-cite-original-without-signature
1107 "Function for citing an original message. 1111 "Function for citing an original message.
1108Predefined functions include `message-cite-original' and 1112Predefined functions include `message-cite-original' and
1109`message-cite-original-without-signature'. 1113`message-cite-original-without-signature'.
@@ -1116,7 +1120,7 @@ Note that these functions use `mail-citation-hook' if that is non-nil."
1116 :version "22.3" ;; Gnus 5.10.12 (changed default) 1120 :version "22.3" ;; Gnus 5.10.12 (changed default)
1117 :group 'message-insertion) 1121 :group 'message-insertion)
1118 1122
1119(defcustom message-indent-citation-function 'message-indent-citation 1123(defcustom message-indent-citation-function #'message-indent-citation
1120 "Function for modifying a citation just inserted in the mail buffer. 1124 "Function for modifying a citation just inserted in the mail buffer.
1121This can also be a list of functions. Each function can find the 1125This can also be a list of functions. Each function can find the
1122citation between (point) and (mark t). And each function should leave 1126citation between (point) and (mark t). And each function should leave
@@ -2847,79 +2851,79 @@ Consider adding this function to `message-header-setup-hook'"
2847(unless message-mode-map 2851(unless message-mode-map
2848 (setq message-mode-map (make-keymap)) 2852 (setq message-mode-map (make-keymap))
2849 (set-keymap-parent message-mode-map text-mode-map) 2853 (set-keymap-parent message-mode-map text-mode-map)
2850 (define-key message-mode-map "\C-c?" 'describe-mode) 2854 (define-key message-mode-map "\C-c?" #'describe-mode)
2851 2855
2852 (define-key message-mode-map "\C-c\C-f\C-t" 'message-goto-to) 2856 (define-key message-mode-map "\C-c\C-f\C-t" #'message-goto-to)
2853 (define-key message-mode-map "\C-c\C-f\C-o" 'message-goto-from) 2857 (define-key message-mode-map "\C-c\C-f\C-o" #'message-goto-from)
2854 (define-key message-mode-map "\C-c\C-f\C-b" 'message-goto-bcc) 2858 (define-key message-mode-map "\C-c\C-f\C-b" #'message-goto-bcc)
2855 (define-key message-mode-map "\C-c\C-f\C-w" 'message-goto-fcc) 2859 (define-key message-mode-map "\C-c\C-f\C-w" #'message-goto-fcc)
2856 (define-key message-mode-map "\C-c\C-f\C-c" 'message-goto-cc) 2860 (define-key message-mode-map "\C-c\C-f\C-c" #'message-goto-cc)
2857 (define-key message-mode-map "\C-c\C-f\C-s" 'message-goto-subject) 2861 (define-key message-mode-map "\C-c\C-f\C-s" #'message-goto-subject)
2858 (define-key message-mode-map "\C-c\C-f\C-r" 'message-goto-reply-to) 2862 (define-key message-mode-map "\C-c\C-f\C-r" #'message-goto-reply-to)
2859 (define-key message-mode-map "\C-c\C-f\C-n" 'message-goto-newsgroups) 2863 (define-key message-mode-map "\C-c\C-f\C-n" #'message-goto-newsgroups)
2860 (define-key message-mode-map "\C-c\C-f\C-d" 'message-goto-distribution) 2864 (define-key message-mode-map "\C-c\C-f\C-d" #'message-goto-distribution)
2861 (define-key message-mode-map "\C-c\C-f\C-f" 'message-goto-followup-to) 2865 (define-key message-mode-map "\C-c\C-f\C-f" #'message-goto-followup-to)
2862 (define-key message-mode-map "\C-c\C-f\C-m" 'message-goto-mail-followup-to) 2866 (define-key message-mode-map "\C-c\C-f\C-m" #'message-goto-mail-followup-to)
2863 (define-key message-mode-map "\C-c\C-f\C-k" 'message-goto-keywords) 2867 (define-key message-mode-map "\C-c\C-f\C-k" #'message-goto-keywords)
2864 (define-key message-mode-map "\C-c\C-f\C-u" 'message-goto-summary) 2868 (define-key message-mode-map "\C-c\C-f\C-u" #'message-goto-summary)
2865 (define-key message-mode-map "\C-c\C-f\C-i" 2869 (define-key message-mode-map "\C-c\C-f\C-i"
2866 'message-insert-or-toggle-importance) 2870 #'message-insert-or-toggle-importance)
2867 (define-key message-mode-map "\C-c\C-f\C-a" 2871 (define-key message-mode-map "\C-c\C-f\C-a"
2868 'message-generate-unsubscribed-mail-followup-to) 2872 #'message-generate-unsubscribed-mail-followup-to)
2869 2873
2870 ;; modify headers (and insert notes in body) 2874 ;; modify headers (and insert notes in body)
2871 (define-key message-mode-map "\C-c\C-fs" 'message-change-subject) 2875 (define-key message-mode-map "\C-c\C-fs" #'message-change-subject)
2872 ;; 2876 ;;
2873 (define-key message-mode-map "\C-c\C-fx" 'message-cross-post-followup-to) 2877 (define-key message-mode-map "\C-c\C-fx" #'message-cross-post-followup-to)
2874 ;; prefix+message-cross-post-followup-to = same w/o cross-post 2878 ;; prefix+message-cross-post-followup-to = same w/o cross-post
2875 (define-key message-mode-map "\C-c\C-ft" 'message-reduce-to-to-cc) 2879 (define-key message-mode-map "\C-c\C-ft" #'message-reduce-to-to-cc)
2876 (define-key message-mode-map "\C-c\C-fa" 'message-add-archive-header) 2880 (define-key message-mode-map "\C-c\C-fa" #'message-add-archive-header)
2877 ;; mark inserted text 2881 ;; mark inserted text
2878 (define-key message-mode-map "\C-c\M-m" 'message-mark-inserted-region) 2882 (define-key message-mode-map "\C-c\M-m" #'message-mark-inserted-region)
2879 (define-key message-mode-map "\C-c\M-f" 'message-mark-insert-file) 2883 (define-key message-mode-map "\C-c\M-f" #'message-mark-insert-file)
2880 2884
2881 (define-key message-mode-map "\C-c\C-b" 'message-goto-body) 2885 (define-key message-mode-map "\C-c\C-b" #'message-goto-body)
2882 (define-key message-mode-map "\C-c\C-i" 'message-goto-signature) 2886 (define-key message-mode-map "\C-c\C-i" #'message-goto-signature)
2883 2887
2884 (define-key message-mode-map "\C-c\C-t" 'message-insert-to) 2888 (define-key message-mode-map "\C-c\C-t" #'message-insert-to)
2885 (define-key message-mode-map "\C-c\C-fw" 'message-insert-wide-reply) 2889 (define-key message-mode-map "\C-c\C-fw" #'message-insert-wide-reply)
2886 (define-key message-mode-map "\C-c\C-n" 'message-insert-newsgroups) 2890 (define-key message-mode-map "\C-c\C-n" #'message-insert-newsgroups)
2887 (define-key message-mode-map "\C-c\C-l" 'message-to-list-only) 2891 (define-key message-mode-map "\C-c\C-l" #'message-to-list-only)
2888 (define-key message-mode-map "\C-c\C-f\C-e" 'message-insert-expires) 2892 (define-key message-mode-map "\C-c\C-f\C-e" #'message-insert-expires)
2889 2893
2890 (define-key message-mode-map "\C-c\C-u" 'message-insert-or-toggle-importance) 2894 (define-key message-mode-map "\C-c\C-u" #'message-insert-or-toggle-importance)
2891 (define-key message-mode-map "\C-c\M-n" 2895 (define-key message-mode-map "\C-c\M-n"
2892 'message-insert-disposition-notification-to) 2896 #'message-insert-disposition-notification-to)
2893 2897
2894 (define-key message-mode-map "\C-c\C-y" 'message-yank-original) 2898 (define-key message-mode-map "\C-c\C-y" #'message-yank-original)
2895 (define-key message-mode-map "\C-c\M-\C-y" 'message-yank-buffer) 2899 (define-key message-mode-map "\C-c\M-\C-y" #'message-yank-buffer)
2896 (define-key message-mode-map "\C-c\C-q" 'message-fill-yanked-message) 2900 (define-key message-mode-map "\C-c\C-q" #'message-fill-yanked-message)
2897 (define-key message-mode-map "\C-c\C-w" 'message-insert-signature) 2901 (define-key message-mode-map "\C-c\C-w" #'message-insert-signature)
2898 (define-key message-mode-map "\C-c\M-h" 'message-insert-headers) 2902 (define-key message-mode-map "\C-c\M-h" #'message-insert-headers)
2899 (define-key message-mode-map "\C-c\C-r" 'message-caesar-buffer-body) 2903 (define-key message-mode-map "\C-c\C-r" #'message-caesar-buffer-body)
2900 (define-key message-mode-map "\C-c\C-o" 'message-sort-headers) 2904 (define-key message-mode-map "\C-c\C-o" #'message-sort-headers)
2901 (define-key message-mode-map "\C-c\M-r" 'message-rename-buffer) 2905 (define-key message-mode-map "\C-c\M-r" #'message-rename-buffer)
2902 2906
2903 (define-key message-mode-map "\C-c\C-c" 'message-send-and-exit) 2907 (define-key message-mode-map "\C-c\C-c" #'message-send-and-exit)
2904 (define-key message-mode-map "\C-c\C-s" 'message-send) 2908 (define-key message-mode-map "\C-c\C-s" #'message-send)
2905 (define-key message-mode-map "\C-c\C-k" 'message-kill-buffer) 2909 (define-key message-mode-map "\C-c\C-k" #'message-kill-buffer)
2906 (define-key message-mode-map "\C-c\C-d" 'message-dont-send) 2910 (define-key message-mode-map "\C-c\C-d" #'message-dont-send)
2907 (define-key message-mode-map "\C-c\n" 'gnus-delay-article) 2911 (define-key message-mode-map "\C-c\n" #'gnus-delay-article)
2908 2912
2909 (define-key message-mode-map "\C-c\M-k" 'message-kill-address) 2913 (define-key message-mode-map "\C-c\M-k" #'message-kill-address)
2910 (define-key message-mode-map "\C-c\C-e" 'message-elide-region) 2914 (define-key message-mode-map "\C-c\C-e" #'message-elide-region)
2911 (define-key message-mode-map "\C-c\C-v" 'message-delete-not-region) 2915 (define-key message-mode-map "\C-c\C-v" #'message-delete-not-region)
2912 (define-key message-mode-map "\C-c\C-z" 'message-kill-to-signature) 2916 (define-key message-mode-map "\C-c\C-z" #'message-kill-to-signature)
2913 (define-key message-mode-map "\M-\r" 'message-newline-and-reformat) 2917 (define-key message-mode-map "\M-\r" #'message-newline-and-reformat)
2914 (define-key message-mode-map [remap split-line] 'message-split-line) 2918 (define-key message-mode-map [remap split-line] #'message-split-line)
2915 2919
2916 (define-key message-mode-map "\C-c\C-a" 'mml-attach-file) 2920 (define-key message-mode-map "\C-c\C-a" #'mml-attach-file)
2917 (define-key message-mode-map "\C-c\C-p" 'message-insert-screenshot) 2921 (define-key message-mode-map "\C-c\C-p" #'message-insert-screenshot)
2918 2922
2919 (define-key message-mode-map "\C-a" 'message-beginning-of-line) 2923 (define-key message-mode-map "\C-a" #'message-beginning-of-line)
2920 (define-key message-mode-map "\t" 'message-tab) 2924 (define-key message-mode-map "\t" #'message-tab)
2921 2925
2922 (define-key message-mode-map "\M-n" 'message-display-abbrev)) 2926 (define-key message-mode-map "\M-n" #'message-display-abbrev))
2923 2927
2924(easy-menu-define 2928(easy-menu-define
2925 message-mode-menu message-mode-map "Message Menu." 2929 message-mode-menu message-mode-map "Message Menu."
@@ -3169,14 +3173,13 @@ Like `text-mode', but with these additional commands:
3169 ;; `electric-pair-mode', and C-M-* navigation by syntactically 3173 ;; `electric-pair-mode', and C-M-* navigation by syntactically
3170 ;; excluding citations and other artifacts. 3174 ;; excluding citations and other artifacts.
3171 ;; 3175 ;;
3172 (setq-local syntax-propertize-function 'message--syntax-propertize) 3176 (setq-local syntax-propertize-function #'message--syntax-propertize)
3173 (setq-local parse-sexp-ignore-comments t) 3177 (setq-local parse-sexp-ignore-comments t)
3174 (setq-local message-encoded-mail-cache nil)) 3178 (setq-local message-encoded-mail-cache nil))
3175 3179
3176(defun message-setup-fill-variables () 3180(defun message-setup-fill-variables ()
3177 "Setup message fill variables." 3181 "Setup message fill variables."
3178 (setq-local fill-paragraph-function #'message-fill-paragraph) 3182 (setq-local fill-paragraph-function #'message-fill-paragraph)
3179 (make-local-variable 'adaptive-fill-first-line-regexp)
3180 (let ((quote-prefix-regexp 3183 (let ((quote-prefix-regexp
3181 ;; User should change message-cite-prefix-regexp if 3184 ;; User should change message-cite-prefix-regexp if
3182 ;; message-yank-prefix is set to an abnormal value. 3185 ;; message-yank-prefix is set to an abnormal value.
@@ -3287,7 +3290,7 @@ Like `text-mode', but with these additional commands:
3287 (push-mark) 3290 (push-mark)
3288 (message-position-on-field "Summary" "Subject")) 3291 (message-position-on-field "Summary" "Subject"))
3289 3292
3290(define-obsolete-function-alias 'message-goto-body-1 'message-goto-body "27.1") 3293(define-obsolete-function-alias 'message-goto-body-1 #'message-goto-body "27.1")
3291(defun message-goto-body (&optional interactive) 3294(defun message-goto-body (&optional interactive)
3292 "Move point to the beginning of the message body. 3295 "Move point to the beginning of the message body.
3293Returns point." 3296Returns point."
@@ -6662,9 +6665,8 @@ moved to the beginning "
6662 (not (buffer-modified-p buffer))) 6665 (not (buffer-modified-p buffer)))
6663 (kill-buffer buffer)))) 6666 (kill-buffer buffer))))
6664 ;; Rename the buffer. 6667 ;; Rename the buffer.
6665 (if message-send-rename-function 6668 (funcall (or message-send-rename-function
6666 (funcall message-send-rename-function) 6669 #'message-default-send-rename-function))
6667 (message-default-send-rename-function))
6668 ;; Push the current buffer onto the list. 6670 ;; Push the current buffer onto the list.
6669 (when message-max-buffers 6671 (when message-max-buffers
6670 (setq message-buffer-list 6672 (setq message-buffer-list
@@ -6763,8 +6765,9 @@ are not included."
6763(defun message-setup-1 (headers &optional yank-action actions return-action) 6765(defun message-setup-1 (headers &optional yank-action actions return-action)
6764 (dolist (action actions) 6766 (dolist (action actions)
6765 (condition-case nil 6767 (condition-case nil
6768 ;; FIXME: Use functions rather than expressions!
6766 (add-to-list 'message-send-actions 6769 (add-to-list 'message-send-actions
6767 `(apply ',(car action) ',(cdr action))))) 6770 `(apply #',(car action) ',(cdr action)))))
6768 (setq message-return-action return-action) 6771 (setq message-return-action return-action)
6769 (setq message-reply-buffer 6772 (setq message-reply-buffer
6770 (if (and (consp yank-action) 6773 (if (and (consp yank-action)
@@ -6903,7 +6906,7 @@ are not included."
6903;;;###autoload 6906;;;###autoload
6904(defun message-mail (&optional to subject other-headers continue 6907(defun message-mail (&optional to subject other-headers continue
6905 switch-function yank-action send-actions 6908 switch-function yank-action send-actions
6906 return-action &rest ignored) 6909 return-action &rest _)
6907 "Start editing a mail message to be sent. 6910 "Start editing a mail message to be sent.
6908OTHER-HEADERS is an alist of header/value pairs. CONTINUE says whether 6911OTHER-HEADERS is an alist of header/value pairs. CONTINUE says whether
6909to continue editing a message already being composed. SWITCH-FUNCTION 6912to continue editing a message already being composed. SWITCH-FUNCTION
@@ -7127,15 +7130,12 @@ want to get rid of this query permanently.")))
7127 ;; specific, and just Cc-in the rest. 7130 ;; specific, and just Cc-in the rest.
7128 (setq follow-to (list 7131 (setq follow-to (list
7129 (cons 'To 7132 (cons 'To
7130 (mapconcat 7133 (mapconcat #'cdr recipients ", "))))
7131 (lambda (addr)
7132 (cdr addr)) recipients ", "))))
7133 ;; Put the first recipient in the To header. 7134 ;; Put the first recipient in the To header.
7134 (setq follow-to (list (cons 'To (cdr (pop recipients))))) 7135 (setq follow-to (list (cons 'To (cdr (pop recipients)))))
7135 ;; Put the rest of the recipients in Cc. 7136 ;; Put the rest of the recipients in Cc.
7136 (when recipients 7137 (when recipients
7137 (setq recipients (mapconcat 7138 (setq recipients (mapconcat #'cdr recipients ", "))
7138 (lambda (addr) (cdr addr)) recipients ", "))
7139 (if (string-match "^ +" recipients) 7139 (if (string-match "^ +" recipients)
7140 (setq recipients (substring recipients (match-end 0)))) 7140 (setq recipients (substring recipients (match-end 0))))
7141 (push (cons 'Cc recipients) follow-to))))) 7141 (push (cons 'Cc recipients) follow-to)))))
@@ -7862,7 +7862,7 @@ is for the internal use."
7862 (interactive) 7862 (interactive)
7863 (setq rmail-enable-mime-composing t) 7863 (setq rmail-enable-mime-composing t)
7864 (setq rmail-insert-mime-forwarded-message-function 7864 (setq rmail-insert-mime-forwarded-message-function
7865 'message-forward-rmail-make-body)) 7865 #'message-forward-rmail-make-body))
7866 7866
7867;;;###autoload 7867;;;###autoload
7868(defun message-resend (address) 7868(defun message-resend (address)