unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 24542@debbugs.gnu.org
Subject: bug#24542: 25.1.50; The symbol `@' and sexp scanning
Date: Mon, 02 Jan 2017 15:37:28 -0500	[thread overview]
Message-ID: <87zij95hbr.fsf@users.sourceforge.net> (raw)
In-Reply-To: <87o9zptn3r.fsf@web.de> (Michael Heerdegen's message of "Mon, 02 Jan 2017 17:58:48 +0100")

Michael Heerdegen <michael_heerdegen@web.de> writes:

> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
>> insert
>>
>>     (eq element '@)
>>
>> in an elisp mode buffer (e.g. scratch).  Put point at the quote or the
>> "@".  Eval
>>
>>     (goto-char (scan-sexps (point) 1))
>>
>> and you get an error like:
>>
>>
>> Debugger entered--Lisp error: (scan-error "Containing expression ends
>> prematurely" 15 16)
>
> It seems that you can replace the symbol `@' in this recipe with any
> symbol whose name has the form "@+", i.e. `@@' or `@@@' or...  When the
> symbol contains only one character different from "@", it doesn't seem
> to happen.

`@' has the prefix syntax flag, the elisp manual says `(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.

So (eq element '@) acts the same as (eq element ' ).  This could be
changed with something the following patch, but I'm not sure if it's the
right thing for non-Lisp languages...

diff --git i/src/syntax.c w/src/syntax.c
index 0ee1c74..253d3fb 100644
--- i/src/syntax.c
+++ w/src/syntax.c
@@ -2681,7 +2681,16 @@ scan_lists (EMACS_INT from, EMACS_INT count, EMACS_INT depth, bool sexpflag)
 	    }
 
 	  if (prefix)
-	    continue;
+            {
+              int next_c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
+              int next_syntax = SYNTAX_WITH_FLAGS (next_c);
+              bool next_prefix = SYNTAX_FLAGS_PREFIX (next_syntax);
+              enum syntaxcode next_code = syntax_multibyte (next_c, multibyte_symbol_p);
+              if (next_prefix
+                  || next_code == Ssymbol
+                  || next_code == Sword)
+                continue;
+            }
 
 	  switch (code)
 	    {






  reply	other threads:[~2017-01-02 20:37 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-25 17:42 bug#24542: 25.1.50; The symbol `@' and sexp scanning Michael Heerdegen
2017-01-02 16:58 ` Michael Heerdegen
2017-01-02 20:37   ` npostavs [this message]
2017-01-03 12:46     ` Michael Heerdegen
2017-01-03 13:03       ` npostavs
2020-09-04 13:05       ` Lars Ingebrigtsen
2020-09-04 13:31         ` Eli Zaretskii
2020-09-04 14:22           ` Stefan Monnier
2024-04-10 23:06 ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-11  3:42   ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-12 17:29     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-12 21:32       ` Michael Heerdegen via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-13  1:55         ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zij95hbr.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=24542@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).