From 296c4d7c09cf66b2a97e8871c5a903fda9d0919e Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Fri, 28 Oct 2022 19:43:06 -0500 Subject: uhhhhh --- lisp/+message.el | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 lisp/+message.el (limited to 'lisp/+message.el') diff --git a/lisp/+message.el b/lisp/+message.el new file mode 100644 index 0000000..b8bc234 --- /dev/null +++ b/lisp/+message.el @@ -0,0 +1,26 @@ +;;; +message.el --- Extra message-mode functions -*- lexical-binding: t; -*- + +;;; Commentary: + +;;; Code: + +;; Thanks to Alex Schroeder for this! +;; https://www.emacswiki.org/emacs/Change_Signature_Dynamically + +(defun +message-check-for-signature-change (&rest ignore) + "Check for a change in the To: or Cc: fields" + (when (and (message--in-tocc-p) + (not (buffer-narrowed-p))) + (save-excursion + (goto-char (point-max)) + (let ((end (point))) + (when (re-search-backward message-signature-separator nil t) + (delete-region (1- (match-beginning 0)) end))) + (message-insert-signature)))) + +(defun +message-signature-setup () + (make-local-variable 'after-change-functions) + (push '+message-check-for-signature-change after-change-functions)) + +(provide '+message) +;;; +message.el ends here -- cgit 1.4.1-21-gabe81