mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
* lisp/gnus/message.el: Reduce redundancy with send-mail-function
(message-send-mail-function) <function>: Remove `local-library` tests for libs distributed with Emacs. (message-use-send-mail-function): New function. (message-default-send-mail-function): Default to it, and remove cases already handled by it. (message--default-send-mail-function): New function. (message-send-mail-function) <variable>: Use it as new default. (message-sendmail-f-is-evil): Obey mail-specify-envelope-from if available. (message-check, message-with-reply-buffer): Use `declare`. (message-smtpmail-send-it): smtpmail accepts mail-header-separator, so simplify and declare obsolete. (message-send-mail-with-mailclient): Declare obsolete. (message-check-news-body-syntax): Don't presume that the checksum is a fixnum.
This commit is contained in:
parent
add146f09f
commit
3a59cc8406
1 changed files with 47 additions and 46 deletions
|
|
@ -666,30 +666,29 @@ variable should be a regexp or a list of regexps."
|
|||
|
||||
(defun message-send-mail-function ()
|
||||
"Return suitable value for the variable `message-send-mail-function'."
|
||||
(cond ((and (require 'sendmail)
|
||||
(boundp 'sendmail-program)
|
||||
sendmail-program
|
||||
(executable-find sendmail-program))
|
||||
'message-send-mail-with-sendmail)
|
||||
((and (locate-library "smtpmail")
|
||||
(boundp 'smtpmail-default-smtp-server)
|
||||
smtpmail-default-smtp-server)
|
||||
'message-smtpmail-send-it)
|
||||
((locate-library "mailclient")
|
||||
'message-send-mail-with-mailclient)
|
||||
(declare (obsolete nil "27.1"))
|
||||
(require 'sendmail)
|
||||
(defvar sendmail-program)
|
||||
(cond ((executable-find sendmail-program)
|
||||
#'message-send-mail-with-sendmail)
|
||||
((bound-and-true-p 'smtpmail-default-smtp-server)
|
||||
#'message-smtpmail-send-it)
|
||||
(t
|
||||
(error "Don't know how to send mail. Please customize `message-send-mail-function'"))))
|
||||
#'message-send-mail-with-mailclient)))
|
||||
|
||||
(defun message-default-send-mail-function ()
|
||||
(cond ((eq send-mail-function 'smtpmail-send-it) 'message-smtpmail-send-it)
|
||||
((eq send-mail-function 'feedmail-send-it) 'feedmail-send-it)
|
||||
((eq send-mail-function 'sendmail-query-once) 'sendmail-query-once)
|
||||
((eq send-mail-function 'mailclient-send-it)
|
||||
'message-send-mail-with-mailclient)
|
||||
(t (message-send-mail-function))))
|
||||
(cond ((eq send-mail-function #'feedmail-send-it) #'feedmail-send-it)
|
||||
((eq send-mail-function #'sendmail-query-once) #'sendmail-query-once)
|
||||
((eq send-mail-function #'sendmail-send-it)
|
||||
#'message-send-mail-with-sendmail)
|
||||
(t #'message-use-send-mail-function)))
|
||||
|
||||
(defun message--default-send-mail-function ()
|
||||
"Use the setting of `send-mail-function' if applicable."
|
||||
(funcall (message-default-send-mail-function)))
|
||||
|
||||
;; Useful to set in site-init.el
|
||||
(defcustom message-send-mail-function (message-default-send-mail-function)
|
||||
(defcustom message-send-mail-function #'message--default-send-mail-function
|
||||
"Function to call to send the current buffer as mail.
|
||||
The headers should be delimited by a line whose contents match the
|
||||
variable `mail-header-separator'.
|
||||
|
|
@ -702,7 +701,9 @@ default is system dependent and determined by the function
|
|||
`message-send-mail-function'.
|
||||
|
||||
See also `send-mail-function'."
|
||||
:type '(radio (function-item message-send-mail-with-sendmail)
|
||||
:type '(radio (function-item message--default-send-mail-function
|
||||
:tag "Use send-mail-function")
|
||||
(function-item message-send-mail-with-sendmail)
|
||||
(function-item message-send-mail-with-mh)
|
||||
(function-item message-send-mail-with-qmail)
|
||||
(function-item message-smtpmail-send-it)
|
||||
|
|
@ -712,8 +713,8 @@ See also `send-mail-function'."
|
|||
:tag "Use Mailclient package")
|
||||
(function :tag "Other"))
|
||||
:group 'message-sending
|
||||
:version "23.2"
|
||||
:initialize 'custom-initialize-default
|
||||
:version "27.1"
|
||||
:initialize #'custom-initialize-default
|
||||
:link '(custom-manual "(message)Mail Variables")
|
||||
:group 'message-mail)
|
||||
|
||||
|
|
@ -834,7 +835,10 @@ symbol `never', the posting is not allowed. If it is the symbol
|
|||
(const never)
|
||||
(const ask)))
|
||||
|
||||
(defcustom message-sendmail-f-is-evil nil
|
||||
(defcustom message-sendmail-f-is-evil
|
||||
(if (boundp 'mail-specify-envelope-from)
|
||||
(not mail-specify-envelope-from)
|
||||
nil)
|
||||
"Non-nil means don't add \"-f username\" to the sendmail command line.
|
||||
Doing so would be even more evil than leaving it out."
|
||||
:group 'message-sending
|
||||
|
|
@ -1920,10 +1924,10 @@ You must have the \"hashcash\" binary installed, see `hashcash-path'."
|
|||
"Ask QUESTION, displaying remaining args in a temporary buffer if SHOW."
|
||||
`(message-talkative-question 'y-or-n-p ,question ,show ,@text))
|
||||
|
||||
(defmacro message-delete-line (&optional n)
|
||||
(defsubst message-delete-line (&optional n)
|
||||
"Delete the current line (and the next N lines)."
|
||||
`(delete-region (progn (beginning-of-line) (point))
|
||||
(progn (forward-line ,(or n 1)) (point))))
|
||||
(delete-region (progn (beginning-of-line) (point))
|
||||
(progn (forward-line (or n 1)) (point))))
|
||||
|
||||
(defun message-mark-active-p ()
|
||||
"Non-nil means the mark and region are currently active in this buffer."
|
||||
|
|
@ -2039,13 +2043,11 @@ see `message-narrow-to-headers-or-head'."
|
|||
|
||||
(defmacro message-with-reply-buffer (&rest forms)
|
||||
"Evaluate FORMS in the reply buffer, if it exists."
|
||||
(declare (indent 0) (debug t))
|
||||
`(when (buffer-live-p message-reply-buffer)
|
||||
(with-current-buffer message-reply-buffer
|
||||
,@forms)))
|
||||
|
||||
(put 'message-with-reply-buffer 'lisp-indent-function 0)
|
||||
(put 'message-with-reply-buffer 'edebug-form-spec '(body))
|
||||
|
||||
(defun message-fetch-reply-field (header)
|
||||
"Fetch field HEADER from the message we're replying to."
|
||||
(message-with-reply-buffer
|
||||
|
|
@ -4174,13 +4176,11 @@ It should typically alter the sending method in some way or other."
|
|||
|
||||
(defmacro message-check (type &rest forms)
|
||||
"Eval FORMS if TYPE is to be checked."
|
||||
(declare (indent 1) (debug t))
|
||||
`(or (message-check-element ,type)
|
||||
(save-excursion
|
||||
,@forms)))
|
||||
|
||||
(put 'message-check 'lisp-indent-function 1)
|
||||
(put 'message-check 'edebug-form-spec '(form body))
|
||||
|
||||
(defun message-text-with-property (prop &optional start end reverse)
|
||||
"Return a list of start and end positions where the text has PROP.
|
||||
START and END bound the search, they default to `point-min' and
|
||||
|
|
@ -4818,24 +4818,25 @@ to find out how to use this."
|
|||
;; Pass it on to mh.
|
||||
(mh-send-letter)))
|
||||
|
||||
(defun message-use-send-mail-function ()
|
||||
(run-hooks 'message-send-mail-hook)
|
||||
(funcall send-mail-function))
|
||||
|
||||
(defun message-smtpmail-send-it ()
|
||||
"Send the prepared message buffer with `smtpmail-send-it'.
|
||||
The only difference from `smtpmail-send-it' is that this command
|
||||
evaluates `message-send-mail-hook' just before sending a message.
|
||||
It is useful if your ISP requires the POP-before-SMTP
|
||||
authentication. See the Gnus manual for details."
|
||||
(declare (obsolete message-use-send-mail-function "27.1"))
|
||||
(run-hooks 'message-send-mail-hook)
|
||||
;; Change header-delimiter to be what smtpmail expects.
|
||||
(goto-char (point-min))
|
||||
(when (re-search-forward
|
||||
(concat "^" (regexp-quote mail-header-separator) "\n"))
|
||||
(replace-match "\n"))
|
||||
(smtpmail-send-it))
|
||||
|
||||
(defun message-send-mail-with-mailclient ()
|
||||
"Send the prepared message buffer with `mailclient-send-it'.
|
||||
The only difference from `mailclient-send-it' is that this
|
||||
command evaluates `message-send-mail-hook' just before sending a message."
|
||||
(declare (obsolete message-use-send-mail-function "27.1"))
|
||||
(run-hooks 'message-send-mail-hook)
|
||||
(mailclient-send-it))
|
||||
|
||||
|
|
@ -5325,7 +5326,7 @@ Otherwise, generate and save a value for `canlock-password' first."
|
|||
(message-check 'new-text
|
||||
(or
|
||||
(not message-checksum)
|
||||
(not (eq (message-checksum) message-checksum))
|
||||
(not (equal (message-checksum) message-checksum))
|
||||
(if (message-gnksa-enable-p 'quoted-text-only)
|
||||
(y-or-n-p
|
||||
"It looks like no new text has been added. Really post? ")
|
||||
|
|
@ -7815,8 +7816,8 @@ Pre-defined symbols include `message-tool-bar-gnome' and
|
|||
(repeat :tag "User defined list" gmm-tool-bar-item)
|
||||
(symbol))
|
||||
:version "23.1" ;; No Gnus
|
||||
:initialize 'custom-initialize-default
|
||||
:set 'message-tool-bar-update
|
||||
:initialize #'custom-initialize-default
|
||||
:set #'message-tool-bar-update
|
||||
:group 'message)
|
||||
|
||||
(defcustom message-tool-bar-gnome
|
||||
|
|
@ -7840,8 +7841,8 @@ Pre-defined symbols include `message-tool-bar-gnome' and
|
|||
See `gmm-tool-bar-from-list' for details on the format of the list."
|
||||
:type '(repeat gmm-tool-bar-item)
|
||||
:version "23.1" ;; No Gnus
|
||||
:initialize 'custom-initialize-default
|
||||
:set 'message-tool-bar-update
|
||||
:initialize #'custom-initialize-default
|
||||
:set #'message-tool-bar-update
|
||||
:group 'message)
|
||||
|
||||
(defcustom message-tool-bar-retro
|
||||
|
|
@ -7860,8 +7861,8 @@ See `gmm-tool-bar-from-list' for details on the format of the list."
|
|||
See `gmm-tool-bar-from-list' for details on the format of the list."
|
||||
:type '(repeat gmm-tool-bar-item)
|
||||
:version "23.1" ;; No Gnus
|
||||
:initialize 'custom-initialize-default
|
||||
:set 'message-tool-bar-update
|
||||
:initialize #'custom-initialize-default
|
||||
:set #'message-tool-bar-update
|
||||
:group 'message)
|
||||
|
||||
(defcustom message-tool-bar-zap-list
|
||||
|
|
@ -7873,8 +7874,8 @@ These items are not displayed on the message mode tool bar.
|
|||
See `gmm-tool-bar-from-list' for the format of the list."
|
||||
:type 'gmm-tool-bar-zap-list
|
||||
:version "23.1" ;; No Gnus
|
||||
:initialize 'custom-initialize-default
|
||||
:set 'message-tool-bar-update
|
||||
:initialize #'custom-initialize-default
|
||||
:set #'message-tool-bar-update
|
||||
:group 'message)
|
||||
|
||||
(defvar image-load-path)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue