Hi,
My copyright papers have been processed. Can we apply this to master?
Best,
Samer
Changes from master to working tree
4 files changed, 26 insertions(+), 22 deletions(-)
etc/ChangeLog | 4 ++++
etc/NEWS | 6 ++++++
lisp/ChangeLog | 7 +++++++
lisp/eshell/esh-arg.el | 31 +++++++++----------------------
Modified etc/ChangeLog
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 309c01f..3e76256 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,7 @@
+2014-12-08 Samer Masterson <samer <at> dark-horse>
+
+ * NEWS: Mention change in backslash expand behavior for eshell.
+
2014-12-08 Lars Magne Ingebrigtsen <larsi <at> gnus.org>
* NEWS: Mention the new eww `S' command.
Modified etc/NEWS
diff --git a/etc/NEWS b/etc/NEWS
index 56036f8..e6d9aab 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -192,6 +192,12 @@ result of the calculation into the current buffer.
*** New minor mode global-eldoc-mode
*** eldoc-documentation-function now defaults to nil
+** eshell
+
+*** Backslash (\) expands to the character literal after it if that
+character is non-special (e.g. 'b\in' expands to 'bin', because 'i' is
+not a special character). This behavior conforms with bash.
+
** eww
+++
Modified lisp/ChangeLog
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2669e07..0ec9b35 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2014-12-08 Samer Masterson <samer <at> samertm.com>
+
+ * eshell/esh-arg.el (eshell-parse-backslash): Return the literal
+ character after the backslash if the character is non-special
+ (bug#8531).
+ (eshell-looking-at-backslash-return): Unused, remove.
+
2014-12-08 Lars Magne Ingebrigtsen <larsi <at> gnus.org>
* net/nsm.el (nsm-check-protocol): Test for RC4 on `high'.
Modified lisp/eshell/esh-arg.el
diff --git a/lisp/eshell/esh-arg.el b/lisp/eshell/esh-arg.el
index 704de57..33ff384 100644
--- a/lisp/eshell/esh-arg.el
+++ b/lisp/eshell/esh-arg.el
@@ -89,7 +89,8 @@ yield the values intended."
(goto-char (match-end 0))
(eshell-finish-arg)))))
- ;; backslash before a special character means escape it
+ ;; backslash before a character escapes it if the character is
+ ;; special, and returns the character literal if it is non-special
'eshell-parse-backslash
;; text beginning with ' is a literally quoted
@@ -282,13 +283,6 @@ Point is left at the end of the arguments."
"A stub function that generates an error if a floating operator is
found."
(error "Unhandled operator in input text"))
-(defsubst eshell-looking-at-backslash-return (pos)
- "Test whether a backslash-return sequence occurs at POS."
- (and (eq (char-after pos) ?\\)
- (or (= (1+ pos) (point-max))
- (and (eq (char-after (1+ pos)) ?\n)
- (= (+ pos 2) (point-max))))))
-
(defun eshell-quote-backslash (string &optional index)
"Intelligently backslash the character occurring in STRING at INDEX.
If the character is itself a backslash, it needs no escaping."
@@ -305,9 +299,11 @@ If the character is itself a backslash, it needs no
escaping."
(string ?\\ char)))))
(defun eshell-parse-backslash ()
- "Parse a single backslash (\) character, which might mean escape.
-It only means escape if the character immediately following is a
-special character that is not itself a backslash."
+ "Parse a single backslash (\) character to escape the character
after.
+If the character immediately following the backslash is a special
+character, it returns the escaped version of that character.
+Else, the character has no meaning and is returned as the literal
+character. This conforms with the behavior of bash."
(when (eq (char-after) ?\\)
(if (eshell-looking-at-backslash-return (point))
(throw 'eshell-incomplete ?\\)
@@ -321,18 +317,9 @@ special character that is not itself a backslash."
(forward-char 2)
(list 'eshell-escape-arg
(char-to-string (char-before))))
- ;; allow \\<RET> to mean a literal "\" character followed by a
- ;; normal return, rather than a backslash followed by a line
- ;; continuation (i.e., "\\ + \n" rather than "\ + \\n"). This
- ;; is necessary because backslashes in Eshell are not special
- ;; unless they either precede something special, or precede a
- ;; backslash that precedes something special. (Mainly this is
- ;; done to make using backslash on Windows systems more
- ;; natural-feeling).
- (if (eshell-looking-at-backslash-return (1+ (point)))
- (forward-char))
(forward-char)
- "\\"))))
+ (forward-char)
+ (char-before)))))
(defun eshell-parse-literal-quote ()
"Parse a literally quoted string. Nothing has special meaning!"