* The symbol `@' and sexp scanning
@ 2016-09-25 15:23 Michael Heerdegen
2016-10-12 14:00 ` Andreas Politz
0 siblings, 1 reply; 5+ messages in thread
From: Michael Heerdegen @ 2016-09-25 15:23 UTC (permalink / raw)
To: Emacs Development
Hi,
the following breaks my "el-search" package when searching in
"skeleton.el". Am I doing something unkosher, or is this just a bug?
Insert
(eq element '@)
in an elisp mode buffer. Put point at the quote or the "@". Eval
(goto-char (scan-sexps (point) 1))
and you get an error:
Debugger entered--Lisp error: (scan-error "Containing expression ends prematurely" 15 16)
scan-sexps(13 1)
(goto-char (scan-sexps (point) 1))
eval((goto-char (scan-sexps (point) 1)) nil)
eval-expression((goto-char (scan-sexps (point) 1)) nil)
funcall-interactively(eval-expression (goto-char (scan-sexps (point) 1)) nil)
call-interactively(eval-expression nil nil)
command-execute(eval-expression)
But if you add one more sexp to the list after "'@", there is no such
error.
TIA,
Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: The symbol `@' and sexp scanning
2016-09-25 15:23 The symbol `@' and sexp scanning Michael Heerdegen
@ 2016-10-12 14:00 ` Andreas Politz
2016-10-13 3:56 ` Michael Heerdegen
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Politz @ 2016-10-12 14:00 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Emacs Development
I believe the answer is in here:
,----[ (info "(elisp) Syntax Flags") ]
| • ‘p’ identifies an additional prefix character for Lisp syntax.
| These characters are treated as whitespace when they appear between
| expressions. When they appear within an expression, they are
| handled according to their usual syntax classes.
`----
This flag is set in elisp buffers. But after evaluating
(modify-syntax-entry ?@ "_") the function performs as expected.
-ap
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: The symbol `@' and sexp scanning
2016-10-12 14:00 ` Andreas Politz
@ 2016-10-13 3:56 ` Michael Heerdegen
2016-10-13 10:19 ` Andreas Politz
0 siblings, 1 reply; 5+ messages in thread
From: Michael Heerdegen @ 2016-10-13 3:56 UTC (permalink / raw)
To: Andreas Politz; +Cc: Emacs Development
Hello Andreas,
(we are talking about bug#24542")
> I believe the answer is in here:
>
> ,----[ (info "(elisp) Syntax Flags") ]
> | • ‘p’ identifies an additional prefix character for Lisp syntax.
> | These characters are treated as whitespace when they appear
> | between
> | expressions. When they appear within an expression, they are
> | handled according to their usual syntax classes.
> `----
FWIW, I can't make much sense out of this description (but the first
sentence). Nearly anything in an Elisp buffer is inside an expression.
Anything else is either a comment. Or, the only case that seems to fit
into this description is an isolated "@" at top-level. According to
this text, it should be treated as whitespace. Dunno what that exactly
means, but evaluating something like that results in an error saying
that the symbol `@' is unbound, so it doesn't seem to be treated as
whitespace, but as an expression.
> This flag is set in elisp buffers. But after evaluating
> (modify-syntax-entry ?@ "_") the function performs as expected.
Ok, but I guess it's not syntax classification that is problematic but
how it is treated in the case of the bug. Also see the seemingly very
related bug#22238, btw.
Regards,
Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: The symbol `@' and sexp scanning
2016-10-13 3:56 ` Michael Heerdegen
@ 2016-10-13 10:19 ` Andreas Politz
2016-10-13 12:48 ` Stefan Monnier
0 siblings, 1 reply; 5+ messages in thread
From: Andreas Politz @ 2016-10-13 10:19 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Emacs Development
Michael Heerdegen <michael_heerdegen@web.de> writes:
> FWIW, I can't make much sense out of this description (but the first
> sentence). Nearly anything in an Elisp buffer is inside an
> expression.
I think `expression' can be read as `symbol' in this context.
E.g. calling forward-sexp at the beginning of any of the following
expressions results in the same error.
)
')
'')
'@)
@@)
'@'@')
This is because the sexp scanner treats ' and @ (due to the p flag) in
this context as whitespace, i.e. ignores it (Anyway, that's how I
understand it.). OTOH the following all `work', because there is
something to scan over, before reaching the closing paren.
x)
' x)
@ x)
> [...] evaluating something like that results in an error saying that
> the symbol `@' is unbound, so it doesn't seem to be treated as
> whitespace, but as an expression.
But the way expressions are read and evaluated has nothing to do with
how the function scan-sexp operates.
> Ok, but I guess it's not syntax classification that is problematic but
> how it is treated in the case of the bug.
AFAIK it operates as intended. As to why @ is treated as a prefix
character in an Elisp buffer I don't know.
-ap
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: The symbol `@' and sexp scanning
2016-10-13 10:19 ` Andreas Politz
@ 2016-10-13 12:48 ` Stefan Monnier
0 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2016-10-13 12:48 UTC (permalink / raw)
To: emacs-devel
> AFAIK it operates as intended. As to why @ is treated as a prefix
> character in an Elisp buffer I don't know.
Because of the ,@ "unquote splicing".
Stefan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-10-13 12:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-25 15:23 The symbol `@' and sexp scanning Michael Heerdegen
2016-10-12 14:00 ` Andreas Politz
2016-10-13 3:56 ` Michael Heerdegen
2016-10-13 10:19 ` Andreas Politz
2016-10-13 12:48 ` Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).