unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Lars Magne Ingebrigtsen <larsi@gnus.org>, 23354@debbugs.gnu.org
Subject: bug#23354: 25.1.50; Unicode literals aren't handled correctly by some commands
Date: Sun, 01 May 2016 12:59:37 +0000	[thread overview]
Message-ID: <CAArVCkSavYPA0zUQdP11REMPdkiXo2--PbE=PCu+6DqcF0gY3Q@mail.gmail.com> (raw)
In-Reply-To: <m3d1pfcice.fsf@gnus.org>


[-- 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


  reply	other threads:[~2016-05-01 12:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2016-05-02 21:58   ` Lars Ingebrigtsen
2020-08-04  9:37     ` Lars Ingebrigtsen
2022-05-06 16:37       ` Lars Ingebrigtsen

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='CAArVCkSavYPA0zUQdP11REMPdkiXo2--PbE=PCu+6DqcF0gY3Q@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=23354@debbugs.gnu.org \
    --cc=larsi@gnus.org \
    /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).