From 038d6ea6b623fc40038eac25603956f73b62294d Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Mon, 4 Dec 2023 20:39:56 +0200 Subject: [PATCH] mu4e-headers: avoid defcustom warning for mu4e-headers-field Variable may contain custom (user-specified) fields, no need to warn for that; suggested by @mekeor. Fixes #2607 --- mu4e/mu4e-headers.el | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el index 2c30a6ef..11d1dea8 100644 --- a/mu4e/mu4e-headers.el +++ b/mu4e/mu4e-headers.el @@ -56,7 +56,6 @@ (declare-function mu4e--main-view "mu4e-main") - ;;; Configuration (defgroup mu4e-headers nil @@ -79,15 +78,24 @@ for the rightmost (last) field. Note that emacs may become very slow with excessively long lines (1000s of characters), so if you regularly get such messages, you want to avoid fields with nil altogether." - :type `(repeat (cons (choice ,@(mapcar (lambda (h) - (list 'const :tag - (plist-get (cdr h) :help) - (car h))) - mu4e-header-info)) + :type `(repeat (cons (choice + ,@(mapcar (lambda (h) + (list 'const :tag + (plist-get (cdr h) :help) + (car h))) + mu4e-header-info) + (restricted-sexp + :tag "User-specified header" + :match-alternatives (mu4e--headers-header-p))) (choice (integer :tag "width") (const :tag "unrestricted width" nil)))) :group 'mu4e-headers) +(defun mu4e--headers-header-p (symbol) + "Is symbol a valid mu4e header? +This means its either one of the build-in or user-specified headers." + (assoc symbol (append mu4e-header-info mu4e-header-info-custom))) + (defcustom mu4e-headers-date-format "%x" "Date format to use in the headers view. In the format of `format-time-string'."