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,


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

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

(defun my-message-subject-clean ()
  ;; Delete first \( ... \) group from Subject header.
    (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))

/// Teemu Likonen - .-..
// OpenPGP: 6965F03973F0D4CA22B9410F0F2CAE0E07608462
signature.asc (application/pgp-signature)
notmuch mailing list --
To unsubscribe send an email to