djcb / mu

maildir indexer/searcher + emacs mail client + guile bindings
http://www.djcbsoftware.nl/code/mu
GNU General Public License v3.0
1.61k stars 389 forks source link

[mu4e bug] lisp expressions as bookmark don't seem to work as described in the manual #2711

Closed Gallipo closed 3 months ago

Gallipo commented 4 months ago

Describe the bug There are 2 examples about how to use lisp-exp or lambdas as mu4e-bookmarks in the manual (https://www.djcbsoftware.nl/code/mu/mu4e/Bookmarks.html#DOCF13), but they don't work as expected:

How to Reproduce Copy this code from the manual (https://www.djcbsoftware.nl/code/mu/mu4e/Bookmarks.html#DOCF13) into .emacs. (change the ":key" to something not in use by default.)

(add-to-list 'mu4e-bookmarks
 '( :name  "Inbox messages in the last 7 days"
     :query (lambda () (concat "maildir:/inbox AND date:"some
            (format-time-string "%Y%m%d"
                (subtract-time (current-time) (days-to-time 7)))))
     :key   ?k) t)

This gives the expected bookmark in mu4e's start-screen, but with 0 search results.

When I try the same with this code, mu4e doesn't even start:

(defun my/mu4e-bookmark-num-days-old-query (days-old)
  (interactive (list (read-number "Show days old messages: " 7)))
  (let ((start-date (subtract-time (current-time) (days-to-time days-old))))
    (concat "maildir:/inbox AND date:"
            (format-time-string "%Y%m%d" start-date))))

(add-to-list 'mu4e-bookmarks
  `(:name  "Inbox messages in the last 7 days"
    :query ,(lambda () (call-interactively 'my/mu4e-bookmark-num-days-old-query))
    :key  ?o) t)

I did emacs -q and used only a context to make sense of my maildir. The Problem is always there.

Environment Mu4e 1.12.4 GNU Emacs 29.3 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.41, cairo version 1.18.0) of 2024-05-15, modified by Debian OS: Debian 13 (Testing, "Trixie)

djcb commented 4 months ago

Problem is whit the manual... there should be .. after the date, so format-time-string "%Y%m%d..". Then both examples work (for me at least).

Anyway, I'll fix/update the manual, thanks!

djcb commented 3 months ago

I've uploaded the new version of the docs; closing this. Thanks!