From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Pascal Bourguignon Newsgroups: gmane.emacs.bugs Subject: forward-sexp and quote Date: 20 Jan 2003 02:52:32 +0100 Organization: informatimago.com Sender: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Message-ID: <87k7h0fuzj.fsf@thalassa.informatimago.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1043027589 5891 80.91.224.249 (20 Jan 2003 01:53:09 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 20 Jan 2003 01:53:09 +0000 (UTC) Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18aR7b-0001Wt-00 for ; Mon, 20 Jan 2003 02:53:07 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18aR8r-0007IX-05 for gnu-bug-gnu-emacs@m.gmane.org; Sun, 19 Jan 2003 20:54:25 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18aR8M-0006wh-00 for bug-gnu-emacs@prep.ai.mit.edu; Sun, 19 Jan 2003 20:53:54 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18aR7f-0005vb-00 for bug-gnu-emacs@prep.ai.mit.edu; Sun, 19 Jan 2003 20:53:13 -0500 Original-Received: from mailbox5.ucsd.edu ([132.239.1.57]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18aR7L-0005TV-00 for bug-gnu-emacs@prep.ai.mit.edu; Sun, 19 Jan 2003 20:52:51 -0500 Original-Received: from mail.fu-berlin.de (mail.fu-berlin.de [160.45.11.165]) by mailbox5.ucsd.edu (8.12.3/8.12.3) with ESMTP id h0K1qYMf049816 for ; Sun, 19 Jan 2003 17:52:37 -0800 (PST) Original-Received: by mail.fu-berlin.de (Smail3.2.0.98) from Curry.ZEDAT.FU-Berlin.DE (160.45.10.36) with esmtp id ; Mon, 20 Jan 2003 02:52:33 +0100 (MET) Original-Received: by Curry.ZEDAT.FU-Berlin.DE (Smail3.2.0.98) from news.fu-berlin.de with bsmtp id ; Mon, 20 Jan 2003 02:52:33 +0100 (MET) Original-To: gnu-emacs-bug@moderators.isc.org Original-Path: thalassa.informatimago.COM!not-for-mail Original-Newsgroups: gnu.emacs.bug Original-Lines: 81 X-Orig-NNTP-Posting-Host: thalassa.informatimago.com (212.87.205.57) X-Orig-X-Trace: fu-berlin.de 1043027553 26230378 212.87.205.57 (16 [41911]) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 X-MailScanner: PASSED (v1.2.7 40801 h0K1qYMf049816 mailbox5.ucsd.edu) X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Bug reports for GNU Emacs, the Swiss army knife of text editors List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: bug-gnu-emacs-bounces+gnu-bug-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.bugs:4259 X-Report-Spam: http://spam.gmane.org/gmane.emacs.bugs:4259 (forward-sexp 1) eats quotes and backquotes, but (forward-sexp -1) doesn't. That is, when there are spaces after the quote. Which is unfortunate because the reader doesn't mind these spaces and reads correctly the quoted expression: .' (a b c) --(forward-sexp 1)--> ' (a b c). --(forward-sexp -1)--> ' .(a b c) ;; dot showing the point. (show ' ( a b c)) ==> (a b c) The bug can be traced to scan-sexp which is a built-in. (show (version)) ==> "GNU Emacs 21.2.1 (i686-pc-linux-gnu, X toolkit) of 2002-10-26 on thalassa" (progn (find-file "*bug*") (emacs-lisp-mode) (erase-buffer) (mapc (lambda (s) (let (before after end read-before read-after) (goto-char (point-max)) (insert "\n") (setq before (point)) (insert s) (setq end (point)) (goto-char before) (setq read-before (read-from-string (buffer-substring (point) end))) (forward-sexp 1) (forward-sexp -1) (setq after (point)) (setq read-after (read-from-string (buffer-substring (point) end))) (goto-char (point-max)) (insert (format "\nread before: %S\n" read-before)) (insert (format "read after : %S\n" read-after)) (insert (format "before=%S\nafter =%S %s\n\n" before after (if (= before after) "" "BUG!"))))) '("' (a b c)" "'(a b c)" "' abc" "'abc"))) ' (a b c) read before: ((quote (a b c)) . 9) read after : ((a b c) . 7) before=2 after =4 BUG! '(a b c) read before: ((quote (a b c)) . 8) read after : ((quote (a b c)) . 8) before=101 after =101 ' abc read before: ((quote abc) . 5) read after : (abc . 3) before=207 after =209 BUG! 'abc read before: ((quote abc) . 4) read after : ((quote abc) . 4) before=298 after =298 -- __Pascal_Bourguignon__ http://www.informatimago.com/ ---------------------------------------------------------------------- There is a fault in reality. Do not adjust your minds. -- Salman Rushdie