From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: samer Newsgroups: gmane.emacs.bugs Subject: bug#8531: 24.0.50; Date: Mon, 08 Dec 2014 01:34:12 -0800 Message-ID: <803b223f5dd871db67cab3b46e8b6d3a@samertm.com> References: <8762q8xe3i.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1418057133 31190 80.91.229.3 (8 Dec 2014 16:45:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 8 Dec 2014 16:45:33 +0000 (UTC) To: 8531@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 08 17:45:25 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Xy1R3-0005GO-Gh for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Dec 2014 17:45:21 +0100 Original-Received: from localhost ([::1]:34902 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xy1R3-0008AU-4w for geb-bug-gnu-emacs@m.gmane.org; Mon, 08 Dec 2014 11:45:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50727) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xy1Qt-000896-IE for bug-gnu-emacs@gnu.org; Mon, 08 Dec 2014 11:45:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xy1Qm-0007Ui-NW for bug-gnu-emacs@gnu.org; Mon, 08 Dec 2014 11:45:11 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60636) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xy1Qm-0007UA-Im for bug-gnu-emacs@gnu.org; Mon, 08 Dec 2014 11:45:04 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Xy1Qm-000219-9b for bug-gnu-emacs@gnu.org; Mon, 08 Dec 2014 11:45:04 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: <8762q8xe3i.fsf@gmail.com> Resent-From: samer Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 08 Dec 2014 16:45:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8531 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8531-submit@debbugs.gnu.org id=B8531.14180570797663 (code B ref 8531); Mon, 08 Dec 2014 16:45:04 +0000 Original-Received: (at 8531) by debbugs.gnu.org; 8 Dec 2014 16:44:39 +0000 Original-Received: from localhost ([127.0.0.1]:57842 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xy1QH-0001zG-C4 for submit@debbugs.gnu.org; Mon, 08 Dec 2014 11:44:39 -0500 Original-Received: from samertm.com ([162.243.37.26]:60530 helo=mail.samertm.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xxui9-0006dA-HR for 8531@debbugs.gnu.org; Mon, 08 Dec 2014 04:34:34 -0500 Original-Received: from samertm.com (localhost [127.0.0.1]) by mail.samertm.com (Postfix) with ESMTP id 71B258076F for <8531@debbugs.gnu.org>; Mon, 8 Dec 2014 09:34:12 +0000 (UTC) X-Sender: samer@samertm.com User-Agent: Roundcube Webmail/0.9.5 X-Mailman-Approved-At: Mon, 08 Dec 2014 11:44:30 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:97000 Archived-At: Hi, I found this bug on debbugs thanks to Lars' getting started guide. This change simplifies the code by making the behavior that used occur for newlines following a backslash, returning the character literal after the backslash, the behavior that occurs for _all_ non-special characters. This is my first contribution to emacs, so don't hesitate to correct anything nonstandard in the patch I've included. I'm interested in doing more work on eshell, too. What eshell bugs would benefit from a fresh pair of eyes? Best, Samer Patch for esh-arg.el: *** /home/samer/build/emacs120714/share/emacs/25.0.50/lisp/eshell/esh-arg.el.gz.old --- /home/samer/build/emacs120714/share/emacs/25.0.50/lisp/eshell/esh-arg.el.gz *************** *** 89,95 **** (goto-char (match-end 0)) (eshell-finish-arg))))) ! ;; backslash before a special character means escape it 'eshell-parse-backslash ;; text beginning with ' is a literally quoted --- 89,96 ---- (goto-char (match-end 0)) (eshell-finish-arg))))) ! ;; 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,294 **** "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." --- 283,288 ---- *************** *** 305,313 **** (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." (when (eq (char-after) ?\\) (if (eshell-looking-at-backslash-return (point)) (throw 'eshell-incomplete ?\\) --- 299,309 ---- (string ?\\ char))))) (defun eshell-parse-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,338 **** (forward-char 2) (list 'eshell-escape-arg (char-to-string (char-before)))) - ;; allow \\ 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) ! "\\")))) (defun eshell-parse-literal-quote () "Parse a literally quoted string. Nothing has special meaning!" --- 317,325 ---- (forward-char 2) (list 'eshell-escape-arg (char-to-string (char-before)))) (forward-char) ! (forward-char) ! (char-before))))) (defun eshell-parse-literal-quote () "Parse a literally quoted string. Nothing has special meaning!" Diff finished. Mon Dec 8 01:23:11 2014 *** /home/samer/build/emacs120714/share/emacs/25.0.50/lisp/eshell/esh-arg.el.gz.old --- /home/samer/build/emacs120714/share/emacs/25.0.50/lisp/eshell/esh-arg.el.gz *************** *** 89,95 **** (goto-char (match-end 0)) (eshell-finish-arg))))) ! ;; backslash before a special character means escape it 'eshell-parse-backslash ;; text beginning with ' is a literally quoted --- 89,96 ---- (goto-char (match-end 0)) (eshell-finish-arg))))) ! ;; 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,294 **** "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." --- 283,288 ---- *************** *** 305,313 **** (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." (when (eq (char-after) ?\\) (if (eshell-looking-at-backslash-return (point)) (throw 'eshell-incomplete ?\\) --- 299,309 ---- (string ?\\ char))))) (defun eshell-parse-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,338 **** (forward-char 2) (list 'eshell-escape-arg (char-to-string (char-before)))) - ;; allow \\ 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) ! "\\")))) (defun eshell-parse-literal-quote () "Parse a literally quoted string. Nothing has special meaning!" --- 317,325 ---- (forward-char 2) (list 'eshell-escape-arg (char-to-string (char-before)))) (forward-char) ! (forward-char) ! (char-before))))) (defun eshell-parse-literal-quote () "Parse a literally quoted string. Nothing has special meaning!"