<<< Date Index >>>     <<< Thread Index >>>

Re: [patch] space avoids recording in history



Applied, thanks.

On Tuesday, 04 July 2006 at 18:51, Alain Bench wrote:
> Hello,
> 
>     Sometimes at prompts one wants to avoid recording a given line to
> the history (dangerous operation, unimportant, or such). The attached
> patch implements the trick common to many shells: Any entered line
> beginning with a space will not be recorded. Especially usefull in
> macros, to avoid cluttering history with repeated set/unset $resolve
> pairs and such.
> 
>     This patch is compatible with Vincent's patch-1.5.11.vl.savehist.2
> (save history to file between sessions). It then applies correctly with
> fuzz 2.
> 
> 
> Bye!  Alain.

> diff -prud mutt-1.5.11.cvs.orig/history.c mutt-1.5.11.cvs/history.c
> +++ mutt-1.5.11.cvs/history.c Tue Jul  4 00:16:10 2006
> @@ -81,7 +81,12 @@ void mutt_history_add (history_class_t h
>    {
>      prev = h->last - 1;
>      if (prev < 0) prev = HistSize - 1;
> -    if (!h->hist[prev] || mutt_strcmp (h->hist[prev], s) != 0)
> +
> +    /* don't add to prompt history:
> +     *  - lines beginning by a space
> +     *  - repeated lines
> +     */
> +    if (*s != 32 && (!h->hist[prev] || mutt_strcmp (h->hist[prev], s) != 0))
>      {
>        mutt_str_replace (&h->hist[h->last++], s);
>        if (h->last > HistSize - 1)
> +++ mutt/PATCHES      Tue Nov  6 19:59:42 2001
> @@ -1,0 +1 @@
> +patch-1.5.11.ab.space-avoids-history.1

Attachment: pgpScNDNz3z9W.pgp
Description: PGP signature