unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Michael Heerdegen <michael_heerdegen@web.de>
Cc: 24542@debbugs.gnu.org
Subject: bug#24542: 25.1.50; The symbol `@' and sexp scanning
Date: Wed, 10 Apr 2024 19:06:32 -0400	[thread overview]
Message-ID: <jwvzfu04y5s.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <8760pj27wm.fsf@web.de> (Michael Heerdegen's message of "Sun, 25 Sep 2016 19:42:17 +0200")

[-- Attachment #1: Type: text/plain, Size: 348 bytes --]

>     (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)

The patch below seems to fix it.
Any comments/objections?


        Stefan

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: bug24542.diff --]
[-- Type: text/x-diff, Size: 1338 bytes --]

diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index 9b4c3f994cd..10d7f01ebaf 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -40,9 +40,8 @@ 'emacs-lisp-mode-abbrev-table
 
 (defvar emacs-lisp-mode-syntax-table
   (let ((table (make-syntax-table lisp-data-mode-syntax-table)))
-    ;; These are redundant, now.
-    ;;(modify-syntax-entry ?\[ "(]  " table)
-    ;;(modify-syntax-entry ?\] ")[  " table)
+    ;; `syntax-propertize'. takes care of `,@'.
+    (modify-syntax-entry ?@ "_" table)
     table)
   "Syntax table used in `emacs-lisp-mode'.")
 
diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el
index 1d1ef9981e5..3ef5a28e460 100644
--- a/test/lisp/progmodes/elisp-mode-tests.el
+++ b/test/lisp/progmodes/elisp-mode-tests.el
@@ -1131,5 +1131,14 @@ test-indentation
                         (emacs-lisp-mode)
                         (indent-region (point-min) (point-max)))))
 
+(ert-deftest elisp-tests-syntax-propertize ()
+  (with-temp-buffer
+    (emacs-lisp-mode)
+    (insert "(a '@)")
+    (should (equal (scan-sexps (+ (point-min) 3) 1) (1- (point-max))))
+    (erase-buffer)
+    (insert "(a ,@)")
+    (should-error (scan-sexps (+ (point-min) 3) 1))))
+
 (provide 'elisp-mode-tests)
 ;;; elisp-mode-tests.el ends here

  parent reply	other threads:[~2024-04-10 23:06 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
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 [this message]
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=jwvzfu04y5s.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=24542@debbugs.gnu.org \
    --cc=michael_heerdegen@web.de \
    --cc=monnier@iro.umontreal.ca \
    /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).