unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Herbert Valerio Riedel <hvr@gnu.org>
To: notmuch@notmuchmail.org
Subject: `notmuch-message-headers` interpreted case-sensitively
Date: Wed, 24 Apr 2024 08:22:41 +0200	[thread overview]
Message-ID: <da4bd40fb0498308522f015b6b738de1.hvr@gnu.org> (raw)

Hello!

Not sure if this is a bug or intentional behaviour but it did surprise me:

When I added "Message-Id" to `notmuch-message-headers` I noticed that
sometimes the header would be shown and sometimes not. It turns out that
some MUAs generate the header as "Message-Id" and others as "Message-ID"
with a slightly different capitalization.

Only when I included both, "Message-Id" and "Message-ID", in
`notmuch-message-headers` I was able to workaround this issue.

the culprit seems to be the function below which does no attempt to
retrieve the respective header case-insensitively via `plist-get` as it
constructs a symbol :Message-Id or :Message-id respectively which are
not equal as the `eq` comparison is used by default:

--8<---------------cut here---------------start------------->8---
(defun notmuch-show-insert-headers (headers)
  "Insert the headers of the current message."
  (let ((start (point)))
    (mapc (lambda (header)
	    (let* ((header-symbol (intern (concat ":" header)))
		   (header-value (plist-get headers header-symbol)))
	      (when (and header-value
			 (not (string-equal "" header-value)))
		(notmuch-show-insert-header header header-value))))
	  notmuch-message-headers)
    (save-excursion
      (save-restriction
	(narrow-to-region start (point-max))
	(run-hooks 'notmuch-show-markup-headers-hook)))))
--8<---------------cut here---------------end--------------->8---

                 reply	other threads:[~2024-04-24  6:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=da4bd40fb0498308522f015b6b738de1.hvr@gnu.org \
    --to=hvr@gnu.org \
    --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).