unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* `notmuch-message-headers` interpreted case-sensitively
@ 2024-04-24  6:22 Herbert Valerio Riedel
  0 siblings, 0 replies; only message in thread
From: Herbert Valerio Riedel @ 2024-04-24  6:22 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-24  6:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-24  6:22 `notmuch-message-headers` interpreted case-sensitively Herbert Valerio Riedel

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