Subject: bug#18960: 24.4; Eshell history substitution causes error

From: Samer Masterson <[email-masked]>
Date: Wed, 10 Dec 2014 04:51:01 -0800

eshell-parse-modifiers pulls its modifiers from eshell-modifier-alist,
where are all functions that operate on lists of strings, so I updated
the docstring for eshell-parse-modifiers to reflect that. I've also
added my changes to the ChangeLog.

Best,
Samer

Changes from HEAD to working tree
3 files changed, 15 insertions(+), 8 deletions(-)
 lisp/ChangeLog         |    8 ++++++++
 lisp/eshell/em-hist.el |    4 ++--
 lisp/eshell/em-pred.el |   11 +++++------

	Modified   lisp/ChangeLog
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 45ba279..c30c43a 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2014-12-10    <samer@localhost>
+
+	* eshell/em-hist.el (eshell-hist-parse-word-designator): Return
+	args joined with " ".
+	* eshell/em-pred.el (eshell-parse-modifiers): Correct docstring.
+	(eshell-hist-parse-modifier): Pass mod a list instead of a string
+	(bug#18960).
+
 2014-11-28  Martin Rudalics  <[email-masked]>

 	Fix two issues around help-window-select.  (Bug#11039) (Bug#19012)
	Modified   lisp/eshell/em-hist.el
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el
index b721b5d..e7e9a1e 100644
--- a/lisp/eshell/em-hist.el
+++ b/lisp/eshell/em-hist.el
@@ -724,7 +724,7 @@ matched."
 	(setq nth (eshell-hist-word-reference nth)))
       (unless (numberp mth)
 	(setq mth (eshell-hist-word-reference mth)))
-      (cons (mapconcat 'identity (eshell-sublist textargs nth mth) "")
+      (cons (mapconcat 'identity (eshell-sublist textargs nth mth) " ")
 	    end))))

 (defun eshell-hist-parse-modifier (hist reference)
@@ -737,7 +737,7 @@ matched."
 	  (goto-char (point-min))
 	  (let ((modifiers (cdr (eshell-parse-modifiers))))
 	    (dolist (mod modifiers)
-	      (setq hist (funcall mod hist)))
+	      (setq hist (car (funcall mod (list hist)))))
 	    hist))
       (delete-region here (point)))))

	Modified   lisp/eshell/em-pred.el
diff --git a/lisp/eshell/em-pred.el b/lisp/eshell/em-pred.el
index f55d687..7d6e326 100644
--- a/lisp/eshell/em-pred.el
+++ b/lisp/eshell/em-pred.el
@@ -296,16 +296,15 @@ This function is specially for adding onto
`eshell-parse-argument-hook'."

 (defun eshell-parse-modifiers ()
   "Parse value modifiers and predicates at point.
-If ALLOW-PREDS is non-nil, predicates will be parsed as well.
 Return a cons cell of the form

   (PRED-FUNC-LIST . MOD-FUNC-LIST)

-NEW-STRING is STRING minus any modifiers.  PRED-FUNC-LIST is a list of
-predicate functions.  MOD-FUNC-LIST is a list of result modifier
-functions.  PRED-FUNCS take a filename and return t if the test
-succeeds; MOD-FUNCS take any string and preform a modification,
-returning the resultant string."
+PRED-FUNC-LIST is a list of predicate functions.  MOD-FUNC-LIST
+is a list of result modifier functions.  PRED-FUNCS take a
+filename and return t if the test succeeds; MOD-FUNCS take any
+list of strings and perform a modification, returning the
+resultant list of strings."
   (let (negate follow preds mods)
     (condition-case nil
 	(while (not (eobp))