Re: notmuch-mutt: Use of uninitialized value.

Subject: Re: notmuch-mutt: Use of uninitialized value.

Date: Thu, 14 Feb 2013 15:06:51 -0800

To: notmuch@notmuchmail.org

Cc: Stefano Zacchiroli

From: Kevin J. McCarthy


Stefano Zacchiroli wrote:
> Right, but still a more graceful failure model would be nice.
> 
> Please find attached a patch that in such cases should 1) give a
> supposedly nice error message explaining what's going on and 2) empty
> the results dir to avoid showing you unrelated results. It works for me.
> But extra checking never hurts, in particular for the tag action, which
> I don't personally use.

The patch works for me (for thread reconstruction - I don't use the
tagging features either).

> I guess it would also be nice to actually disable $pipe_decode in the
> relevant Mutt macros, but I'm not sure about to do that without
> interfering with user desired configuration. Kevin: do you know if there
> is a common Mutt trick to store the value of a variable before changing
> it, and restoring it a posteriori?  More isolation for this kind of
> things in Mutt would definitely be welcome...

It looks like this is possible, as Suvayu Ali mentioned too.  An
improvement to his example is also mentioned in the manual at
  http://www.mutt.org/doc/devel/manual.html#set-myvar
You can defer evaluation of the variables until runtime by prefixing
them with \$.

Here are some proposed improved macros.  (I'll attach a patch file in
another email.)  Despite my earlier warning about not line-breaking
macros, these are getting a bit unreadable.  We may want to see
if/where we can safely line-break them.

macro index <F8> \
      "<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter><shell-escape>notmuch-mutt -r --prompt search<enter><change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter><enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
      "notmuch: search mail"
macro index <F9> \
      "<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter><pipe-message>notmuch-mutt -r thread<enter><change-folder-readonly>`echo ${XDG_CACHE_HOME:-$HOME/.cache}/notmuch/mutt/results`<enter><enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
      "notmuch: reconstruct thread"
macro index <F6> \
      "<enter-command>set my_old_pipe_decode=\$pipe_decode my_old_wait_key=\$wait_key nopipe_decode nowait_key<enter><pipe-message>notmuch-mutt tag -- -inbox<enter><enter-command>set pipe_decode=\$my_old_pipe_decode wait_key=\$my_old_wait_key<enter>" \
      "notmuch: remove message from inbox"

-Kevin

signature.asc (application/pgp-signature)

Thread: