unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Teemu Likonen <tlikonen@iki.fi>
To: Jonas Bernoulli <jonas@bernoul.li>, notmuch@notmuchmail.org
Subject: Re: Variable used to detect reply prefixes in Subject
Date: Sun, 23 Jan 2022 17:58:24 +0200	[thread overview]
Message-ID: <87tudu8mvz.fsf@iki.fi> (raw)
In-Reply-To: <87bl02k0ap.fsf@bernoul.li>


[-- Attachment #1.1: Type: text/plain, Size: 1539 bytes --]

* 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

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 434 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  reply	other threads:[~2022-01-23 16:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-23 14:13 Variable used to detect reply prefixes in Subject Jonas Bernoulli
2022-01-23 15:58 ` Teemu Likonen [this message]
2022-01-23 19:43 ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87tudu8mvz.fsf@iki.fi \
    --to=tlikonen@iki.fi \
    --cc=jonas@bernoul.li \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).