Re: mutt/2142: <untag-pattern> with empty argument does nothing
The following reply was made to PR mutt/2142; it has been noted by GNATS.
From: Thomas Roessler <roessler@xxxxxxxxxxxxxxxxxx>
To: bug-any@xxxxxxxxxxxxx
Cc:
Subject: Re: mutt/2142: <untag-pattern> with empty argument does nothing
Date: Thu, 24 Nov 2005 13:49:54 +0100
On 2005-11-24 13:25:02 +0100, Vincent Lefevre wrote:
>> I can live quite well with the current limit behavior --
>> it is, as you say, possibly easier for beginners, and the
>> notion that "no limit" corresponds to "all messages"
>> makes a lot of sense.
>
> This is not "no limit", but either ignore or "limit to no
> messages" if one assumes that an empty pattern matches
> nothing (as in other functions). So, the fact that Mutt
> shows all the messages is very unintuitive.
I can basically see good arguments for both sides:
- Intuitively, when I delete a limit pattern, shouldn't I also
remove its effect?
- On the other hand, pretty much all prompts in mutt take an
empty input to mean "abort".
> Otherwise, similarly, one should assume that
> <untag-pattern> with empty pattern means "no tagged
> messages" and should untag every message.
I disagree with that -- mostly because I think of tagging and
untagging as a change in message status, while I think of the
limit as a view.
>> Plus, it's safe, and it's reasonably easy to get back to
>> a limit in case someone is indeed confused.
> The previous limit pattern may be very complicated. So,
> it's not necessarily easy to get back to the previous
> limit.
You forgot the history function. ;-)
Whatever. The principle of least surprise speaks strongly in
favor of the old behavior. And maybe a little message in the
status line could help to take care of the original usability
problem?
Patch below.
Regards,
--
Thomas Roessler <roessler@xxxxxxxxxxxxxxxxxx>
diff -u -r3.34 curs_main.c
--- curs_main.c 4 Oct 2005 04:29:09 -0000 3.34
+++ curs_main.c 24 Nov 2005 12:48:46 -0000
@@ -868,6 +868,8 @@
mutt_draw_tree (Context);
menu->redraw = REDRAW_FULL;
}
+ if (Context->pattern)
+ mutt_message _("To view all messages, limit to \"all\".");
break;
case OP_QUIT:
Index: pattern.c
===================================================================
RCS file: /cvs/mutt/mutt/pattern.c,v
retrieving revision 3.26
diff -u -r3.26 pattern.c
--- pattern.c 21 Oct 2005 04:35:37 -0000 3.26
+++ pattern.c 24 Nov 2005 12:48:46 -0000
@@ -1202,15 +1202,8 @@
int i;
strfcpy (buf, NONULL (Context->pattern), sizeof (buf));
- if (mutt_get_field (prompt, buf, sizeof (buf), M_PATTERN | M_CLEAR) != 0)
+ if (mutt_get_field (prompt, buf, sizeof (buf), M_PATTERN | M_CLEAR) != 0 ||
!buf[0])
return (-1);
- if (!buf[0])
- {
- if (op == M_LIMIT)
- strfcpy (buf, "~A", sizeof(buf));
- else
- return -1;
- }
mutt_message _("Compiling search pattern...");