summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2026-04-11 11:04:04 +0300
committerDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2026-04-11 17:50:06 +0300
commit4ba9c44a7d95f322b99e6dea32d68a92678c450c (patch)
tree89a4479dd77ee3ea8a4ff84468b2a1cdd693f7ba
parente34c9a3458fa7e9d27527d19045ed5c286da8312 (diff)
mu4e-view: update field handling
Restrict fields in mu4e-view-fields. Make the defcustom a bit more helpful by checking for valid fields. Add :labels to default fields Remove some unused code.
-rw-r--r--NEWS.org9
-rw-r--r--mu4e/mu4e-headers.el9
-rw-r--r--mu4e/mu4e-vars.el7
-rw-r--r--mu4e/mu4e-view.el26
-rw-r--r--mu4e/mu4e.texi3
5 files changed, 38 insertions, 16 deletions
diff --git a/NEWS.org b/NEWS.org
index 33b4f66..76e5423 100644
--- a/NEWS.org
+++ b/NEWS.org
@@ -28,6 +28,15 @@
(see docstring). E.g. when you have the "Nerd Icons" package, you can set
this to ~nerd-icons-icon-for-file~. (1.14.1)
+ - The message-view display has been stream-lined in number of ways, removing
+ some of the Gnus-elements. (1.14.1)
+
+ You can streamline the display further by suppressing the "Attachments:"
+ headers, since most of the information is contained in the message body (or
+ through ~M-x mu4e-view-mime-part-action~, 'A'); see
+ ~gnus-mime-display-attachment-buttons-in-header~, and
+ ~gnus-mime-button-line-format~ to tweak the appearance
+
- ~mu4e-compose-crypto-policy~ now also recognizes ~sign-signed-replies~, to
automatically sign when replying to signed messages (1.14.1).
diff --git a/mu4e/mu4e-headers.el b/mu4e/mu4e-headers.el
index 3e2346e..ba27c9c 100644
--- a/mu4e/mu4e-headers.el
+++ b/mu4e/mu4e-headers.el
@@ -68,7 +68,7 @@
"A list of header fields to show in the headers buffer.
Each element has the form (HEADER . WIDTH), where HEADER is one of
the available headers (see `mu4e-header-info') and WIDTH is the
-respective width in characters.
+respective width in characters
A width of nil means \"unrestricted\", and this is best reserved
for the rightmost (last) field. Note that emacs may become very
@@ -83,16 +83,11 @@ altogether."
mu4e-header-info)
(restricted-sexp
:tag "User-specified header"
- :match-alternatives (mu4e--headers-header-p)))
+ :match-alternatives (mu4e--valid-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'."
diff --git a/mu4e/mu4e-vars.el b/mu4e/mu4e-vars.el
index a1753ad..f3cd253 100644
--- a/mu4e/mu4e-vars.el
+++ b/mu4e/mu4e-vars.el
@@ -379,6 +379,13 @@ Note that when using the gnus-based view, you only have access to
a limited set of message fields: only the ones used in the
header-view, not including, for instance, the message body.")
+(defun mu4e--valid-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)))
+
+
+
;;; Internals
(defvar-local mu4e~headers-view-win nil
diff --git a/mu4e/mu4e-view.el b/mu4e/mu4e-view.el
index c6d3c80..ec26dc3 100644
--- a/mu4e/mu4e-view.el
+++ b/mu4e/mu4e-view.el
@@ -61,17 +61,27 @@ Otherwise, don't move to the next message."
:group 'mu4e-view)
(defcustom mu4e-view-fields
- '(:from :to :cc :subject :flags :date :maildir :mailing-list :tags)
- "Header fields to display in the message view buffer.
+ '(:from :to :cc :subject :flags :date
+ :maildir :mailing-list :tags :labels)
+ "Mu4e header fields to display in the message view buffer.
For the complete list of available headers, see
`mu4e-header-info'.
-Note, you can use this to add fields that are not otherwise
-shown; you can further tweak the other fields using e.g.,
-`gnus-visible-headers' and `gnus-ignored-headers' - see the gnus
-documentation for details."
- :type '(repeat symbol)
+In addition to the mu4e fields, Gnus _also_ can show fields; See
+`gnus-visible-headers' and `gnus-ignored-headers'. A special case
+is the Attachments: header: see
+`gnus-mime-display-attachment-buttons-in-header', and
+`gnus-mime-button-line-format' for tweaking the appearance."
+ :type `(repeat (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--valid-header-p))))
:group 'mu4e-view)
(defcustom mu4e-view-actions
@@ -579,7 +589,6 @@ activates URLs (in plain-text mode only)."
(charset (and charset (intern charset)))
(mu4e--view-rendering t) ;; needed if e.g. an ics file is buttonized
(gnus-article-emulate-mime nil) ;; avoid perf problems
- (gnus-mime-button-line-format "%{%([%p. %n]%)%}%e\n")
(gnus-newsgroup-charset
(if (and charset (coding-system-p charset)) charset
(detect-coding-region (point-min) (point-max) t)))
@@ -696,7 +705,6 @@ render. After inserting, highlight the headers."
;; otherwise they are handled by Gnus.
(when-let* ((raw (and raw-headers (cdr (assq field raw-headers)))))
(mu4e--view-gnus-insert-header field raw)))
- ((or ':attachments ':signature ':decryption)) ;; skip
(_
(mu4e--view-gnus-insert-header-custom msg field)))))
;; Highlight the header block we just inserted
diff --git a/mu4e/mu4e.texi b/mu4e/mu4e.texi
index 8ed9c0e..e0920a4 100644
--- a/mu4e/mu4e.texi
+++ b/mu4e/mu4e.texi
@@ -1416,6 +1416,9 @@ from the built-in fields, you can also create custom fields using
end of a message,it automatically takes you to the next one. If you want
to prevent this behavior, set @code{mu4e-view-scroll-to-next} to
@code{nil}.
+@item Since attachments are also shown in the message-body, you can suppress the @t{Attachments:} headder;
+by customizing @code{gnus-mime-display-attachment-buttons-in-header} or tweak
+the appearance through @code{gnus-mime-button-line-format}
@end itemize
@node MSGV Keybindings