unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* Variable used to detect reply prefixes in Subject
@ 2022-01-23 14:13 Jonas Bernoulli
  2022-01-23 15:58 ` Teemu Likonen
  2022-01-23 19:43 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: Jonas Bernoulli @ 2022-01-23 14:13 UTC (permalink / raw)
  To: notmuch

Hello,

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.

I searched using some strings I would expect to appear in the value of
that variable but either got no results or way too many.

     Thanks!
     Jonas


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.)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Variable used to detect reply prefixes in Subject
  2022-01-23 14:13 Variable used to detect reply prefixes in Subject Jonas Bernoulli
@ 2022-01-23 15:58 ` Teemu Likonen
  2022-01-23 19:43 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: Teemu Likonen @ 2022-01-23 15:58 UTC (permalink / raw)
  To: Jonas Bernoulli, notmuch


[-- 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 --]



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Variable used to detect reply prefixes in Subject
  2022-01-23 14:13 Variable used to detect reply prefixes in Subject Jonas Bernoulli
  2022-01-23 15:58 ` Teemu Likonen
@ 2022-01-23 19:43 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2022-01-23 19:43 UTC (permalink / raw)
  To: Jonas Bernoulli, notmuch

Jonas Bernoulli <jonas@bernoul.li> writes:

> Hello,
>
> 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.
>
> I searched using some strings I would expect to appear in the value of
> that variable but either got no results or way too many.

There is some simple (-minded?) processing in notmuch-reply.c, which
just adds Re: to the front of the subject if it is not already present.

The original headers are also returned, so in principle the emacs front
end could do something smarter.

d

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-23 19:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-23 14:13 Variable used to detect reply prefixes in Subject Jonas Bernoulli
2022-01-23 15:58 ` Teemu Likonen
2022-01-23 19:43 ` David Bremner

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).