GNU bug report logs -
#15998
24.3; forward-sexp (scan-sexps) doesn't do well with some SEXPs
Previous Next
Reported by: Shigeru Fukaya <shigeru.fukaya <at> gmail.com>
Date: Fri, 29 Nov 2013 14:46:01 UTC
Severity: normal
Tags: moreinfo
Merged with 30132
Found in versions 24.3, 27.0.50
Fixed in version 29.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #17 received at 15998 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
>> 2. ^[...] ^^[...] char table
Sorry, but it's #^[...] #^^[...]
>> 4. $! beginning of executable file
>I don't know what 4 is. Or do you mean "#!" as the first two chars of
>the file? We could setup syntax-propertize-function to mark them as
>comments, indeed.
It is just magic number of unix files.
(read-from-string "#!/usr/local/bin/emacs\n(pwd)") --> ((pwd) . 28)
see read1 in lread.c.
And, my changes to the latest emacs are,
1) add `scan-sexps' an optional argument, `elisp-syntax'.
2) pass `scan_lists' the optional argument.
3) `scan_lists' handles elisp specific handling when the argument is set.
4) `forward-sexp' calls `scan-sexps' with the optional argument non-nil
value when the current buffer's mode is elisp related mode.
Anso, do additional movement for labels of cyclic object, as is for
prefixes.
(Is a change in the last sentence above unnecessary?)
As a result, I seems doing expectedly on such an object as below.
(a b #&3"d" #&99"ZZZ" #1=a #2= b #1# #3= #40= (c) #40# #2# #10= #&10"A"
#s(dummy 1 2 3) #^^[dummy 1 2 3] #^[dummy 1 2 3] ## xyz)
Regards,
Shigeru
---------------------
ChangeLog
Add support for elisp syntax of bool vector, label of cyclic object,
hash table, char-table and empty symbol.
* lisp.el (forward-sexp)
* syntax.c (scan_lists, Fscan_lists, Fscan_sexps)
lisp.el
(defun forward-sexp (&optional arg)
"Move forward across one balanced expression (sexp).
With ARG, do it that many times. Negative arg -N means
move backward across N balanced expressions.
This command assumes point is not in a string or comment.
Calls `forward-sexp-function' to do the work, if that is non-nil."
(interactive "^p")
(let ((elisp (memq major-mode '(emacs-lisp-mode
;;eshell-mode
inferior-emacs-lisp-mode
lisp-interaction-mode))))
(or arg (setq arg 1))
(if forward-sexp-function
(funcall forward-sexp-function arg)
(goto-char (or (scan-sexps (point) arg elisp) (buffer-end arg)))
(when (< arg 0)
(when elisp
(save-match-data
(while (re-search-backward "#[0-9]+=\\s-*\\=" nil t))))
(backward-prefix-chars)))))
[syntax.patch (application/octet-stream, attachment)]
This bug report was last modified 3 years and 15 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.