`notmuch-message-headers` interpreted case-sensitively

Subject: `notmuch-message-headers` interpreted case-sensitively

Date: Wed, 24 Apr 2024 08:22:41 +0200

To: notmuch@notmuchmail.org


From: Herbert Valerio Riedel


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))))
	(narrow-to-region start (point-max))
	(run-hooks 'notmuch-show-markup-headers-hook)))))
--8<---------------cut here---------------end--------------->8---
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org