* forward-sexp and quote
@ 2003-01-20 1:33 Pascal Bourguignon
2003-01-21 18:17 ` Richard Stallman
0 siblings, 1 reply; 3+ messages in thread
From: Pascal Bourguignon @ 2003-01-20 1:33 UTC (permalink / raw)
(forward-sexp 1) eats quotes and backquotes, but (forward-sexp -1) doesn't.
.'(a b c) --(forward-sexp 1)--> '(a b c). --(forward-sexp -1)--> '.(a b c)
(dot showing the point).
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 (point))
after)
(goto-char (point-max))
(insert "\n")
(insert s)
(goto-char before)
(forward-sexp 1)
(forward-sexp -1)
(setq after (point))
(goto-char (point-max))
(insert (format "\nbefore=%S\nafter =%S\n\n" before after))))
'("' (a b c)" "'(a b c)")))
' (a b c)
before=1
after =4
'(a b c)
before=31
after =32
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------
There is a fault in reality. Do not adjust your minds. -- Salman Rushdie
^ permalink raw reply [flat|nested] 3+ messages in thread
* forward-sexp and quote
@ 2003-01-20 1:52 Pascal Bourguignon
0 siblings, 0 replies; 3+ messages in thread
From: Pascal Bourguignon @ 2003-01-20 1:52 UTC (permalink / raw)
(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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2003-01-21 18:17 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-01-20 1:33 forward-sexp and quote Pascal Bourguignon
2003-01-21 18:17 ` Richard Stallman
-- strict thread matches above, loose matches on Subject: below --
2003-01-20 1:52 Pascal Bourguignon
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.