* configurable summary line for notmuch search @ 2021-08-28 15:10 David Bremner 2021-08-28 21:30 ` Jose Antonio Ortega Ruiz 0 siblings, 1 reply; 6+ messages in thread From: David Bremner @ 2021-08-28 15:10 UTC (permalink / raw) To: notmuch I was idly thinking about how to provide custom summary formats for notmuch-search. I know this has been discussed a few times on IRC, but I can't remember the kind of things people were looking for. So if this a feature you're interested in, what specifically are you looking for? d ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: configurable summary line for notmuch search 2021-08-28 15:10 configurable summary line for notmuch search David Bremner @ 2021-08-28 21:30 ` Jose Antonio Ortega Ruiz 2021-08-29 0:46 ` Roger Randall 2021-08-29 14:53 ` David Bremner 0 siblings, 2 replies; 6+ messages in thread From: Jose Antonio Ortega Ruiz @ 2021-08-28 21:30 UTC (permalink / raw) To: David Bremner, notmuch On Sat, Aug 28 2021, David Bremner wrote: > I was idly thinking about how to provide custom summary formats for > notmuch-search. I know this has been discussed a few times on IRC, but I > can't remember the kind of things people were looking for. So if this a > feature you're interested in, what specifically are you looking for? I actually have a patch in my queue that implements a form of this, in two ways. By allowing the "field" to be a function that gets called with the message property and returns a string, and by allowing the format string to be a function that takes the value of the field and further formats it. This is the relevant patch with simple examples in the documentation: https://jao.io/cgit/notmuch/commit/?h=tree-result-format&id=0d7d909aa8bc4fb8e5ab80f93bc397fbed666761 and this is an example of how i use it to have a marker in my result lists that tells me if i'm the recipient of the displayed email and to trunctate the subject to a maximum length: (setq notmuch-tree-result-format '(("date" . "%12s ") ("authors" . "%-35s") (jao-notmuch-msg-ticks) ("subject" . jao-notmuch-truncate) ("tags" . " (%s)"))) (defun jao-notmuch-msg-ticks (msg) (let ((headers (plist-get msg :headers))) (cond ((string-match-p jao-mails-regexp (or (plist-get headers :To) "")) (propertize " »" 'face 'notmuch-tree-match-tree-face)) ((string-match-p jao-mails-regexp (or (plist-get headers :Cc) "")) (propertize " ¬" 'face 'notmuch-tree-match-tree-face)) (t " ")))) (defun jao-notmuch-truncate (x) (truncate-string-to-width (format "%-102s" x) 102 nil nil t)) what do you think? cheers, jao -- I never lose sight of the fact that just being is fun. -Katharine Hepburn, actress (1907-2003) ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: configurable summary line for notmuch search 2021-08-28 21:30 ` Jose Antonio Ortega Ruiz @ 2021-08-29 0:46 ` Roger Randall 2021-09-01 16:25 ` Alexander Adolf 2021-08-29 14:53 ` David Bremner 1 sibling, 1 reply; 6+ messages in thread From: Roger Randall @ 2021-08-29 0:46 UTC (permalink / raw) To: Jose Antonio Ortega Ruiz, David Bremner, notmuch Jose Antonio Ortega Ruiz <jao@gnu.org> writes: > On Sat, Aug 28 2021, David Bremner wrote: > >> I was idly thinking about how to provide custom summary formats for >> notmuch-search. I know this has been discussed a few times on IRC, but I >> can't remember the kind of things people were looking for. So if this a >> feature you're interested in, what specifically are you looking for? > > I actually have a patch in my queue that implements a form of this, in > two ways. By allowing the "field" to be a function that gets called with > the message property and returns a string, and by allowing the format > string to be a function that takes the value of the field and further > formats it. This is the relevant patch with simple examples in the > documentation: > > https://jao.io/cgit/notmuch/commit/?h=tree-result-format&id=0d7d909aa8bc4fb8e5ab80f93bc397fbed666761 > > and this is an example of how i use it to have a marker in my result > lists that tells me if i'm the recipient of the displayed email and to > trunctate the subject to a maximum length: > > (setq notmuch-tree-result-format > '(("date" . "%12s ") > ("authors" . "%-35s") > (jao-notmuch-msg-ticks) > ("subject" . jao-notmuch-truncate) > ("tags" . " (%s)"))) > > (defun jao-notmuch-msg-ticks (msg) > (let ((headers (plist-get msg :headers))) > (cond ((string-match-p jao-mails-regexp (or (plist-get headers :To) "")) > (propertize " »" 'face 'notmuch-tree-match-tree-face)) > ((string-match-p jao-mails-regexp (or (plist-get headers :Cc) "")) > (propertize " ¬" 'face 'notmuch-tree-match-tree-face)) > (t " ")))) > > (defun jao-notmuch-truncate (x) > (truncate-string-to-width (format "%-102s" x) 102 nil nil t)) > > what do you think? > > cheers, > jao > -- > I never lose sight of the fact that just being is fun. > -Katharine Hepburn, actress (1907-2003) > _______________________________________________ > notmuch mailing list -- notmuch@notmuchmail.org > To unsubscribe send an email to notmuch-leave@notmuchmail.org I greatly desire the ability to limit the subject length so (in my case) tags consistently line-up in the same column. Along those lines, I would also like the ability to explicitly set the order in which tags are shown in notmuch-search (as opposed to purely alphabetical). - RER ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: configurable summary line for notmuch search 2021-08-29 0:46 ` Roger Randall @ 2021-09-01 16:25 ` Alexander Adolf 2021-09-01 18:52 ` Jose Antonio Ortega Ruiz 0 siblings, 1 reply; 6+ messages in thread From: Alexander Adolf @ 2021-09-01 16:25 UTC (permalink / raw) To: Roger Randall, Jose Antonio Ortega Ruiz, David Bremner, notmuch Roger Randall <roger@rogerrandall.com> writes: > [...] > Along those lines, I would also like the ability to > explicitly set the order in which tags are shown in notmuch-search (as > opposed to purely alphabetical). > [...] I have to admit having been intrigued by this thought, too. How could this work? I guess one could want specific tags to always be at the start, or the end of the tags string, and perhaps in a specific order. Implementation-wise this could be done with weights, or priorities. Each tag gets a default weight/priority, say zero. I would then like to be able to set up regular expressions to assign different weights/priorities to tags matching these regexps. Tags would then be displayed in ascending weight/priority order (i.e. negative weights/priorities first, then zero, then positive weights/priorities). Within the same weight/priority value, alphabetic ordering would be used. What if a tag matches more than one regexp? Are the weights/priorities added up, or does the minimum weight/priority "win"? For me, this would be interesting for Emacs only, i.e. likely best implemented in elisp. That said, this could - more or less - easily be done with the patch proposed on this thread by jao. <hint>_Provided_ that it will be amended to not only cover notmuch-tree-result-format, but also notmuch-search-result-format.</hint> ;-) Cheers, --alex ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: configurable summary line for notmuch search 2021-09-01 16:25 ` Alexander Adolf @ 2021-09-01 18:52 ` Jose Antonio Ortega Ruiz 0 siblings, 0 replies; 6+ messages in thread From: Jose Antonio Ortega Ruiz @ 2021-09-01 18:52 UTC (permalink / raw) To: Alexander Adolf, Roger Randall, David Bremner, notmuch On Wed, Sep 01 2021, Alexander Adolf wrote: > That said, this could - more or less - easily be done with the patch > proposed on this thread by jao. <hint>_Provided_ that it will be amended > to not only cover notmuch-tree-result-format, but also > notmuch-search-result-format.</hint> ;-) fwiw, that patch already covers both variables. jao ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: configurable summary line for notmuch search 2021-08-28 21:30 ` Jose Antonio Ortega Ruiz 2021-08-29 0:46 ` Roger Randall @ 2021-08-29 14:53 ` David Bremner 1 sibling, 0 replies; 6+ messages in thread From: David Bremner @ 2021-08-29 14:53 UTC (permalink / raw) To: Jose Antonio Ortega Ruiz, notmuch Jose Antonio Ortega Ruiz <jao@gnu.org> writes: > On Sat, Aug 28 2021, David Bremner wrote: > >> I was idly thinking about how to provide custom summary formats for >> notmuch-search. I know this has been discussed a few times on IRC, but I >> can't remember the kind of things people were looking for. So if this a >> feature you're interested in, what specifically are you looking for? > > I actually have a patch in my queue that implements a form of this, in > two ways. By allowing the "field" to be a function that gets called with > the message property and returns a string, and by allowing the format > string to be a function that takes the value of the field and further > formats it. This is the relevant patch with simple examples in the > documentation: [snip] > what do you think? I was thinking of a facility available to command line users of notmuch-search. But if the main use case is in emacs, then it would almost certainly be easier to implement in elisp, assuming the information is available. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-09-01 18:52 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-08-28 15:10 configurable summary line for notmuch search David Bremner 2021-08-28 21:30 ` Jose Antonio Ortega Ruiz 2021-08-29 0:46 ` Roger Randall 2021-09-01 16:25 ` Alexander Adolf 2021-09-01 18:52 ` Jose Antonio Ortega Ruiz 2021-08-29 14:53 ` David Bremner
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).