unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#30466: 25.3; Eshell: Ignore all duplicates when ignoredups is non-nil
@ 2018-02-15 14:25 Pierre Neidhardt
  2018-02-15 17:24 ` Glenn Morris
  0 siblings, 1 reply; 4+ messages in thread
From: Pierre Neidhardt @ 2018-02-15 14:25 UTC (permalink / raw)
  To: 30466


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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#30466: 25.3; Eshell: Ignore all duplicates when ignoredups is non-nil
  2018-02-15 14:25 bug#30466: 25.3; Eshell: Ignore all duplicates when ignoredups is non-nil Pierre Neidhardt
@ 2018-02-15 17:24 ` Glenn Morris
  2021-02-04 10:56   ` Lars Ingebrigtsen
  0 siblings, 1 reply; 4+ messages in thread
From: Glenn Morris @ 2018-02-15 17:24 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: 30466

Pierre Neidhardt wrote:

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

In terms of bash HISTCONTROL, this is the difference between
"ignoredups" and "erasedups".

Ref eg https://www.gnu.org/s/bash/manual/html_node/Bash-Variables.html#index-HISTCONTROL






^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#30466: 25.3; Eshell: Ignore all duplicates when ignoredups is non-nil
  2018-02-15 17:24 ` Glenn Morris
@ 2021-02-04 10:56   ` Lars Ingebrigtsen
  2021-02-04 11:03     ` Pierre Neidhardt
  0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2021-02-04 10:56 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 30466, Pierre Neidhardt

Glenn Morris <rgm@gnu.org> writes:

>> 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.
>
> In terms of bash HISTCONTROL, this is the difference between
> "ignoredups" and "erasedups".
>
> Ref eg
> https://www.gnu.org/s/bash/manual/html_node/Bash-Variables.html#index-HISTCONTROL

Sounds useful to me, so I've now added this to Emacs 28.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#30466: 25.3; Eshell: Ignore all duplicates when ignoredups is non-nil
  2021-02-04 10:56   ` Lars Ingebrigtsen
@ 2021-02-04 11:03     ` Pierre Neidhardt
  0 siblings, 0 replies; 4+ messages in thread
From: Pierre Neidhardt @ 2021-02-04 11:03 UTC (permalink / raw)
  To: Lars Ingebrigtsen, Glenn Morris; +Cc: 30466, Pierre Neidhardt

[-- Attachment #1: Type: text/plain, Size: 60 bytes --]

Thank you!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 511 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-02-04 11:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-15 14:25 bug#30466: 25.3; Eshell: Ignore all duplicates when ignoredups is non-nil Pierre Neidhardt
2018-02-15 17:24 ` Glenn Morris
2021-02-04 10:56   ` Lars Ingebrigtsen
2021-02-04 11:03     ` Pierre Neidhardt

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).