GNU bug report logs - #29157
25.3; Eshell parsing fails sometimes, e.g. "date" and "sed"

Previous Next

Package: emacs;

Reported by: Pierre Neidhardt <ambrevar <at> gmail.com>

Date: Sun, 5 Nov 2017 11:38:02 UTC

Severity: normal

Found in version 25.3

Fixed in version 27.1

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Noam Postavsky <npostavs <at> users.sourceforge.net>
To: Pierre Neidhardt <ambrevar <at> gmail.com>
Cc: 29157 <at> debbugs.gnu.org
Subject: bug#29157: 25.3; Eshell parsing fails sometimes, e.g. "date" and "sed"
Date: Wed, 22 Nov 2017 22:13:24 -0500
[Message part 1 (text/plain, inline)]
Pierre Neidhardt <ambrevar <at> gmail.com> writes:

> Anyways, that might ring an alarm here: maybe eshell/date should not
> exist.  What's the point of having it?  I'm not sure.  It is obviously
> less powerful than the system `date'.

Eshell has lots of commands like that.  I guess it makes it more portable?

> That does it for me.  I did not even know this feature existed.  I'd it
> proves more useful in an environment with poor selection / editing
> capabilities, i.e. a terminal shell.  Emacs does not need that when you
> can fuzzy-search your history and modify your prompt with arbitrary
> bindings / Lisp code.

I agree.  Although the expansion in this case is arguably a bug (as
Andreas pointed out), I don't have much interest in fixing it.  I
propose just to disable it by default (in master).

[0001-Disable-history-expansion-in-eshell-Bug-29157.patch (text/x-diff, inline)]
From c2753c383e603acfe15f70ee0cb3c93e624c6c39 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <npostavs <at> gmail.com>
Date: Wed, 22 Nov 2017 21:59:35 -0500
Subject: [PATCH] Disable history expansion in eshell (Bug#29157)

History expansion is not so useful since interactive history commands
are already provided.  It can produce surprising errors when the user
is not aware of the history designator syntax.
* lisp/eshell/em-hist.el (eshell-hist-initialize): Don't add
eshell-expand-history-references to eshell-expand-input-functions.
* etc/NEWS: Announce it.
---
 etc/NEWS               | 9 +++++++++
 lisp/eshell/em-hist.el | 3 ---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index c47ca42d27..5a01b912ec 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -109,6 +109,15 @@ Snake and Pong are more playable on HiDPI displays.
 *** Completing filenames in the minibuffer via 'C-TAB' now uses the
 styles as configured by the variable 'completion-styles'.
 
+** Eshell
+
+---
+*** Expansion of history event designators is disabled by default.
+To restore the old behavior, use
+
+    (add-hook 'eshell-expand-input-functions
+              #'eshell-expand-history-references)
+
 
 * New Modes and Packages in Emacs 27.1
 
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index 8084c12653..df462a7058 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -218,9 +218,6 @@ eshell-input-filter-initial-space
 
 (defun eshell-hist-initialize ()
   "Initialize the history management code for one Eshell buffer."
-  (add-hook 'eshell-expand-input-functions
-	    'eshell-expand-history-references nil t)
-
   (when (eshell-using-module 'eshell-cmpl)
     (add-hook 'pcomplete-try-first-hook
 	      'eshell-complete-history-reference nil t))
-- 
2.11.0


This bug report was last modified 7 years and 159 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.