0

In mu4e mode you can toggle some properties via the function mu4e-search-toggle-property. More specifically, after calling this function, you can (de-)activate "Full-search", "Include-related", "Show threads", "Skip duplicates" and "Hide-predicate" by typing f, r, t, u and p, respectively.

By default "Show threads" is on. Since I don't want my emails to be shown as threads, I have to enter M-x mu4e-search-toggle-property followed by typing t each time I start up mu4e, which is tedious. (Thanks to key bindings, typing Pt would be enough, but this is still annoying.)

For this reason, I want to change my configuration file to automatically toggle off threading. However, I miserably fail at simulating the t key press. So far, I have tried something like

(defun test ()
   (ineractive)
    (mu4e-search-toggle-property (kbd "t")))

which shows no effect.

How is it possible to simulate pressing t after invoking this function? And why is the code snippet above ineffective?

1
  • Likely a duplicate question. Check the source code for the command, to see what its interactive spec does with the t input - what value it passes to the function body. Then call the function with that value.
    – Drew
    Commented Aug 3 at 19:49

1 Answer 1

1

Following Drew's comment I looked into the source code which shows that M-x mu4e-search-toggle-property t toggles the variable mu4e-search-threads, so adding (setq mu4-search-threads nil) to my configuration file does the trick. (Still wondering though why it isn't possible to somehow simulate pressing t as indicated in my question.)

2
  • 1
    "Still wondering though why it isn't possible to somehow simulate pressing t as indicated in my question." - I may be wrong, but I think it's impossible, because the t is not passed as an argument to the function. It is instead read by mu4e-read-option which is called by mu4e-search-toggle-property in order to set a local variable, choice. I don't see any way to do that from the outside.
    – NickD
    Commented Aug 4 at 21:02
  • Maybe you can push a t back into the input buffer, so the read will get it, but that looks pretty yucky to me. See Miscellaneous Event Input Features but consider it a last resort only. Your answer is the way to go.
    – NickD
    Commented Aug 5 at 0:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.