summaryrefslogtreecommitdiff
path: root/lisp/gnus
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2019-11-22 00:19:43 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2019-11-22 00:20:02 +0100
commit04208780262faaee772c96567069ceb9184c864f (patch)
tree26de5ec8af6bd8cc5c51f4a87ed0d80fb5e156be /lisp/gnus
parent20b1e959e077492817bea34392ba2dda745c4641 (diff)
downloademacs-04208780262faaee772c96567069ceb9184c864f.tar.gz
Make `C-c C-w' insert a signature even when overridden
* lisp/gnus/message.el (message-insert-signature): When called interactively, look harder for a signature to insert (bug#38289).
Diffstat (limited to 'lisp/gnus')
-rw-r--r--lisp/gnus/message.el99
1 files changed, 55 insertions, 44 deletions
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 83ec211a7d1..54ab86a970d 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -3538,50 +3538,61 @@ Message buffers and is not meant to be called directly."
(defun message-insert-signature (&optional force)
"Insert a signature. See documentation for variable `message-signature'."
(interactive (list 0))
- (let* ((signature
- (cond
- ((and (null message-signature)
- (eq force 0))
- (save-excursion
- (goto-char (point-max))
- (not (re-search-backward message-signature-separator nil t))))
- ((and (null message-signature)
- force)
- t)
- ((functionp message-signature)
- (funcall message-signature))
- ((listp message-signature)
- (eval message-signature))
- (t message-signature)))
- signature-file)
- (setq signature
- (cond ((stringp signature)
- signature)
- ((and (eq t signature) message-signature-file)
- (setq signature-file
- (if (and message-signature-directory
- ;; don't actually use the signature directory
- ;; if message-signature-file contains a path.
- (not (file-name-directory
- message-signature-file)))
- (expand-file-name message-signature-file
- message-signature-directory)
- message-signature-file))
- (file-exists-p signature-file))))
- (when signature
- (goto-char (point-max))
- ;; Insert the signature.
- (unless (bolp)
- (newline))
- (when message-signature-insert-empty-line
- (newline))
- (insert "-- ")
- (newline)
- (if (eq signature t)
- (insert-file-contents signature-file)
- (insert signature))
- (goto-char (point-max))
- (or (bolp) (newline)))))
+ (let ((message-signature message-signature)
+ (message-signature-file message-signature-file))
+ ;; If called interactively and there's no signature to insert,
+ ;; consult the global values to see whether there's anything they
+ ;; have to say for themselves. This can happen when using
+ ;; `gnus-posting-styles', for instance.
+ (when (and (null message-signature)
+ (null message-signature-file)
+ (eq force 0))
+ (setq message-signature (default-value 'message-signature)
+ message-signature-file (default-value 'message-signature-file)))
+ (let* ((signature
+ (cond
+ ((and (null message-signature)
+ (eq force 0))
+ (save-excursion
+ (goto-char (point-max))
+ (not (re-search-backward message-signature-separator nil t))))
+ ((and (null message-signature)
+ force)
+ t)
+ ((functionp message-signature)
+ (funcall message-signature))
+ ((listp message-signature)
+ (eval message-signature))
+ (t message-signature)))
+ signature-file)
+ (setq signature
+ (cond ((stringp signature)
+ signature)
+ ((and (eq t signature) message-signature-file)
+ (setq signature-file
+ (if (and message-signature-directory
+ ;; don't actually use the signature directory
+ ;; if message-signature-file contains a path.
+ (not (file-name-directory
+ message-signature-file)))
+ (expand-file-name message-signature-file
+ message-signature-directory)
+ message-signature-file))
+ (file-exists-p signature-file))))
+ (when signature
+ (goto-char (point-max))
+ ;; Insert the signature.
+ (unless (bolp)
+ (newline))
+ (when message-signature-insert-empty-line
+ (newline))
+ (insert "-- ")
+ (newline)
+ (if (eq signature t)
+ (insert-file-contents signature-file)
+ (insert signature))
+ (goto-char (point-max))
+ (or (bolp) (newline))))))
(defun message-insert-importance-high ()
"Insert header to mark message as important."