Open titaniumbones opened 2 years ago
I have a sort of partial solution, which is to parse the query before sending it to the mu find
shell process. I just wrap the query
let-binding in the function below. I use the built-in mu4e-bookmarks
variable and the abbreviation bm:
to identify a bookmark, though the user will need to customize the variable and add a new :nickname
property to each bookmark. So far I like it; it makes it quite easy, for instance, to add AND flag:unread
to an existing bookmark. Needs to be cleaned up a bit, and my own code right now is a bit of a jumble, but if you're interested I could provide a patch. So far I believe it does work.
(defun mu4e-dashboard-expand-bm (q)
(let* ((bookmark-re "bm:\\(\\w+\\)")
(match (string-match bookmark-re q))
(nickname (match-string 1 q))
(bms mu4e-bookmarks )
(bookmark (if nickname (--first (equal (plist-get it :nick) nickname) bms )))
(expansion (if bookmark (plist-get bookmark :query) )) )
(if expansion
(replace-regexp-in-string bookmark-re expansion q)
q)))
Many thanks for the code. There was also a discussion on the mu mailing list and Matt Price propose some code. Is your code more or less equivalent ?
Have just started using the dashboard today and it's fantastic. The only thing I don't love about it is the code duplication that is required in creating links. So for instance, I generally use bookmarks rather than mailboxes, so my standard view will look like this:
to make keyboard shortcuts and show counts, etc, I have to maintain 3 or 4 copies of this search. can you see a good way to write the query just once instead? perhaps an alist of queries matched to names?
thanks again