* bug#23354: 25.1.50; Unicode literals aren't handled correctly by some commands
@ 2016-04-24 12:16 Lars Magne Ingebrigtsen
2016-05-01 12:59 ` Philipp Stephani
0 siblings, 1 reply; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2016-04-24 12:16 UTC (permalink / raw)
To: 23354
If you put point after the following expression and hit `C-x C-e':
?\N{HEAVY CHECK MARK}
you'll get an error saying "(void-variable MARK})". And in an Emacs
Lisp buffer, using forward/backward sexp commands, they do not skip past
the entire expression.
In GNU Emacs 25.1.50.35 (x86_64-unknown-linux-gnu, GTK+ Version 3.4.2)
of 2016-04-24 built on stories
Repository revision: a28873ce734b3618b0e8f6892e65db24d2f18da8
Windowing system distributor 'The X.Org Foundation', version 11.0.11204000
System Description: Debian GNU/Linux 7.9 (wheezy)
Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GSETTINGS NOTIFY GNUTLS
LIBXML2 FREETYPE LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#23354: 25.1.50; Unicode literals aren't handled correctly by some commands
2016-04-24 12:16 bug#23354: 25.1.50; Unicode literals aren't handled correctly by some commands Lars Magne Ingebrigtsen
@ 2016-05-01 12:59 ` Philipp Stephani
2016-05-02 21:58 ` Lars Ingebrigtsen
0 siblings, 1 reply; 5+ messages in thread
From: Philipp Stephani @ 2016-05-01 12:59 UTC (permalink / raw)
To: Lars Magne Ingebrigtsen, 23354
[-- Attachment #1.1: Type: text/plain, Size: 503 bytes --]
Lars Magne Ingebrigtsen <larsi@gnus.org> schrieb am So., 24. Apr. 2016 um
14:17 Uhr:
>
> If you put point after the following expression and hit `C-x C-e':
>
> ?\N{HEAVY CHECK MARK}
>
> you'll get an error saying "(void-variable MARK})". And in an Emacs
> Lisp buffer, using forward/backward sexp commands, they do not skip past
> the entire expression.
>
>
Thanks, I've attached a patch that should fix eval-print-last-expr. This
doesn't fix backward-sexp, because I think that would be much harder.
[-- Attachment #1.2: Type: text/html, Size: 825 bytes --]
[-- Attachment #2: 0001-Detect-named-character-literals.patch --]
[-- Type: application/octet-stream, Size: 2122 bytes --]
From 62eb07c44f5b6c1af27923b5dd971f4429006806 Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Sun, 1 May 2016 14:52:49 +0200
Subject: [PATCH] Detect named character literals.
Fixes Bug#23354.
* lisp/progmodes/elisp-mode.el (elisp--preceding-sexp): Skip over
named character literals.
* test/lisp/progmodes/elisp-mode-tests.el
(elisp--preceding-sexp--char-name): Add test for skipping over
named character literals.
---
lisp/progmodes/elisp-mode.el | 11 +++++++++++
test/lisp/progmodes/elisp-mode-tests.el | 6 ++++++
2 files changed, 17 insertions(+)
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index ca85980..1c72848 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1051,6 +1051,17 @@ elisp--preceding-sexp
((or (eq (following-char) ?\')
(eq (preceding-char) ?\'))
(setq left-quote ?\`)))
+
+ ;; When after a named character literal, skip over the entire
+ ;; literal, not only its last word.
+ (when (= (preceding-char) ?})
+ (let ((begin (save-excursion
+ (backward-char)
+ (skip-syntax-backward "w-")
+ (backward-char 3)
+ (when (looking-at-p "\\\\N{") (point)))))
+ (when begin (goto-char begin))))
+
(forward-sexp -1)
;; If we were after `?\e' (or similar case),
;; use the whole thing, not just the `e'.
diff --git a/test/lisp/progmodes/elisp-mode-tests.el b/test/lisp/progmodes/elisp-mode-tests.el
index 1679af3..a7562a0 100644
--- a/test/lisp/progmodes/elisp-mode-tests.el
+++ b/test/lisp/progmodes/elisp-mode-tests.el
@@ -641,5 +641,11 @@ xref-elisp-overloadable-separate-default
(elisp--xref-find-definitions (eval '(provide 'stephe-leake-feature)))
nil)
+(ert-deftest elisp--preceding-sexp--char-name ()
+ (with-temp-buffer
+ (emacs-lisp-mode)
+ (insert "?\\N{HEAVY CHECK MARK}")
+ (should (equal (elisp--preceding-sexp) ?\N{HEAVY CHECK MARK}))))
+
(provide 'elisp-mode-tests)
;;; elisp-mode-tests.el ends here
--
2.8.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#23354: 25.1.50; Unicode literals aren't handled correctly by some commands
2016-05-01 12:59 ` Philipp Stephani
@ 2016-05-02 21:58 ` Lars Ingebrigtsen
2020-08-04 9:37 ` Lars Ingebrigtsen
0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2016-05-02 21:58 UTC (permalink / raw)
To: Philipp Stephani; +Cc: 23354
Philipp Stephani <p.stephani2@gmail.com> writes:
> Thanks, I've attached a patch that should fix eval-print-last-expr. This doesn't
> fix backward-sexp, because I think that would be much harder.
Thanks; applied. I hope somebody else can fix backward-sexp and
friends. :-)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#23354: 25.1.50; Unicode literals aren't handled correctly by some commands
2016-05-02 21:58 ` Lars Ingebrigtsen
@ 2020-08-04 9:37 ` Lars Ingebrigtsen
2022-05-06 16:37 ` Lars Ingebrigtsen
0 siblings, 1 reply; 5+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-04 9:37 UTC (permalink / raw)
To: Philipp Stephani; +Cc: 23354
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Philipp Stephani <p.stephani2@gmail.com> writes:
>
>> Thanks, I've attached a patch that should fix
>> eval-print-last-expr. This doesn't
>> fix backward-sexp, because I think that would be much harder.
>
> Thanks; applied. I hope somebody else can fix backward-sexp and
> friends. :-)
I just checked whether things has changed -- and, no, backward-sexp and
friends still do the wrong thing on Unicode literals like
?\N{HEAVY CHECK MARK}
in Emacs Lisp buffers. In particular, backward-sexp after the final "}"
skips to the start of "MARK", and forward-sexp at the start skips to the
end of "HEAVY".
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#23354: 25.1.50; Unicode literals aren't handled correctly by some commands
2020-08-04 9:37 ` Lars Ingebrigtsen
@ 2022-05-06 16:37 ` Lars Ingebrigtsen
0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2022-05-06 16:37 UTC (permalink / raw)
To: Philipp Stephani; +Cc: 23354
Lars Ingebrigtsen <larsi@gnus.org> writes:
> I just checked whether things has changed -- and, no, backward-sexp and
> friends still do the wrong thing on Unicode literals like
>
> ?\N{HEAVY CHECK MARK}
>
> in Emacs Lisp buffers. In particular, backward-sexp after the final "}"
> skips to the start of "MARK", and forward-sexp at the start skips to the
> end of "HEAVY".
I've now fixed this in Emacs 29.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-05-06 16:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-24 12:16 bug#23354: 25.1.50; Unicode literals aren't handled correctly by some commands Lars Magne Ingebrigtsen
2016-05-01 12:59 ` Philipp Stephani
2016-05-02 21:58 ` Lars Ingebrigtsen
2020-08-04 9:37 ` Lars Ingebrigtsen
2022-05-06 16:37 ` Lars Ingebrigtsen
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).