Re: Variable used to detect reply prefixes in Subject

Subject: Re: Variable used to detect reply prefixes in Subject

Date: Sun, 23 Jan 2022 17:58:24 +0200

To: Jonas Bernoulli, notmuch@notmuchmail.org

Cc:

From: Teemu Likonen


* 2022-01-23 15:13:18+0100, Jonas Bernoulli wrote:

> Please tell me what variable I have to customize to recognize
> additional unusual prefixes that some people add to the subject when
> they send a reply.

There is message-subject-re-regexp. 

> Ps: Since (I assume) many notmuch users also frequent emacs-devel,
>     where a frequent commentator uses the prefix "RE: [External] : ",
>     maybe notmuch could even recognize that by default? (I asked him
>     to consider not doing that anymore, but even if he agrees, that
>     would not affect his numerous past replies.)

Yes. That is annoying. I have written a custom Subject cleaner for my
replies:


(add-hook 'message-setup-hook 'my-message-subject-clean)

(defun my-message-subject-clean ()
  ;; Delete first \( ... \) group from Subject header.
  (my-with-message-headers
    (let ((case-fold-search nil))
      (dolist (re '(".*\\(\\[ ?SPAM\\(?: UNSURE\\|\\?\\)? ?\\] \\(?:Re: \\)?\\)"
                    ".*\\(\\(?:Re: \\)* *\\[External\\][ :]*\\(?:Re: *\\)*\\)"))
        (goto-char (point-min))
        (when (re-search-forward (concat "^Subject: " re) nil t)
          (delete-region (match-beginning 1) (match-end 1)))))))

(defmacro my-with-message-headers (&rest body)
  (declare (indent 0))
  `(save-excursion
     (save-restriction
       (save-match-data
         (message-narrow-to-head)
         ,@body))))

-- 
/// Teemu Likonen - .-.. https://www.iki.fi/tlikonen/
// OpenPGP: 6965F03973F0D4CA22B9410F0F2CAE0E07608462
signature.asc (application/pgp-signature)
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: