From 137e12bed01bbc24e3172bacf7da8c1988339161 Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 1 Jun 2026 21:20:07 +0100 Subject: notmuch nits --- custom/jao-custom-notmuch.el | 15 ++++++--------- lib/net/jao-notmuch.el | 20 +++++++++++++------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/custom/jao-custom-notmuch.el b/custom/jao-custom-notmuch.el index 90e782d..2e46972 100644 --- a/custom/jao-custom-notmuch.el +++ b/custom/jao-custom-notmuch.el @@ -4,13 +4,11 @@ (defvar jao-notmuch-minibuffer-queries `((:name "" :query "tag:new and not tag:draft" :face jao-themes-f00) - (:name "I" :query "tag:new and tag:jao and tag:inbox" - :face jao-themes-warning) - (:name "W" :query "tag:new and tag:jao and tag:write" - :face jao-themes-warning) + (:name "I" :query "tag:new and tag:inbox" :face jao-themes-warning) + (:name "W" :query "tag:new and tag:write" :face jao-themes-warning) (:name "J" :query - ,(concat "tag:new and tag:jao and not " + ,(concat "tag:new and not " "tag:\"/feeds|local|hacking|draft|inbox|prog|words|write/\"") :face default) (:name "H" :query "tag:new and tag:hacking and not tag:\"/emacs/\"") @@ -203,8 +201,7 @@ ,(jao-notmuch--q "drafts" "D" nil '("tag:draft") t) ,(jao-notmuch--q "sent" "S" nil '("date:1d.." "tag:sent") t) ,(jao-notmuch--q "today" "T" nil - '("tag:jao" "date:24h.." - "not tag:\"/(sent|feeds|spam|local)/\"") + '("date:24h.." "not tag:\"/(sent|feeds|spam|local)/\"") t))) (jao-notmuch--def-searches "trove" @@ -280,7 +277,7 @@ ("flagged" "✓") ("forwarded" "→") ("gmane" "g") - ("jao" "j") + ("jao") ("lists" "l") ("new" "·") ("replied" "↩" (propertize tag 'face '(:family "Fira Code"))) @@ -548,7 +545,7 @@ consult-notmuch-result-format `((jao-notmuch-format-msg-ticks . ,jao-mails-regexp) ("date" . "%12s ") - ("authors" . "%-35s") + (jao-notmuch-format-authors . 99) ("subject" . " %-100s") (jao-notmuch-format-tags . " (%s)")) notmuch-tree-thread-symbols diff --git a/lib/net/jao-notmuch.el b/lib/net/jao-notmuch.el index 404eab7..0f6903a 100644 --- a/lib/net/jao-notmuch.el +++ b/lib/net/jao-notmuch.el @@ -1,6 +1,6 @@ ;; jao-notmuch.el --- Extensions for notmuch -*- lexical-binding: t; -*- -;; Copyright (C) 2021, 2022, 2023, 2024, 2025 jao +;; Copyright (C) 2021, 2022, 2023, 2024, 2025, 2026 jao ;; Author: jao ;; Keywords: mail @@ -378,16 +378,22 @@ (or (> (length a) (length b)) (string-lessp a b))) (defun jao-notmuch-format-tags (fmt msg) - (let ((ts (thread-last (notmuch-tree-format-field "tags" "%s" msg) - (split-string) - ;; (seq-sort-by #'length #'<) - (seq-sort #'jao-notmuch-cmp-tags)))) - (format-spec fmt `((?s . ,(mapconcat #'identity ts " ")))))) + (if (> (window-width) 85) + (let ((ts (thread-last (notmuch-tree-format-field "tags" "%s" msg) + (split-string) + ;; (seq-sort-by #'length #'<) + (seq-sort #'jao-notmuch-cmp-tags)))) + (format-spec fmt `((?s . ,(mapconcat #'identity ts " "))))) + "")) + +(defun jao-notmuch-format-authors (threshold msg) + (let ((fmt (if (< (window-width) threshold) "%-15s" "%-35s"))) + (notmuch-tree-format-field "authors" fmt msg))) (defun jao-notmuch-format-tree-and-subject (_fmt msg) (let ((tr (notmuch-tree-format-field "tree" " %s" msg)) (sb (notmuch-tree-format-field "subject" " %s" msg)) - (fmt (format "%%>-%ds" (- (window-width) 60)))) + (fmt (format "%%>-%ds" (- (window-width) 45)))) (format-spec fmt `((?s . ,(concat tr sb)))))) (defun jao-notmuch-format-msg-ticks (mails-rx msg) -- cgit v1.2.3