unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* notmuch-mutt: Use of uninitialized value.
@ 2013-02-12  0:58 Profpatsch
  2013-02-12 16:27 ` Stefano Zacchiroli
  2013-02-13 22:35 ` Kevin J. McCarthy
  0 siblings, 2 replies; 15+ messages in thread
From: Profpatsch @ 2013-02-12  0:58 UTC (permalink / raw)
  To: notmuch

Since I don’t get your bug tracking system (d’oh ;), here is a bug I
encountered with notmuch-mutt using this macro I guess was from the
“official” tutorial:

# Construct a thread ouf of the marked mail (or something like that,
# doesn’t work atm (errors out))
    macro index <F9> \
        "<enter-command>unset wait_key<enter><pipe-message> \
	/usr/bin/notmuch-mutt thread<enter><change-folder-readonly> \
	~/.cache/notmuch/mutt/results/<enter> \
	<enter-command>set wait_key<enter>" \
	                "search and reconstruct owning thread (using
			notmuch)"

I hope this still works, best to put it on one line I guess.

Error message:
Use of uninitialized value in pattern match (m//) at
/usr/bin/notmuch-mutt line 124, <STDIN> line 28.
Use of uninitialized value $mid in concatenation (.) or string at
/usr/bin/notmuch-mutt line 145, <STDIN> line 28.

~Profpatsch

-- 
Proudly written in Mutt with Vim on Archlinux.
Q: Why is this email five sentences or less?
A: http://five.sentenc.es

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: notmuch-mutt: Use of uninitialized value.
  2013-02-12  0:58 notmuch-mutt: Use of uninitialized value Profpatsch
@ 2013-02-12 16:27 ` Stefano Zacchiroli
       [not found]   ` <20130212165531.GA5030@soarin.rz.uni-augsburg.de>
  2013-02-13 22:35 ` Kevin J. McCarthy
  1 sibling, 1 reply; 15+ messages in thread
From: Stefano Zacchiroli @ 2013-02-12 16:27 UTC (permalink / raw)
  To: notmuch; +Cc: mail

[ many thanks to David Bremner for the forward ]

On Tue, 12 Feb 2013 01:58:01 +0100, Profpatsch wrote:
> # Construct a thread ouf of the marked mail (or something like that,
> # doesn’t work atm (errors out))
<snip>
> I hope this still works, best to put it on one line I guess.
> 
> Error message:
> Use of uninitialized value in pattern match (m//) at
> /usr/bin/notmuch-mutt line 124, <STDIN> line 28.
> Use of uninitialized value $mid in concatenation (.) or string at
> /usr/bin/notmuch-mutt line 145, <STDIN> line 28.

Heya, thanks for your report.  The only reasonable explanation I can
think of is that you hit <F9> while being on a mail that does not
contain a Message-Id header, which is uncommon.

Do you still have the mail in question? Can you verify if it is the case
or not?

If that's the case, I'd agree that the error message could be better,
but without a message-id there won't be much that can be done to rebuild
a thread in any reliable way. (One possibility might be falling back to
subject-based thread reconstruction, but I'd rather not do that.)

Cheers.
-- 
Stefano Zacchiroli  . . . . . . .  zack@upsilon.cc . . . . o . . . o . o
Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o
Debian Project Leader . . . . . . @zack on identi.ca . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: notmuch-mutt: Use of uninitialized value.
       [not found]   ` <20130212165531.GA5030@soarin.rz.uni-augsburg.de>
@ 2013-02-12 20:29     ` Stefano Zacchiroli
       [not found]       ` <20130212215105.GA16646@soarin>
  0 siblings, 1 reply; 15+ messages in thread
From: Stefano Zacchiroli @ 2013-02-12 20:29 UTC (permalink / raw)
  To: Profpatsch; +Cc: notmuch

On Tue, Feb 12, 2013 at 05:55:31PM +0100, Profpatsch wrote:
> > Do you still have the mail in question? Can you verify if it is the
> > case or not?
> 
> That’s my problem: It works with no mail.
> I initialized notmuch and this one works:

I'm sorry, but I still don't get it. What do you mean with "no mail"?
I've tried using <F9> on an empty Maildir (i.e. one without any mail in
it), but there <F9> doesn't work in the right sense, i.e. mutt complains
with "There are no messages" and doesn't even try to run notmuch-mutt.
So no bug there.

If it does anything different for you, can you please compare the macros
you're using with the one you can find at:

  http://git.notmuchmail.org/git/notmuch/blob/HEAD:/contrib/notmuch-mutt/notmuch-mutt.rc

Many thanks in advance for your feedback,
Cheers.
-- 
Stefano Zacchiroli  . . . . . . .  zack@upsilon.cc . . . . o . . . o . o
Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o
Debian Project Leader . . . . . . @zack on identi.ca . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: notmuch-mutt: Use of uninitialized value.
       [not found]       ` <20130212215105.GA16646@soarin>
@ 2013-02-13 16:26         ` Stefano Zacchiroli
  2013-02-13 18:08           ` Profpatsch
  0 siblings, 1 reply; 15+ messages in thread
From: Stefano Zacchiroli @ 2013-02-13 16:26 UTC (permalink / raw)
  To: Profpatsch; +Cc: notmuch

[ please keep the notmuch@ list in Cc:, so that others could help and/or
  benefit from the solution ... when we find one :-) ]

On Tue, Feb 12, 2013 at 10:51:05PM +0100, Profpatsch wrote:
> > I'm sorry, but I still don't get it. What do you mean with "no mail"?
> 
> Haha, sorry, that was misleading. I meant: It doesn’t work with any
> mail, even if it’s indexed by notmuch.

OK, I understand the problem now. Although I don't understand how it's
possible. Can you please do the following test:

- go on a mail, try <F9> on it to ensure it exhibit the bad behavior
  you've reported

- find out the Message-Id of that mail, e.g. "20130213095752.GA20009@foobar"
  ('h' will show all the headers of the mail in Mutt, in case you're not
  seeing the Message-Id header by default)

- on a shell prompt, try:

    notmuch search --output=threads id:20130213095752.GA20009@foobar

  with the appropriate message id for your case, preceded by "id:"

- it should give you something like

  thread:0000000000018bce

> Am I getting this right: I go to a mail in the index and when I hit F9
> it should show me the whole thread of that message? So I can get the
> whole picture, even if it already archived some of the older messages?

That's correct (as long as the archived messages are still part of
notmuch index), and it's working for quite a lot of people, hence I'm
eager to find out what's not working in your setup.

Cheers.
-- 
Stefano Zacchiroli  . . . . . . .  zack@upsilon.cc . . . . o . . . o . o
Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o
Debian Project Leader . . . . . . @zack on identi.ca . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: notmuch-mutt: Use of uninitialized value.
  2013-02-13 16:26         ` Stefano Zacchiroli
@ 2013-02-13 18:08           ` Profpatsch
  0 siblings, 0 replies; 15+ messages in thread
From: Profpatsch @ 2013-02-13 18:08 UTC (permalink / raw)
  To: notmuch, zack

[-- Attachment #1: Type: text/plain, Size: 1536 bytes --]

On 13-02-13 05:26pm, Stefano Zacchiroli wrote:
> OK, I understand the problem now. Although I don't understand how it's
> possible. Can you please do the following test:
> 
> - go on a mail, try <F9> on it to ensure it exhibit the bad behavior
>   you've reported

It does.

> - find out the Message-Id of that mail, e.g.
> "20130213095752.GA20009@foobar"
> - on a shell prompt, try:
>     notmuch search --output=threads id:20130213095752.GA20009@foobar
> - it should give you something like
>   thread:0000000000018bce

% notmuch search --output=threads
id:8e85854f-8b30-4821-bf3e-4c19e576bf67@googlegroups.com
thread:0000000000000566

% notmuch search thread:0000000000000566
thread:0000000000000566  Today 04:59 [39/39] […]

So it’s not notmuch.

Bear in mind that I use Arch, so this is the version on my system atm:
https://www.archlinux.org/packages/community/x86_64/notmuch-mutt/

This is the bad guy:
sub get_message_id() {
    my $mail = Mail::Internet->new(\*STDIN);
    $mail->head->get("message-id") =~ /^<(.*)>$/;# get message-id #l.124
    return $1;
}

I’m not much of a perl coder (not at all to be exact), but
    Use of uninitialized value in pattern match (m//) at
    /usr/bin/notmuch-mutt line 124, <STDIN> line 66.
sounds suspiciously like nothing gets read out of STDIN and $mail is
definitely not a Mail::Internet object.

~Profpatsch

-- 
Proudly written in Mutt with Vim on Archlinux.
Q: Why is this email five sentences or less?
A: http://five.sentenc.es

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: notmuch-mutt: Use of uninitialized value.
  2013-02-12  0:58 notmuch-mutt: Use of uninitialized value Profpatsch
  2013-02-12 16:27 ` Stefano Zacchiroli
@ 2013-02-13 22:35 ` Kevin J. McCarthy
  2013-02-13 23:36   ` Profpatsch
  1 sibling, 1 reply; 15+ messages in thread
From: Kevin J. McCarthy @ 2013-02-13 22:35 UTC (permalink / raw)
  To: notmuch; +Cc: Stefano Zacchiroli, Profpatsch

[-- Attachment #1: Type: text/plain, Size: 1425 bytes --]

Profpatsch wrote:
> Since I don’t get your bug tracking system (d’oh ;), here is a bug I
> encountered with notmuch-mutt using this macro I guess was from the
> “official” tutorial:
> 
> # Construct a thread ouf of the marked mail (or something like that,
> # doesn’t work atm (errors out))
>     macro index <F9> \
>         "<enter-command>unset wait_key<enter><pipe-message> \
> 	/usr/bin/notmuch-mutt thread<enter><change-folder-readonly> \
> 	~/.cache/notmuch/mutt/results/<enter> \
> 	<enter-command>set wait_key<enter>" \
> 	                "search and reconstruct owning thread (using
> 			notmuch)"
> 
> I hope this still works, best to put it on one line I guess.

Mutt macros can behave strangely if you try to break them into multiple
lines.  So my first suggestion is to try setting your macro to exactly
how it's shown in the tutorial and see if that fixes the problem.  (I
admit that this is not likely your problem though, as notmuch-mutt is
running...)

A more likely idea is to check whether you have $pipe_decode set.
If you have this set, you need to make sure you are not weeding out
message-id with 'ignore'.

In fact, I've just tried this, and I can replicate the problem and exact
error messages with these settings:

  set pipe_decode
  ignore *
  unignore From Date To Cc Bcc Subject

Adding this will fix the problem:
  unignore Message-ID

-Kevin


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: notmuch-mutt: Use of uninitialized value.
  2013-02-13 22:35 ` Kevin J. McCarthy
@ 2013-02-13 23:36   ` Profpatsch
  2013-02-14  8:17     ` Andrei POPESCU
  2013-02-14  8:37     ` Stefano Zacchiroli
  0 siblings, 2 replies; 15+ messages in thread
From: Profpatsch @ 2013-02-13 23:36 UTC (permalink / raw)
  To: notmuch, Stefano Zacchiroli

On 13-02-13 02:35pm, Kevin J. McCarthy wrote:
> A more likely idea is to check whether you have $pipe_decode set.
> If you have this set, you need to make sure you are not weeding out
> message-id with 'ignore'.
> 
> In fact, I've just tried this, and I can replicate the problem and exact
> error messages with these settings:
> 
>   set pipe_decode
>   ignore *
>   unignore From Date To Cc Bcc Subject
> 
> Adding this will fix the problem:
>   unignore Message-ID

BRILLIANT!
So much for copying a basic rc from someone else.
Of course, that was it and I’m officially an idiot.

And apparently Mail::Internet errors out if there is no Message-ID.
(Which mentioned in the docs at CPAN…)

Mystery solved.

~Profpatsch

-- 
Proudly written in Mutt with Vim on Archlinux.
Q: Why is this email five sentences or less?
A: http://five.sentenc.es

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: notmuch-mutt: Use of uninitialized value.
  2013-02-13 23:36   ` Profpatsch
@ 2013-02-14  8:17     ` Andrei POPESCU
  2013-02-14  8:37     ` Stefano Zacchiroli
  1 sibling, 0 replies; 15+ messages in thread
From: Andrei POPESCU @ 2013-02-14  8:17 UTC (permalink / raw)
  To: notmuch

[-- Attachment #1: Type: text/plain, Size: 333 bytes --]

On Jo, 14 feb 13, 00:36:58, Profpatsch wrote:
> 
> So much for copying a basic rc from someone else.

There's no problem with that, as long as you take the time to read and 
understand what each option does.

Kind regards,
Andrei
-- 
If you can't explain it simply, you don't understand it well enough.
(Albert Einstein)

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: notmuch-mutt: Use of uninitialized value.
  2013-02-13 23:36   ` Profpatsch
  2013-02-14  8:17     ` Andrei POPESCU
@ 2013-02-14  8:37     ` Stefano Zacchiroli
  2013-02-14  9:13       ` Suvayu Ali
                         ` (2 more replies)
  1 sibling, 3 replies; 15+ messages in thread
From: Stefano Zacchiroli @ 2013-02-14  8:37 UTC (permalink / raw)
  To: Profpatsch; +Cc: David Bremner, notmuch

[-- Attachment #1: Type: text/plain, Size: 1632 bytes --]

On Thu, Feb 14, 2013 at 12:36:58AM +0100, Profpatsch wrote:
> On 13-02-13 02:35pm, Kevin J. McCarthy wrote:
> > A more likely idea is to check whether you have $pipe_decode set.
> 
> BRILLIANT!
> So much for copying a basic rc from someone else.
> Of course, that was it and I’m officially an idiot.

Neat, thanks Kevin for debugging the issue down to $pipe_decode (which
I've never used, mutt never stops to amaze me :-)).

> And apparently Mail::Internet errors out if there is no Message-ID.
> (Which mentioned in the docs at CPAN…)
> 
> Mystery solved.

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.

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...

Cheers.
-- 
Stefano Zacchiroli  . . . . . . .  zack@upsilon.cc . . . . o . . . o . o
Maître de conférences . . . . . http://upsilon.cc/zack . . . o . . . o o
Debian Project Leader . . . . . . @zack on identi.ca . . o o o . . . o .
« the first rule of tautology club is the first rule of tautology club »

[-- Attachment #2: 0001-notmuch-mutt-more-graceful-handling-of-missing-Messa.patch --]
[-- Type: text/x-diff, Size: 1616 bytes --]

From b67ab95855ce7d279d8c0b3ddcbc20e679afc70b Mon Sep 17 00:00:00 2001
From: Stefano Zacchiroli <zack@upsilon.cc>
Date: Thu, 14 Feb 2013 09:31:37 +0100
Subject: [PATCH] notmuch-mutt: more graceful handling of missing Message-Id
 errors

in particular:
- the "thread" action would print an error and empty results dir
- the "tag action would print an error
---
 contrib/notmuch-mutt/notmuch-mutt |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/contrib/notmuch-mutt/notmuch-mutt b/contrib/notmuch-mutt/notmuch-mutt
index d14709d..bc97908 100755
--- a/contrib/notmuch-mutt/notmuch-mutt
+++ b/contrib/notmuch-mutt/notmuch-mutt
@@ -121,7 +121,8 @@ sub prompt($$) {
 
 sub get_message_id() {
     my $mail = Mail::Internet->new(\*STDIN);
-    $mail->head->get("message-id") =~ /^<(.*)>$/;	# get message-id
+    my $mid = $mail->head->get("message-id") or return undef;
+    $mid =~ /^<(.*)>$/;	# get message-id value
     return $1;
 }
 
@@ -142,6 +143,10 @@ sub thread_action($$@) {
     my ($results_dir, $remove_dups, @params) = @_;
 
     my $mid = get_message_id();
+    if (! defined $mid) {
+	empty_maildir($results_dir);
+	die "notmuch-mutt: cannot find Message-Id, abort.\n";
+    }
     my $search_cmd = 'notmuch search --output=threads ' . shell_quote("id:$mid");
     my $tid = `$search_cmd`;	# get thread id
     chomp($tid);
@@ -151,6 +156,7 @@ sub thread_action($$@) {
 
 sub tag_action(@) {
     my $mid = get_message_id();
+    defined $mid or die "notmuch-mutt: cannot find Message-Id, abort.\n";
 
     system("notmuch tag "
 	   . shell_quote(join(' ', @_))
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: notmuch-mutt: Use of uninitialized value.
  2013-02-14  8:37     ` Stefano Zacchiroli
@ 2013-02-14  9:13       ` Suvayu Ali
  2013-02-14 14:13       ` Profpatsch
  2013-02-14 23:06       ` notmuch-mutt: Use of uninitialized value Kevin J. McCarthy
  2 siblings, 0 replies; 15+ messages in thread
From: Suvayu Ali @ 2013-02-14  9:13 UTC (permalink / raw)
  To: notmuch

On Thu, Feb 14, 2013 at 09:37:13AM +0100, Stefano Zacchiroli wrote:
> 
> 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...

This should work:

"<enter-command>set my_var=$var<enter><enter-command>unset var<enter>\
<do-your-stuff>\
<enter-command>set var=$my_var<enter>"

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: notmuch-mutt: Use of uninitialized value.
  2013-02-14  8:37     ` Stefano Zacchiroli
  2013-02-14  9:13       ` Suvayu Ali
@ 2013-02-14 14:13       ` Profpatsch
  2013-02-14 19:53         ` [OT] mutt configuration & philosophy (was Re: notmuch-mutt: Use of uninitialized value.) Michael Elkins
  2013-02-14 23:06       ` notmuch-mutt: Use of uninitialized value Kevin J. McCarthy
  2 siblings, 1 reply; 15+ messages in thread
From: Profpatsch @ 2013-02-14 14:13 UTC (permalink / raw)
  To: Stefano Zacchiroli; +Cc: David Bremner, notmuch

[-- Attachment #1: Type: text/plain, Size: 1200 bytes --]

On 13-02-14 09:37am, Stefano Zacchiroli wrote:
> More isolation for this kind of
> things in Mutt would definitely be welcome...

Maybe it’s time for an overhaul of the mutt configuration from the
ground up. I know, it’s “configure once and be done with it”, but it
took me two hard weeks to get that program up and running the way I want
(that’s even more time than I used on my 300+ line vimrc!).

I suppose it’s a documentation issue, too. One relies on blog entries
way too much, even to find out how to use multiple accounts (I’ve got
around 10).

Plus it still takes about 10 steps to configure a new account with
offlineimap, mutt and msmtp, there is nothing to automate this and
every config is different. Whoa.

For example:
Why does one have to spend two–four hours enabling pgp with the basic,
pre-configured commands?
Why is there no command that enables pgp with default sane gnupg values
that I assume 99.9% of mutt users use?
Why is the standard mailbox named “spooldir” and an easy explanation of
that is nowhere to be found in the official docs?
And the list goes on.

~Profpatsch

-- 
Proudly written in Mutt with Vim on Archlinux.

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [OT] mutt configuration & philosophy (was Re: notmuch-mutt: Use of uninitialized value.)
  2013-02-14 14:13       ` Profpatsch
@ 2013-02-14 19:53         ` Michael Elkins
  2013-02-14 22:59           ` David Bremner
  0 siblings, 1 reply; 15+ messages in thread
From: Michael Elkins @ 2013-02-14 19:53 UTC (permalink / raw)
  To: notmuch

On Thu, Feb 14, 2013 at 03:13:22PM +0100, Profpatsch wrote:
>Plus it still takes about 10 steps to configure a new account with
>offlineimap, mutt and msmtp, there is nothing to automate this and
>every config is different. Whoa.

Mutt was designed with the UNIX philosophy in mind.  When users 
don't like the way something is implemented in Mutt, you can use 
an external tool to do the job instead.  We consider this to be a 
feature, not a deficiency.

>For example:
>Why does one have to spend two–four hours enabling pgp with the basic,
>pre-configured commands?
>Why is there no command that enables pgp with default sane gnupg values
>that I assume 99.9% of mutt users use?

set crypt_use_gpgme

>Why is the standard mailbox named “spooldir” and an easy explanation of
>that is nowhere to be found in the official docs?

We assume users are familiar with basic UNIX concepts like the 
mail spool.

>And the list goes on.

Documentation patches are highly welcome.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [OT] mutt configuration & philosophy (was Re: notmuch-mutt: Use of uninitialized value.)
  2013-02-14 19:53         ` [OT] mutt configuration & philosophy (was Re: notmuch-mutt: Use of uninitialized value.) Michael Elkins
@ 2013-02-14 22:59           ` David Bremner
  0 siblings, 0 replies; 15+ messages in thread
From: David Bremner @ 2013-02-14 22:59 UTC (permalink / raw)
  To: Michael Elkins, notmuch

Michael Elkins <me@sigpipe.org> writes:

> On Thu, Feb 14, 2013 at 03:13:22PM +0100, Profpatsch wrote:
>>Plus it still takes about 10 steps to configure a new account with
>>offlineimap, mutt and msmtp, there is nothing to automate this and
>>every config is different. Whoa.
>
> Mutt was designed with the UNIX philosophy in mind.  When users 
> don't like the way something is implemented in Mutt, you can use 
> an external tool to do the job instead.  We consider this to be a 
> feature, not a deficiency.

Hi Guys;

I know that once a thread starts on a mailing list, it is harder to kill
than a legion of zombies, but at this point the discussion has not much to
do with notmuch.

d

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: notmuch-mutt: Use of uninitialized value.
  2013-02-14  8:37     ` Stefano Zacchiroli
  2013-02-14  9:13       ` Suvayu Ali
  2013-02-14 14:13       ` Profpatsch
@ 2013-02-14 23:06       ` Kevin J. McCarthy
  2013-02-15  2:45         ` Suvayu Ali
  2 siblings, 1 reply; 15+ messages in thread
From: Kevin J. McCarthy @ 2013-02-14 23:06 UTC (permalink / raw)
  To: notmuch; +Cc: Stefano Zacchiroli

[-- Attachment #1: Type: text/plain, Size: 2573 bytes --]

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


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: notmuch-mutt: Use of uninitialized value.
  2013-02-14 23:06       ` notmuch-mutt: Use of uninitialized value Kevin J. McCarthy
@ 2013-02-15  2:45         ` Suvayu Ali
  0 siblings, 0 replies; 15+ messages in thread
From: Suvayu Ali @ 2013-02-15  2:45 UTC (permalink / raw)
  To: notmuch; +Cc: Stefano Zacchiroli

Hi Kevin and others,

On Thu, Feb 14, 2013 at 03:06:51PM -0800, Kevin J. McCarthy wrote:
> 
> 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.

I find sticking by the rule "do not introduce whitespaces to make it
readable" very useful in multi-line macros.  For example,

macro index <key> "<some-long-function>some text<another-function>\
continuation<finally-the-end>"

the above is preferable over,

macro index <key> "<some-long-function>some text<another-function> \
                   continuation<finally-the-end>"

Hope this helps,

-- 
Suvayu

Open source is the future. It sets us free.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-02-15  2:45 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-12  0:58 notmuch-mutt: Use of uninitialized value Profpatsch
2013-02-12 16:27 ` Stefano Zacchiroli
     [not found]   ` <20130212165531.GA5030@soarin.rz.uni-augsburg.de>
2013-02-12 20:29     ` Stefano Zacchiroli
     [not found]       ` <20130212215105.GA16646@soarin>
2013-02-13 16:26         ` Stefano Zacchiroli
2013-02-13 18:08           ` Profpatsch
2013-02-13 22:35 ` Kevin J. McCarthy
2013-02-13 23:36   ` Profpatsch
2013-02-14  8:17     ` Andrei POPESCU
2013-02-14  8:37     ` Stefano Zacchiroli
2013-02-14  9:13       ` Suvayu Ali
2013-02-14 14:13       ` Profpatsch
2013-02-14 19:53         ` [OT] mutt configuration & philosophy (was Re: notmuch-mutt: Use of uninitialized value.) Michael Elkins
2013-02-14 22:59           ` David Bremner
2013-02-14 23:06       ` notmuch-mutt: Use of uninitialized value Kevin J. McCarthy
2013-02-15  2:45         ` Suvayu Ali

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).