Ticket #2142 (closed defect: fixed)

Opened 3 years ago

Last modified 2 months ago

<untag-pattern> with empty argument does nothing

Reported by: vincent@vinc17.org Assigned to: mutt-dev
Priority: trivial Milestone:
Component: mutt Version: 1.5.11
Keywords: Cc:

Description

<untag-pattern> with an empty argument does nothing. I should untag every message (like <untag-pattern>~A), for consistency with Mutt 1.5.9i and with <limit>.
>How-To-Repeat:
1. Tag a few messages.
2. Do <untag-pattern> then [Enter] (^T^M).
>Fix:
Unknown

Change History

2005-11-24 05:29:54 changed by Thomas Roessler <roessler@does-not-exist.org>

On 2005-11-23 16:08:36 +0100, vincent@vinc17.org wrote:

> <untag-pattern> with an empty argument does nothing. I
> should untag every message (like <untag-pattern>~A), for
> consistency with Mutt 1.5.9i and with <limit>.

So, by consistency with delete-pattern, delete-pattern with an
empty argument should delete all messages?

-- 
Thomas Roessler			      <roessler@does-not-exist.org>

2005-11-24 10:32:02 changed by Vincent Lefevre <vincent@vinc17.org>

On 2005-11-24 00:15:01 +0100, TAKAHASHI Tamotsu wrote:
>  * Wed Nov 23 2005 Thomas Roessler <roessler@does-not-exist.org>
>  >  So, by consistency with delete-pattern, delete-pattern with an
>  >  empty argument should delete all messages?

This wouldn't be a problem for me, as this requires confirmation.
A "<limit>." by mistake would be more annoying.

>  No. :)
>  
>  So, <limit> with an empty argument should not show all messages
>  if you mind the inconsistency. I thought the current behavior was
>  intuitive for beginners, and my patch was applied at revision
>  3.15 in pattern.c. See bug#1854.

Bug#1854 says "'l' and then Enter", but this doesn't even work
since the latest pattern is recalled. So, before Enter, either
"." or "<kill-line>" is necessary. And I don't find the current
behavior intuitive. Instead, I'd rather see some help, e.g. the
current value of $simple_search, or more useful, if a help screen
for patterns is designed:

  Type ... to see the help on patterns.

This would be very useful, as pattern formats are difficult to
remember (in particular for those one almost never uses).

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

2005-11-24 18:39:19 changed by Thomas Roessler <roessler@does-not-exist.org>

On 2005-11-24 00:15:01 +0100, TAKAHASHI Tamotsu wrote:

>  So, <limit> with an empty argument should not show all
>  messages if you mind the inconsistency. I thought the
>  current behavior was intuitive for beginners, and my patch
>  was applied at revision 3.15 in pattern.c. See bug#1854.

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.
Plus, it's safe, and it's reasonably easy to get back to a
limit in case someone is indeed confused.

Still, that doesn't keep me from limiting to "~A" all the time.

What I'd be opposed to is to start extending that behavior ("no
pattern" = "~A") to any other pattern-based function.

-- 
Thomas Roessler			      <roessler@does-not-exist.org>

2005-11-24 22:19:41 changed by Vincent Lefevre <vincent@vinc17.org>

On 2005-11-24 09:45:02 +0100, Thomas Roessler 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.

Otherwise, similarly, one should assume that <untag-pattern> with
empty pattern means "no tagged messages" and should untag every
message.

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

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

2005-11-24 22:49:54 changed by Thomas Roessler <roessler@does-not-exist.org>

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@does-not-exist.org>




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

2005-11-25 01:05:24 changed by TAKAHASHI Tamotsu <ttakah@lapis.plala.or.jp>

* Wed Nov 23 2005 Thomas Roessler <roessler@does-not-exist.org>
>  On 2005-11-23 16:08:36 +0100, vincent@vinc17.org wrote:
>  
>  > <untag-pattern> with an empty argument does nothing. I
>  > should untag every message (like <untag-pattern>~A), for
>  > consistency with Mutt 1.5.9i and with <limit>.
>  
>  So, by consistency with delete-pattern, delete-pattern with an
>  empty argument should delete all messages?

No. :)

So, <limit> with an empty argument should not show all messages
if you mind the inconsistency. I thought the current behavior was
intuitive for beginners, and my patch was applied at revision
3.15 in pattern.c. See bug#1854.

...But I don't like inconsistency now.

-- 
tamo

2005-11-25 02:19:01 changed by Vincent Lefevre <vincent@vinc17.org>

On 2005-11-24 13:55:01 +0100, Thomas Roessler wrote:
>  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".

One can also assume that there always is a limit pattern (~A by default)
and that "delete a limit pattern" does not make any sense.

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

The history function won't necessarily be useful here since the
history is shared with the search history (which is fine, BTW).
I often do a limit first, then refine the search with "normal"
searches.

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

Good idea.

>  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\".");

Or:

  To view all messages, limit to "all", "." or "~A".

That way, the user would also learn that "<limit>." is the fastest
way to view all messages.

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

2005-11-25 02:32:09 changed by Thomas Roessler <roessler@does-not-exist.org>

On 2005-11-24 17:25:01 +0100, Vincent Lefevre wrote:

>    To view all messages, limit to "all", "." or "~A".

>  That way, the user would also learn that "<limit>." is the
>  fastest way to view all messages.

And, as well, one of the less memorable...  At least for those
who don't use regexps.

BTW, one shortcut that I tend to use are the following macros:

macro	index	"~"		";~"
macro	pager	"~"	"<exit><limit>~"
macro   pager	";"	"<exit><limit>"

bind	index	";"		limit

-- 
Thomas Roessler			      <roessler@does-not-exist.org>

2005-11-25 07:12:08 changed by TAKAHASHI Tamotsu <ttakah@lapis.plala.or.jp>

* Thu Nov 24 2005 Vincent Lefevre <vincent@vinc17.org>
>  On 2005-11-24 00:15:01 +0100, TAKAHASHI Tamotsu wrote:
>  >  So, <limit> with an empty argument should not show all messages
>  >  if you mind the inconsistency. I thought the current behavior was
>  >  intuitive for beginners, and my patch was applied at revision
>  >  3.15 in pattern.c. See bug#1854.
>  
>  Bug#1854 says "'l' and then Enter", but this doesn't even work
>  since the latest pattern is recalled. So, before Enter, either
>  "." or "<kill-line>" is necessary. And I don't find the current
>  behavior intuitive.

Me, too. Now I am too familiar with mutt's UI to like
the current behaviour.


>  behavior intuitive. Instead, I'd rather see some help, e.g. the
>  current value of $simple_search, or more useful, if a help screen
>  for patterns is designed:
>  
>    Type ... to see the help on patterns.
>  
>  This would be very useful, as pattern formats are difficult to
>  remember (in particular for those one almost never uses).

Bug #2076 has my patch to show you a list of patterns when
you push tab (<complete> function) after "~".

-- 
tamo

2005-12-04 11:23:08 changed by Vincent Lefevre <vincent@vinc17.org>

On 2005-11-24 13:55:01 +0100, Thomas Roessler wrote:
>  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;	  

There's a problem with this: it overwrites the possible message
"No messages matched criteria." from pattern.c. I suggest to
remove this and in pattern.c, replace

    return (-1);

by

  {
    if (op == M_LIMIT && Context->pattern)
      mutt_message _("To view all messages, limit to \"all\".");
    return (-1);
  }

after the "if (mutt_get_field ...)" line.

-- 
Vincent Lefèvre <vincent@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / SPACES project at LORIA

2008-05-29 01:54:38 changed by pdmef

  • status changed from new to closed.
  • resolution set to fixed.

I assume this is now consistent in hg tip as limit, tag-pattern and delete-pattern without a pattern are no-ops. Compare e.g. changeset [a742f3c37f38].