aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-11-22 00:19:43 +0100
committerLars Ingebrigtsen2019-11-22 00:20:02 +0100
commit04208780262faaee772c96567069ceb9184c864f (patch)
tree26de5ec8af6bd8cc5c51f4a87ed0d80fb5e156be /lisp
parent20b1e959e077492817bea34392ba2dda745c4641 (diff)
downloademacs-04208780262faaee772c96567069ceb9184c864f.tar.gz
emacs-04208780262faaee772c96567069ceb9184c864f.zip
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')
-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."
3538(defun message-insert-signature (&optional force) 3538(defun message-insert-signature (&optional force)
3539 "Insert a signature. See documentation for variable `message-signature'." 3539 "Insert a signature. See documentation for variable `message-signature'."
3540 (interactive (list 0)) 3540 (interactive (list 0))
3541 (let* ((signature 3541 (let ((message-signature message-signature)
3542 (cond 3542 (message-signature-file message-signature-file))
3543 ((and (null message-signature) 3543 ;; If called interactively and there's no signature to insert,
3544 (eq force 0)) 3544 ;; consult the global values to see whether there's anything they
3545 (save-excursion 3545 ;; have to say for themselves. This can happen when using
3546 (goto-char (point-max)) 3546 ;; `gnus-posting-styles', for instance.
3547 (not (re-search-backward message-signature-separator nil t)))) 3547 (when (and (null message-signature)
3548 ((and (null message-signature) 3548 (null message-signature-file)
3549 force) 3549 (eq force 0))
3550 t) 3550 (setq message-signature (default-value 'message-signature)
3551 ((functionp message-signature) 3551 message-signature-file (default-value 'message-signature-file)))
3552 (funcall message-signature)) 3552 (let* ((signature
3553 ((listp message-signature) 3553 (cond
3554 (eval message-signature)) 3554 ((and (null message-signature)
3555 (t message-signature))) 3555 (eq force 0))
3556 signature-file) 3556 (save-excursion
3557 (setq signature 3557 (goto-char (point-max))
3558 (cond ((stringp signature) 3558 (not (re-search-backward message-signature-separator nil t))))
3559 signature) 3559 ((and (null message-signature)
3560 ((and (eq t signature) message-signature-file) 3560 force)
3561 (setq signature-file 3561 t)
3562 (if (and message-signature-directory 3562 ((functionp message-signature)
3563 ;; don't actually use the signature directory 3563 (funcall message-signature))
3564 ;; if message-signature-file contains a path. 3564 ((listp message-signature)
3565 (not (file-name-directory 3565 (eval message-signature))
3566 message-signature-file))) 3566 (t message-signature)))
3567 (expand-file-name message-signature-file 3567 signature-file)
3568 message-signature-directory) 3568 (setq signature
3569 message-signature-file)) 3569 (cond ((stringp signature)
3570 (file-exists-p signature-file)))) 3570 signature)
3571 (when signature 3571 ((and (eq t signature) message-signature-file)
3572 (goto-char (point-max)) 3572 (setq signature-file
3573 ;; Insert the signature. 3573 (if (and message-signature-directory
3574 (unless (bolp) 3574 ;; don't actually use the signature directory
3575 (newline)) 3575 ;; if message-signature-file contains a path.
3576 (when message-signature-insert-empty-line 3576 (not (file-name-directory
3577 (newline)) 3577 message-signature-file)))
3578 (insert "-- ") 3578 (expand-file-name message-signature-file
3579 (newline) 3579 message-signature-directory)
3580 (if (eq signature t) 3580 message-signature-file))
3581 (insert-file-contents signature-file) 3581 (file-exists-p signature-file))))
3582 (insert signature)) 3582 (when signature
3583 (goto-char (point-max)) 3583 (goto-char (point-max))
3584 (or (bolp) (newline))))) 3584 ;; Insert the signature.
3585 (unless (bolp)
3586 (newline))
3587 (when message-signature-insert-empty-line
3588 (newline))
3589 (insert "-- ")
3590 (newline)
3591 (if (eq signature t)
3592 (insert-file-contents signature-file)
3593 (insert signature))
3594 (goto-char (point-max))
3595 (or (bolp) (newline))))))
3585 3596
3586(defun message-insert-importance-high () 3597(defun message-insert-importance-high ()
3587 "Insert header to mark message as important." 3598 "Insert header to mark message as important."