bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#30466: 25.3; Eshell: Ignore all duplicates when ignoredups is non-ni


From: Pierre Neidhardt
Subject: bug#30466: 25.3; Eshell: Ignore all duplicates when ignoredups is non-nil
Date: Thu, 15 Feb 2018 15:25:14 +0100
User-agent: mu4e 1.0; emacs 25.3.1

At the moment, when `eshell-hist-ignoredups' is non-nil, the command
won't be appended to the history if it's the same as the last entry.

This does not prevent Eshell from cluttering the history with the same
commands as long as they are not consecutive (e.g. A, B, A, B...).

I find more useful to always remove the duplicate entry back to the
first position.  It makes the history much lighter and much easier to
browse/filter.
This is especially useful when using a completion
framework such as Helm, Ivy.

I could not find a way to customize this myself without modifying
Eshell's code.  Here it goes:

        (defun eshell-add-input-to-history (input)
          "Add the string INPUT to the history ring.
        Input is entered into the input history ring, if the value of
        variable `eshell-input-filter' returns non-nil when called on the
        input."
          (when (funcall eshell-input-filter input)
            (when eshell-hist-ignoredups
              (ring-remove eshell-history-ring
                           (ring-member eshell-history-ring input)))
            (eshell-put-history input))
          (setq eshell-save-history-index eshell-history-index)
          (setq eshell-history-index nil))

We could also keep the current behaviour and add a separate option to
implement the behaviour I mentioned.




In GNU Emacs 25.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.22.26)
 of 2017-12-16 built on build
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description:     Void Linux

Configured using:
 'configure --with-x-toolkit=gtk3 --with-xwidgets --prefix=/usr
 --sysconfdir=/etc --sbindir=/usr/bin --bindir=/usr/bin
 --mandir=/usr/share/man --infodir=/usr/share/info --localstatedir=/var
 --with-file-notification=inotify --with-modules --with-jpeg --with-tiff
 --with-gif --with-png --with-xpm --with-rsvg --without-imagemagick
 --with-xml2 --with-gnutls --with-sound --with-m17n-flt
 --host=x86_64-unknown-linux-gnu --build=x86_64-unknown-linux-gnu
 'CFLAGS=-fno-PIE -mtune=generic -O2 -pipe -g' 'CPPFLAGS= '
 'LDFLAGS=-no-pie -Wl,--as-needed ''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND DBUS GSETTINGS NOTIFY ACL GNUTLS
LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11
MODULES XWIDGETS

Important settings:
  value of $LC_COLLATE: C
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix





reply via email to

[Prev in Thread] Current Thread [Next in Thread]