From db74c2bd004b2dc9bf8086a6d8bf773ac051f3cc Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Wed, 4 Jan 2012 12:35:19 +0100 Subject: [PATCH] Activated default sequence negation (exclamation mark). --- man/mh-profile.man5 | 10 ++++++---- man/mh-sequence.man7 | 24 +++++++++++++++++------- sbr/m_convert.c | 6 ++++-- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/man/mh-profile.man5 b/man/mh-profile.man5 index ae8e7e9..053213a 100644 --- a/man/mh-profile.man5 +++ b/man/mh-profile.man5 @@ -84,13 +84,15 @@ man page for the details about this sequence. (profile, no default) .RE .PP .BR Sequence\-Negation : -not +\&! .RS 5 Defines the string which, when prefixed to a sequence name, negates -that sequence. Hence, \*(lqnotseen\*(rq means all those messages that -are not a member of the sequence \*(lqseen\*(rq. Read the +that sequence. Hence, \*(lq!foo\*(rq means all those messages that +are not a member of the sequence \*(lqfoo\*(rq. +To deactivate this mechanism, define Sequence\-Negation to an empty value. +Read the .BR mh\-sequence (7) -man page for the details. (profile, no default) +man page for the details. (profile, default: !) .RE .PP .BR Unseen\-Sequence : diff --git a/man/mh-sequence.man7 b/man/mh-sequence.man7 index b96230e..98564e0 100644 --- a/man/mh-sequence.man7 +++ b/man/mh-sequence.man7 @@ -150,15 +150,18 @@ the \*(lqMh\-Sequences\*(rq profile entry is defined but empty, then .SS "Sequence Negation" .B Nmh -provides the ability to select all messages not elements of a -user-defined sequence. To do this, the user should define the entry +provides the ability to select all messages +.B not +elements of a user-defined sequence. +A special string is used to preface an existing user-defined +sequence name. This specification then refers to those +messages not elements of the specified sequence name. +The default negation prefix is the exlamation mark `!', +but it may be change to any string, by defining the entry \*(lqSequence\-Negation\*(rq in the .B nmh -profile file; its value -may be any string. This string is then used to preface an existing -user-defined sequence name. This specification then refers to those -messages not elements of the specified sequence name. For example, if -the profile entry is: +profile file. +For example, if the profile entry is: .PP .RS 5 Sequence\-Negation: not @@ -172,6 +175,13 @@ of the sequence \*(lqfoo\*(rq. .PP Obviously, the user should beware of defining sequences with names that begin with the value of the \*(lqSequence\-Negation\*(rq profile entry. +The default value `!' was chosen due to its similar meaning in the C +programming language, and because it cannot be part of a user-defined +sequence. But if your shell provides history expansion, +you might need to quote the exlamation mark (prefix it with a backslash). +.PP +To deactivate the negation mechanism, define Sequence\-Negation in your +profile to an empty value. .SS "The Previous Sequence" .B Nmh diff --git a/sbr/m_convert.c b/sbr/m_convert.c index 05533f6..3065941 100644 --- a/sbr/m_convert.c +++ b/sbr/m_convert.c @@ -335,8 +335,10 @@ attr(struct msgs *mp, char *cp) return 0; /* Check for sequence negation */ - if ((dp = context_find(nsequence)) && *dp != '\0' && - isprefix(dp, cp)) { + if (!(dp = context_find(nsequence))) { + dp = seq_neg; /* use default */ + } + if (dp && *dp && isprefix(dp, cp)) { inverted = 1; cp += strlen(dp); } -- 1.7.10.4