From unknown Tue Jun 17 01:40:06 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32939: 27.0.50; Don't reject confusable quotes, just fontify & mention them in error messages Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 04 Oct 2018 23:59:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 32939 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 32939@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.153869751013639 (code B ref -1); Thu, 04 Oct 2018 23:59:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 Oct 2018 23:58:30 +0000 Received: from localhost ([127.0.0.1]:37250 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g8DVl-0003Xv-N3 for submit@debbugs.gnu.org; Thu, 04 Oct 2018 19:58:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40697) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g8DVj-0003Xe-FN for submit@debbugs.gnu.org; Thu, 04 Oct 2018 19:58:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g8DVc-00018z-BD for submit@debbugs.gnu.org; Thu, 04 Oct 2018 19:58:22 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:33840) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g8DVc-00018e-6E for submit@debbugs.gnu.org; Thu, 04 Oct 2018 19:58:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8DVa-0001Ao-Ec for bug-gnu-emacs@gnu.org; Thu, 04 Oct 2018 19:58:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g8DVX-0000wJ-2a for bug-gnu-emacs@gnu.org; Thu, 04 Oct 2018 19:58:18 -0400 Received: from mail-it1-x12b.google.com ([2607:f8b0:4864:20::12b]:33894) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g8DVW-0000s8-N7 for bug-gnu-emacs@gnu.org; Thu, 04 Oct 2018 19:58:15 -0400 Received: by mail-it1-x12b.google.com with SMTP id l127-v6so3146016ith.1 for ; Thu, 04 Oct 2018 16:58:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version; bh=ERrk1mjpDKfGhF2pE2tgfFLtyM/2SMxH6A/K4rlfzCE=; b=mOLc/C/gWLyxYGGjABr8z2LgvjzA4K97t5kok3xYqy7/6T/eWLIz+oHS0bjDuNea/r 03Hk/g+MDBVzmrlhKoy2M5DdQD8tISqQS0khpE5u7MpvEXyVoUz45i8GADWsPWq8P1Im sEFMg9zgQV95gZ+T+0Z6zqY0Q8Brm2txndgFMzkwYQMHuD8gRTpwKyJQtTLwb1HQjEIy NoHVVV5oiOlMEJfUyaBcfCf+//a0aMUZlAyiO1ux99tRVs02UcImMG45IsvOVbCJ0D1X p1RYfxGutPH/0rvh72bWyh3Yavknv+kz8ggiktmgv75m7h46O0uI0PenIYDPKObT/dDg 517Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version; bh=ERrk1mjpDKfGhF2pE2tgfFLtyM/2SMxH6A/K4rlfzCE=; b=i1c/3lEMGl6CMZynEjkzWfUkov2eO4CINBX/LZh6P1zwJEQxncbsYGLsMP9kzkKOl1 6UZ1DdlmusCG03Oc+ANLaw4kaJy+R3+v4QoAyIgp6VUwt2b/CWbpqFWjykUlfdQ76td9 BF4FPcGDWoMCvpYNUO6QMCp5wDuH67q6XdyulFlWno04TAYTnxD6ej9OSIzogUvycEOP 1YMgSEJ5qvbmmZoe4mVrvv+IN9Vfv24jmoDZrNi2vfY8hGB4pEDMXwexqllwUGLHa1ap shtgJh23hPE4HZ6ZH6p+zU6pDAfm8rLJXufgWgqHyixYJFSQyTMuF5aK6Lf/Po7aOxNT CwzQ== X-Gm-Message-State: ABuFfogU7NF8RYYiR36mofW59UhQvmRbXGsUa5wB4WyB1wM2eXrKnKfI bHDkvqfYt/WmxYDSM4RoJlNC6q5u X-Google-Smtp-Source: ACcGV63+y0KISuapSMwm09wdequn6XFirqY2pT4v58I62jxqTREw0ncV03Dfn0EzIhRaztb4RgphVw== X-Received: by 2002:a24:7cc6:: with SMTP id a189-v6mr6238972itd.42.1538697493465; Thu, 04 Oct 2018 16:58:13 -0700 (PDT) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id m23-v6sm1983941ioj.46.2018.10.04.16.58.11 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Oct 2018 16:58:12 -0700 (PDT) From: Noam Postavsky Date: Thu, 04 Oct 2018 19:58:10 -0400 Message-ID: <87lg7dmfhp.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= Content-Type: text/plain Severity: wishlist As a followup from [1], here is a patchset which replaces the master's current rejection of confusable quotes on `read', and instead adds a hint to the error message when evaluating an expression with a confusable quote leads to an error. And also highlight such quotes with warning-face. [1]: https://lists.gnu.org/archive/html/emacs-devel/2018-02/msg00093.html --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=v1-0001-Stop-signaling-an-error-when-reading-smart-quotes.patch Content-Transfer-Encoding: quoted-printable Content-Description: patch >From 330f6072c3dc614936199f1775679328c5452416 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 10 Mar 2018 18:20:45 -0500 Subject: [PATCH v1 1/2] Stop signaling an error when reading "smart quotes"= in symbols Revert commits from 2018-01-28 "Fix round tripping of read->print for symbols with strange quotes", and 2017-07-22 "Signal error for symbol names with strange quotes (Bug#2967)". * etc/NEWS: Remove corresponding entries. * src/character.c (confusable_symbol_character_p): * test/src/lread-tests.el (lread-tests--old-style-backquotes): Remove. * src/lread.c (read1): Don't signal error on confusable character. * src/print.c (print_object): Don't escape confusable characters. --- etc/NEWS | 9 --------- src/character.c | 26 -------------------------- src/character.h | 2 -- src/lread.c | 7 ------- src/print.c | 3 +-- test/src/lread-tests.el | 17 ----------------- 6 files changed, 1 insertion(+), 63 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index daacf49e62..1ca4956c96 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1073,15 +1073,6 @@ and if the new behavior breaks your code please email 32252@debbugs.gnu.org. Because %o and %x can now format signed integers, they now support the + and space flags. =20 -** To avoid confusion caused by "smart quotes", the reader signals an -error when reading Lisp symbols which begin with one of the following -quotation characters: =E2=80=98=E2=80=99=E2=80=9B=E2=80=9C=E2=80=9D=E2=80= =9F=E3=80=9E=EF=BC=82=EF=BC=87. A symbol beginning with such a -character can be written by escaping the quotation character with a -backslash. For example: - - (read "=E2=80=98smart") =3D> (invalid-read-syntax "strange quote" "=E2= =80=98") - (read "\\=E2=80=98smart") =3D=3D (intern "=E2=80=98smart") - +++ ** Omitting variables after '&optional' and '&rest' is now allowed. For example (defun foo (&optional)) is no longer an error. This is diff --git a/src/character.c b/src/character.c index 0b14e476c1..edaeca0a35 100644 --- a/src/character.c +++ b/src/character.c @@ -1056,32 +1056,6 @@ blankp (int c) return XFIXNUM (category) =3D=3D UNICODE_CATEGORY_Zs; /* separator, spac= e */ } =20 - -/* Return true for characters that would read as symbol characters, - but graphically may be confused with some kind of punctuation. We - require an escaping backslash, when such characters begin a - symbol. */ -bool -confusable_symbol_character_p (int ch) -{ - switch (ch) - { - case 0x2018: /* LEFT SINGLE QUOTATION MARK */ - case 0x2019: /* RIGHT SINGLE QUOTATION MARK */ - case 0x201B: /* SINGLE HIGH-REVERSED-9 QUOTATION MARK */ - case 0x201C: /* LEFT DOUBLE QUOTATION MARK */ - case 0x201D: /* RIGHT DOUBLE QUOTATION MARK */ - case 0x201F: /* DOUBLE HIGH-REVERSED-9 QUOTATION MARK */ - case 0x301E: /* DOUBLE PRIME QUOTATION MARK */ - case 0xFF02: /* FULLWIDTH QUOTATION MARK */ - case 0xFF07: /* FULLWIDTH APOSTROPHE */ - return true; - - default: - return false; - } -} - signed char HEXDIGIT_CONST hexdigit[UCHAR_MAX + 1] =3D { #if HEXDIGIT_IS_CONST diff --git a/src/character.h b/src/character.h index 5dff85aed4..6d5349e07d 100644 --- a/src/character.h +++ b/src/character.h @@ -683,8 +683,6 @@ char_surrogate_p (int c) extern bool printablep (int); extern bool blankp (int); =20 -extern bool confusable_symbol_character_p (int ch); - /* Return a translation table of id number ID. */ #define GET_TRANSLATION_TABLE(id) \ (XCDR (XVECTOR (Vtranslation_table_vector)->contents[(id)])) diff --git a/src/lread.c b/src/lread.c index 73e38d8995..fa3b38c312 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3539,13 +3539,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first= _in_list) if (! NILP (result)) return unbind_to (count, result); } - if (!quoted && multibyte) - { - int ch =3D STRING_CHAR ((unsigned char *) read_buffer); - if (confusable_symbol_character_p (ch)) - xsignal2 (Qinvalid_read_syntax, build_string ("strange quote= "), - CALLN (Fstring, make_fixnum (ch))); - } { Lisp_Object result; ptrdiff_t nbytes =3D p - read_buffer; diff --git a/src/print.c b/src/print.c index c0c90bc7e9..c112d806cc 100644 --- a/src/print.c +++ b/src/print.c @@ -2049,8 +2049,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharf= un, bool escapeflag) || c =3D=3D ';' || c =3D=3D '#' || c =3D=3D '(' || c =3D=3D ')' || c =3D=3D ',' || c =3D=3D '.' || c =3D=3D '`' || c =3D=3D '[' || c =3D=3D ']' || c =3D=3D '?' || c <=3D 040 - || confusing - || (i =3D=3D 1 && confusable_symbol_character_p (c))) + || confusing) { printchar ('\\', printcharfun); confusing =3D false; diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index f19d98320a..0d7cd962bd 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -142,23 +142,6 @@ lread-tests--last-message "unescaped character literals " "`?\"', `?(', `?)', `?;', `?[', `?]' detected!"= ))))) =20 -(ert-deftest lread-tests--funny-quote-symbols () - "Check that 'smart quotes' or similar trigger errors in symbol names." - (dolist (quote-char - '(#x2018 ;; LEFT SINGLE QUOTATION MARK - #x2019 ;; RIGHT SINGLE QUOTATION MARK - #x201B ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK - #x201C ;; LEFT DOUBLE QUOTATION MARK - #x201D ;; RIGHT DOUBLE QUOTATION MARK - #x201F ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK - #x301E ;; DOUBLE PRIME QUOTATION MARK - #xFF02 ;; FULLWIDTH QUOTATION MARK - #xFF07 ;; FULLWIDTH APOSTROPHE - )) - (let ((str (format "%cfoo" quote-char))) - (should-error (read str) :type 'invalid-read-syntax) - (should (eq (read (concat "\\" str)) (intern str)))))) - (ert-deftest lread-test-bug26837 () "Test for https://debbugs.gnu.org/26837 ." (let ((load-path (cons --=20 2.11.0 --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=v1-0002-Give-suggestions-on-errors-about-var-names-with-c.patch Content-Description: patch >From d45f4f8aafb3caaf411d8bb5e434f42bc2d5f56a Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 10 Mar 2018 18:12:55 -0500 Subject: [PATCH v1 2/2] Give suggestions on errors about var names with confusable chars Add some hints to the message for byte compiler 'free variable' warnings and 'void-variable' errors where the variable has confusable characters in it. * lisp/help.el (uni-confusables), uni-confusables-regexp): New constants. (help-command-error-confusable-suggestions): New function, added to `command-error-function'. (help-uni-confusable-suggestions): New function. * lisp/emacs-lisp/bytecomp.el (byte-compile-variable-ref): Use it. * lisp/emacs-lisp/lisp-mode.el (lisp--match-confusable-symbol-character): New function. (lisp-fdefs): Use it to fontify confusable characters with font-lock-warning-face when they occur in symbol names. --- lisp/emacs-lisp/bytecomp.el | 10 +++++++-- lisp/emacs-lisp/lisp-mode.el | 16 ++++++++++++++- lisp/help.el | 48 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 8b67e1007d..31d589ab02 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3407,7 +3407,10 @@ byte-compile-variable-ref (boundp var) (memq var byte-compile-bound-variables) (memq var byte-compile-free-references)) - (byte-compile-warn "reference to free variable `%S'" var) + (let* ((varname (prin1-to-string var)) + (suggestions (help-uni-confusable-suggestions varname))) + (byte-compile-warn "reference to free variable `%s'%s" varname + (if suggestions (concat "\n " suggestions) ""))) (push var byte-compile-free-references)) (byte-compile-dynamic-variable-op 'byte-varref var)))) @@ -3423,7 +3426,10 @@ byte-compile-variable-set (boundp var) (memq var byte-compile-bound-variables) (memq var byte-compile-free-assignments)) - (byte-compile-warn "assignment to free variable `%s'" var) + (let* ((varname (prin1-to-string var)) + (suggestions (help-uni-confusable-suggestions varname))) + (byte-compile-warn "assignment to free variable `%s'%s" varname + (if suggestions (concat "\n " suggestions) ""))) (push var byte-compile-free-assignments)) (byte-compile-dynamic-variable-op 'byte-varset var)))) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index f31b4d4dd2..87bdafa976 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -280,6 +280,17 @@ elisp--font-lock-backslash `(face ,font-lock-warning-face help-echo "This \\ has no effect")))) +(defun lisp--match-confusable-symbol-character (limit) + ;; Match a confusable character within a Lisp symbol. + (catch 'matched + (while t + (if (not (re-search-forward uni-confusables-regexp limit t)) + (throw 'matched nil) + ;; Skip confusables inside strings or comments. + (save-match-data + (if (not (nth 8 (syntax-ppss))) + (throw 'matched t))))))) + (let-when-compile ((lisp-fdefs '("defmacro" "defun")) (lisp-vdefs '("defvar")) @@ -463,7 +474,10 @@ elisp--font-lock-backslash (3 'font-lock-regexp-grouping-construct prepend)) (lisp--match-hidden-arg (0 '(face font-lock-warning-face - help-echo "Hidden behind deeper element; move to another line?"))) + help-echo "Hidden behind deeper element; move to another line?"))) + (lisp--match-confusable-symbol-character + 0 '(face font-lock-warning-face + help-echo "Confusable character")) )) "Gaudy level highlighting for Emacs Lisp mode.") diff --git a/lisp/help.el b/lisp/help.el index 6e06fc9e1c..66d191f863 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1489,6 +1489,54 @@ help--make-usage-docstring (help--docstring-quote (format "%S" (help--make-usage fn arglist))))) + +;; Just some quote-like characters for now. TODO: generate this stuff +;; from official Unicode data. +(defconst uni-confusables + '((#x2018 . "'") ;; LEFT SINGLE QUOTATION MARK + (#x2019 . "'") ;; RIGHT SINGLE QUOTATION MARK + (#x201B . "'") ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK + (#x201C . "\"") ;; LEFT DOUBLE QUOTATION MARK + (#x201D . "\"") ;; RIGHT DOUBLE QUOTATION MARK + (#x201F . "\"") ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK + (#x301E . "\"") ;; DOUBLE PRIME QUOTATION MARK + (#xFF02 . "'") ;; FULLWIDTH QUOTATION MARK + (#xFF07 . "'") ;; FULLWIDTH APOSTROPHE + )) + +(defconst uni-confusables-regexp + (concat "[" (mapcar #'car uni-confusables) "]")) + +(defun help-uni-confusable-suggestions (string) + "Return a message describing confusables in STRING." + (let ((i 0) + (confusables nil)) + (while (setq i (string-match uni-confusables-regexp string i)) + (let ((replacement (alist-get (aref string i) uni-confusables))) + (push (aref string i) confusables) + (setq string (replace-match replacement t t string)) + (setq i (+ i (length replacement))))) + (when confusables + (format-message + (if (> (length confusables) 1) + "Found confusable characters: %s; perhaps you meant: `%s'?" + "Found confusable character: %s, perhaps you meant: `%s'?") + (mapconcat (lambda (c) (format-message "`%c'" c)) + confusables ", ") + string)))) + +(defun help-command-error-confusable-suggestions (data _context _signal) + (pcase data + (`(void-variable ,var) + (princ (concat "\n " (help-uni-confusable-suggestions + (symbol-name var))) + t)) + (_ nil))) + +(add-function :after command-error-function + #'help-command-error-confusable-suggestions) + + (provide 'help) ;;; help.el ends here -- 2.11.0 --=-=-=-- From unknown Tue Jun 17 01:40:06 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32939: 27.0.50; Don't reject confusable quotes, just fontify & mention them in error messages Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Oct 2018 08:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32939 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Noam Postavsky Cc: 32939@debbugs.gnu.org Received: via spool by 32939-submit@debbugs.gnu.org id=B32939.153872911613995 (code B ref 32939); Fri, 05 Oct 2018 08:46:02 +0000 Received: (at 32939) by debbugs.gnu.org; 5 Oct 2018 08:45:16 +0000 Received: from localhost ([127.0.0.1]:37386 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g8LjY-0003df-FF for submit@debbugs.gnu.org; Fri, 05 Oct 2018 04:45:16 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56205) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g8LjX-0003dT-6J for 32939@debbugs.gnu.org; Fri, 05 Oct 2018 04:45:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g8LjO-00046F-Pc for 32939@debbugs.gnu.org; Fri, 05 Oct 2018 04:45:09 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:38367) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8LjO-000467-M5; Fri, 05 Oct 2018 04:45:06 -0400 Received: from [176.228.60.248] (port=2713 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1g8LjO-0001JB-8r; Fri, 05 Oct 2018 04:45:06 -0400 Date: Fri, 05 Oct 2018 11:44:52 +0300 Message-Id: <83woqw235n.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <87lg7dmfhp.fsf@gmail.com> (message from Noam Postavsky on Thu, 04 Oct 2018 19:58:10 -0400) References: <87lg7dmfhp.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Noam Postavsky > Date: Thu, 04 Oct 2018 19:58:10 -0400 > > As a followup from [1], here is a patchset which replaces the master's > current rejection of confusable quotes on `read', and instead adds a > hint to the error message when evaluating an expression with a > confusable quote leads to an error. > > And also highlight such quotes with warning-face. Thanks. If this is accepted, it will need documentation changes, including NEWS. From unknown Tue Jun 17 01:40:06 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32939: 27.0.50; Don't reject confusable quotes, just fontify & mention them in error messages Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 24 Oct 2018 22:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32939 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 32939@debbugs.gnu.org Received: via spool by 32939-submit@debbugs.gnu.org id=B32939.154041996431276 (code B ref 32939); Wed, 24 Oct 2018 22:27:02 +0000 Received: (at 32939) by debbugs.gnu.org; 24 Oct 2018 22:26:04 +0000 Received: from localhost ([127.0.0.1]:40965 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFRbH-00088O-K3 for submit@debbugs.gnu.org; Wed, 24 Oct 2018 18:26:04 -0400 Received: from mail-it1-f173.google.com ([209.85.166.173]:34855) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gFRbF-00087t-LY for 32939@debbugs.gnu.org; Wed, 24 Oct 2018 18:26:02 -0400 Received: by mail-it1-f173.google.com with SMTP id p64-v6so8684890itp.0 for <32939@debbugs.gnu.org>; Wed, 24 Oct 2018 15:26:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=GrIonLn0QztRWZk93/kRwuYzmNCL/NOeU8LXvARTYqs=; b=PgSf3LMG/3XZID4UV37ksRlNhl7L/m4DkDIwBgutDY23ddwuK1s+ZITKaGmq4z8dOw 9I1uWQzKqJWz9LprBGq5VPb5ognsj8SorWB1Va7ny66Cc6xa7HxKrllX0xQXE2H5l1LP WW60JVO7D5g95rR4gougzD/OjReaaiQ9dFdkrvJ803h9eHWOBo9kPuHxdQK3h4b3F92o sDmpjVtakWklZzGxPbpLfBhS/htdlde5I/m/DfLsHTj04te4o1Z64BFshV75qbMQdmxi vKTMdsQkI1q/1exco6JU9HXkiqU8lyuQ+8wnY8LDCcr66Hep6s0HcVeHa9lYO/gODhZb HQ0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=GrIonLn0QztRWZk93/kRwuYzmNCL/NOeU8LXvARTYqs=; b=DCrgC1de7cvHQPS0Rhlr8BUygsbnECyIwotmyJvkfuRFweVOF6aPkTV8nJgQDsd3pp tw/WQwwSrfAkTFVidPjLHmEAT1IM0p+gFhqrhXAbZql0I7gv2UKpXIEyE+D228m6IRkd k6K2mqejzc6wRw/60rB89pTrrVM1wvRpeemPyfO7cMzPfcIiJ45y/7STqQ7Rz/RKIZ9S F6IDRoi9ffLRdXEnNrIoUfHKy/NN/xQVh820vj9FpqtjHQM1R0tx1/fhIYex3JX1LVyA 5FUNUFXqDvwHMeVk0fcr60Gzx+7pk/OzfZenh4ZKJXI430y4WFP0po1LSdm3VXUsWfuB 6IMA== X-Gm-Message-State: AGRZ1gJaEMkVyXHwKo6MvplJhhAikX8OxAwviSUnvAyZZNoNJIkvD1CE 6y/67NxnPaE3POKn9DETXpSzPu7q X-Google-Smtp-Source: AJdET5cEjG14uv6xB5JZCK1vgLFWpFzS0905Awq5BiDoq+cuOXQkl6VQz0Z980l37GHlzDZeUUKHsA== X-Received: by 2002:a02:15d3:: with SMTP id 80-v6mr3371434jaq.116.1540419955859; Wed, 24 Oct 2018 15:25:55 -0700 (PDT) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id i9-v6sm2111843ioj.9.2018.10.24.15.25.54 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 24 Oct 2018 15:25:54 -0700 (PDT) From: Noam Postavsky References: <87lg7dmfhp.fsf@gmail.com> <83woqw235n.fsf@gnu.org> Date: Wed, 24 Oct 2018 18:25:53 -0400 In-Reply-To: <83woqw235n.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 05 Oct 2018 11:44:52 +0300") Message-ID: <877ei7m172.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: >> From: Noam Postavsky >> Date: Thu, 04 Oct 2018 19:58:10 -0400 >> >> As a followup from [1], here is a patchset which replaces the master's >> current rejection of confusable quotes on `read', and instead adds a >> hint to the error message when evaluating an expression with a >> confusable quote leads to an error. >> >> And also highlight such quotes with warning-face. > > Thanks. If this is accepted, it will need documentation changes, > including NEWS. I adjusted the first patch so it applies cleanly to more recent master, and added a NEWS entry for the fontification. I'm not sure about what other documentation we need though. --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=v2-0001-Stop-signaling-an-error-when-reading-smart-quotes.patch Content-Transfer-Encoding: quoted-printable Content-Description: patch >From 6d3b86eb41660d8908646d8461a7afff03fd17b7 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 10 Mar 2018 18:20:45 -0500 Subject: [PATCH v2 1/2] Stop signaling an error when reading "smart quotes"= in symbols Revert commits from 2018-01-28 "Fix round tripping of read->print for symbols with strange quotes", and 2017-07-22 "Signal error for symbol names with strange quotes (Bug#2967)". * etc/NEWS: Remove corresponding entries. * src/character.c (confusable_symbol_character_p): * test/src/lread-tests.el (lread-tests--old-style-backquotes): Remove. * src/lread.c (read1): Don't signal error on confusable character. * src/print.c (print_object): Don't escape confusable characters. --- etc/NEWS | 9 --------- src/character.c | 26 -------------------------- src/character.h | 2 -- src/lread.c | 7 ------- src/print.c | 3 +-- test/src/lread-tests.el | 17 ----------------- 6 files changed, 1 insertion(+), 63 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 946a823173..8bed92430b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1089,15 +1089,6 @@ and if the new behavior breaks your code please email 32252@debbugs.gnu.org. Because %o and %x can now format signed integers, they now support the + and space flags. =20 -** To avoid confusion caused by "smart quotes", the reader signals an -error when reading Lisp symbols which begin with one of the following -quotation characters: =E2=80=98=E2=80=99=E2=80=9B=E2=80=9C=E2=80=9D=E2=80= =9F=E3=80=9E=EF=BC=82=EF=BC=87. A symbol beginning with such a -character can be written by escaping the quotation character with a -backslash. For example: - - (read "=E2=80=98smart") =3D> (invalid-read-syntax "strange quote" "=E2= =80=98") - (read "\\=E2=80=98smart") =3D=3D (intern "=E2=80=98smart") - +++ ** Omitting variables after '&optional' and '&rest' is now allowed. For example (defun foo (&optional)) is no longer an error. This is diff --git a/src/character.c b/src/character.c index 0b14e476c1..edaeca0a35 100644 --- a/src/character.c +++ b/src/character.c @@ -1056,32 +1056,6 @@ blankp (int c) return XFIXNUM (category) =3D=3D UNICODE_CATEGORY_Zs; /* separator, spac= e */ } =20 - -/* Return true for characters that would read as symbol characters, - but graphically may be confused with some kind of punctuation. We - require an escaping backslash, when such characters begin a - symbol. */ -bool -confusable_symbol_character_p (int ch) -{ - switch (ch) - { - case 0x2018: /* LEFT SINGLE QUOTATION MARK */ - case 0x2019: /* RIGHT SINGLE QUOTATION MARK */ - case 0x201B: /* SINGLE HIGH-REVERSED-9 QUOTATION MARK */ - case 0x201C: /* LEFT DOUBLE QUOTATION MARK */ - case 0x201D: /* RIGHT DOUBLE QUOTATION MARK */ - case 0x201F: /* DOUBLE HIGH-REVERSED-9 QUOTATION MARK */ - case 0x301E: /* DOUBLE PRIME QUOTATION MARK */ - case 0xFF02: /* FULLWIDTH QUOTATION MARK */ - case 0xFF07: /* FULLWIDTH APOSTROPHE */ - return true; - - default: - return false; - } -} - signed char HEXDIGIT_CONST hexdigit[UCHAR_MAX + 1] =3D { #if HEXDIGIT_IS_CONST diff --git a/src/character.h b/src/character.h index 5dff85aed4..6d5349e07d 100644 --- a/src/character.h +++ b/src/character.h @@ -683,8 +683,6 @@ char_surrogate_p (int c) extern bool printablep (int); extern bool blankp (int); =20 -extern bool confusable_symbol_character_p (int ch); - /* Return a translation table of id number ID. */ #define GET_TRANSLATION_TABLE(id) \ (XCDR (XVECTOR (Vtranslation_table_vector)->contents[(id)])) diff --git a/src/lread.c b/src/lread.c index 62616cb681..bf06b41caa 100644 --- a/src/lread.c +++ b/src/lread.c @@ -3543,13 +3543,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first= _in_list) if (! NILP (result) && len =3D=3D nbytes) return unbind_to (count, result); } - if (!quoted && multibyte) - { - int ch =3D STRING_CHAR ((unsigned char *) read_buffer); - if (confusable_symbol_character_p (ch)) - xsignal2 (Qinvalid_read_syntax, build_string ("strange quote= "), - CALLN (Fstring, make_fixnum (ch))); - } { Lisp_Object result; ptrdiff_t nchars diff --git a/src/print.c b/src/print.c index d15ff97b00..3a19bd5e31 100644 --- a/src/print.c +++ b/src/print.c @@ -2030,8 +2030,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharf= un, bool escapeflag) || c =3D=3D ',' || c =3D=3D '.' || c =3D=3D '`' || c =3D=3D '[' || c =3D=3D ']' || c =3D=3D '?' || c <=3D 040 || c =3D=3D NO_BREAK_SPACE - || confusing - || (i =3D=3D 1 && confusable_symbol_character_p (c))) + || confusing) { printchar ('\\', printcharfun); confusing =3D false; diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index f19d98320a..0d7cd962bd 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -142,23 +142,6 @@ lread-tests--last-message "unescaped character literals " "`?\"', `?(', `?)', `?;', `?[', `?]' detected!"= ))))) =20 -(ert-deftest lread-tests--funny-quote-symbols () - "Check that 'smart quotes' or similar trigger errors in symbol names." - (dolist (quote-char - '(#x2018 ;; LEFT SINGLE QUOTATION MARK - #x2019 ;; RIGHT SINGLE QUOTATION MARK - #x201B ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK - #x201C ;; LEFT DOUBLE QUOTATION MARK - #x201D ;; RIGHT DOUBLE QUOTATION MARK - #x201F ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK - #x301E ;; DOUBLE PRIME QUOTATION MARK - #xFF02 ;; FULLWIDTH QUOTATION MARK - #xFF07 ;; FULLWIDTH APOSTROPHE - )) - (let ((str (format "%cfoo" quote-char))) - (should-error (read str) :type 'invalid-read-syntax) - (should (eq (read (concat "\\" str)) (intern str)))))) - (ert-deftest lread-test-bug26837 () "Test for https://debbugs.gnu.org/26837 ." (let ((load-path (cons --=20 2.11.0 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=v2-0002-Improve-errors-warnings-due-to-fancy-quoted-vars-.patch Content-Transfer-Encoding: quoted-printable Content-Description: patch >From acb2e416688dd3612225aa593c264f37edb5ba9f Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 10 Mar 2018 18:12:55 -0500 Subject: [PATCH v2 2/2] Improve errors & warnings due to fancy quoted vars (Bug#32939) Add some hints to the message for byte compiler free & unused variable warnings, and 'void-variable' errors where the variable has confusable quote characters in it. * lisp/help.el (uni-confusables), uni-confusables-regexp): New constants. (help-command-error-confusable-suggestions): New function, added to `command-error-function'. (help-uni-confusable-suggestions): New function. * lisp/emacs-lisp/bytecomp.el (byte-compile-variable-ref): * lisp/emacs-lisp/cconv.el (cconv--analyze-use): Use it. * lisp/emacs-lisp/lisp-mode.el (lisp--match-confusable-symbol-character): New function. (lisp-fdefs): Use it to fontify confusable characters with font-lock-warning-face when they occur in symbol names. * etc/NEWS: Announce the new fontification behavior. --- etc/NEWS | 4 ++++ lisp/emacs-lisp/bytecomp.el | 10 +++++++-- lisp/emacs-lisp/cconv.el | 6 ++++-- lisp/emacs-lisp/lisp-mode.el | 16 ++++++++++++++- lisp/help.el | 49 ++++++++++++++++++++++++++++++++++++++++= ++++ 5 files changed, 80 insertions(+), 5 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index 8bed92430b..3f86195695 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1089,6 +1089,10 @@ and if the new behavior breaks your code please email 32252@debbugs.gnu.org. Because %o and %x can now format signed integers, they now support the + and space flags. =20 +** In Emacs Lisp mode, symbols with confusable quotes are highlighted. +For example, the first character in '=E2=80=98foo' would be highlighted in +'font-lock-warning-face'. + +++ ** Omitting variables after '&optional' and '&rest' is now allowed. For example (defun foo (&optional)) is no longer an error. This is diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 8b67e1007d..31d589ab02 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3407,7 +3407,10 @@ byte-compile-variable-ref (boundp var) (memq var byte-compile-bound-variables) (memq var byte-compile-free-references)) - (byte-compile-warn "reference to free variable `%S'" var) + (let* ((varname (prin1-to-string var)) + (suggestions (help-uni-confusable-suggestions varname))) + (byte-compile-warn "reference to free variable `%s'%s" varname + (if suggestions (concat "\n " suggestions) "= "))) (push var byte-compile-free-references)) (byte-compile-dynamic-variable-op 'byte-varref var)))) =20 @@ -3423,7 +3426,10 @@ byte-compile-variable-set (boundp var) (memq var byte-compile-bound-variables) (memq var byte-compile-free-assignments)) - (byte-compile-warn "assignment to free variable `%s'" var) + (let* ((varname (prin1-to-string var)) + (suggestions (help-uni-confusable-suggestions varname))) + (byte-compile-warn "assignment to free variable `%s'%s" varname + (if suggestions (concat "\n " suggestions) "= "))) (push var byte-compile-free-assignments)) (byte-compile-dynamic-variable-op 'byte-varset var)))) =20 diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index 010026b416..b62c69868b 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -591,8 +591,10 @@ cconv--analyze-use (eq ?_ (aref (symbol-name var) 0)) ;; As a special exception, ignore "ignore". (eq var 'ignored)) - (byte-compile-warn "Unused lexical %s `%S'" - varkind var))) + (let ((suggestions (help-uni-confusable-suggestions (symbol-name va= r)))) + (byte-compile-warn "Unused lexical %s `%S'%s" + varkind var + (if suggestions (concat "\n " suggestions) ""= ))))) ;; If it's unused, there's no point converting it into a cons-cell, ev= en if ;; it's captured and mutated. (`(,binder ,_ t t ,_) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index f31b4d4dd2..87bdafa976 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -280,6 +280,17 @@ elisp--font-lock-backslash `(face ,font-lock-warning-face help-echo "This \\ has no effect")))) =20 +(defun lisp--match-confusable-symbol-character (limit) + ;; Match a confusable character within a Lisp symbol. + (catch 'matched + (while t + (if (not (re-search-forward uni-confusables-regexp limit t)) + (throw 'matched nil) + ;; Skip confusables inside strings or comments. + (save-match-data + (if (not (nth 8 (syntax-ppss))) + (throw 'matched t))))))) + (let-when-compile ((lisp-fdefs '("defmacro" "defun")) (lisp-vdefs '("defvar")) @@ -463,7 +474,10 @@ elisp--font-lock-backslash (3 'font-lock-regexp-grouping-construct prepend)) (lisp--match-hidden-arg (0 '(face font-lock-warning-face - help-echo "Hidden behind deeper element; move to another li= ne?"))) + help-echo "Hidden behind deeper element; move to anoth= er line?"))) + (lisp--match-confusable-symbol-character + 0 '(face font-lock-warning-face + help-echo "Confusable character")) )) "Gaudy level highlighting for Emacs Lisp mode.") =20 diff --git a/lisp/help.el b/lisp/help.el index 6e06fc9e1c..2cc28fca24 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1489,6 +1489,55 @@ help--make-usage-docstring (help--docstring-quote (format "%S" (help--make-usage fn arglist))))) =20 + +;; Just some quote-like characters for now. TODO: generate this stuff +;; from official Unicode data. +(defconst uni-confusables + '((#x2018 . "'") ;; LEFT SINGLE QUOTATION MARK + (#x2019 . "'") ;; RIGHT SINGLE QUOTATION MARK + (#x201B . "'") ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK + (#x201C . "\"") ;; LEFT DOUBLE QUOTATION MARK + (#x201D . "\"") ;; RIGHT DOUBLE QUOTATION MARK + (#x201F . "\"") ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK + (#x301E . "\"") ;; DOUBLE PRIME QUOTATION MARK + (#xFF02 . "'") ;; FULLWIDTH QUOTATION MARK + (#xFF07 . "'") ;; FULLWIDTH APOSTROPHE + )) + +(defconst uni-confusables-regexp + (concat "[" (mapcar #'car uni-confusables) "]")) + +(defun help-uni-confusable-suggestions (string) + "Return a message describing confusables in STRING." + (let ((i 0) + (confusables nil)) + (while (setq i (string-match uni-confusables-regexp string i)) + (let ((replacement (alist-get (aref string i) uni-confusables))) + (push (aref string i) confusables) + (setq string (replace-match replacement t t string)) + (setq i (+ i (length replacement))))) + (when confusables + (format-message + (if (> (length confusables) 1) + "Found confusable characters: %s; perhaps you meant: `%s'?" + "Found confusable character: %s, perhaps you meant: `%s'?") + (mapconcat (lambda (c) (format-message "`%c'" c)) + confusables ", ") + string)))) + +(defun help-command-error-confusable-suggestions (data _context _signal) + (pcase data + (`(void-variable ,var) + (let ((suggestions (help-uni-confusable-suggestions + (symbol-name var)))) + (when suggestions + (princ (concat "\n " suggestions) t)))) + (_ nil))) + +(add-function :after command-error-function + #'help-command-error-confusable-suggestions) + + (provide 'help) =20 ;;; help.el ends here --=20 2.11.0 --=-=-=-- From unknown Tue Jun 17 01:40:06 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32939: 27.0.50; Don't reject confusable quotes, just fontify & mention them in error messages Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 27 Oct 2018 09:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32939 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Noam Postavsky Cc: 32939@debbugs.gnu.org Received: via spool by 32939-submit@debbugs.gnu.org id=B32939.154063373731708 (code B ref 32939); Sat, 27 Oct 2018 09:49:02 +0000 Received: (at 32939) by debbugs.gnu.org; 27 Oct 2018 09:48:57 +0000 Received: from localhost ([127.0.0.1]:44577 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGLDE-0008FM-U7 for submit@debbugs.gnu.org; Sat, 27 Oct 2018 05:48:57 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39894) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gGLDC-0008F6-L6 for 32939@debbugs.gnu.org; Sat, 27 Oct 2018 05:48:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gGLD3-0005Dc-BS for 32939@debbugs.gnu.org; Sat, 27 Oct 2018 05:48:49 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:53612) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gGLD3-0005DV-6R; Sat, 27 Oct 2018 05:48:45 -0400 Received: from [176.228.60.248] (port=3534 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gGLD2-0006fK-Bn; Sat, 27 Oct 2018 05:48:45 -0400 Date: Sat, 27 Oct 2018 12:48:47 +0300 Message-Id: <838t2joh34.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <877ei7m172.fsf@gmail.com> (message from Noam Postavsky on Wed, 24 Oct 2018 18:25:53 -0400) References: <87lg7dmfhp.fsf@gmail.com> <83woqw235n.fsf@gnu.org> <877ei7m172.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Noam Postavsky > Cc: 32939@debbugs.gnu.org > Date: Wed, 24 Oct 2018 18:25:53 -0400 > > >> As a followup from [1], here is a patchset which replaces the master's > >> current rejection of confusable quotes on `read', and instead adds a > >> hint to the error message when evaluating an expression with a > >> confusable quote leads to an error. > >> > >> And also highlight such quotes with warning-face. > > > > Thanks. If this is accepted, it will need documentation changes, > > including NEWS. > > I adjusted the first patch so it applies cleanly to more recent master, > and added a NEWS entry for the fontification. I'm not sure about what > other documentation we need though. I thought the error was documented in the ELisp manual, but I see now that it wasn't. So indeed, no changes besides NEWS seem to be required. However, perhaps we should mention this behavior in "Basic Char Syntax" and the related use of this face in "Faces for Font Lock". WDYT? > -(ert-deftest lread-tests--funny-quote-symbols () > - "Check that 'smart quotes' or similar trigger errors in symbol names." > - (dolist (quote-char > - '(#x2018 ;; LEFT SINGLE QUOTATION MARK > - #x2019 ;; RIGHT SINGLE QUOTATION MARK > - #x201B ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK > - #x201C ;; LEFT DOUBLE QUOTATION MARK > - #x201D ;; RIGHT DOUBLE QUOTATION MARK > - #x201F ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK > - #x301E ;; DOUBLE PRIME QUOTATION MARK > - #xFF02 ;; FULLWIDTH QUOTATION MARK > - #xFF07 ;; FULLWIDTH APOSTROPHE > - )) > - (let ((str (format "%cfoo" quote-char))) > - (should-error (read str) :type 'invalid-read-syntax) > - (should (eq (read (concat "\\" str)) (intern str)))))) > - Should we replace this test by one that tests the fontification? Thanks. From unknown Tue Jun 17 01:40:06 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32939: 27.0.50; Don't reject confusable quotes, just fontify & mention them in error messages Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Oct 2018 01:31:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32939 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 32939@debbugs.gnu.org Received: via spool by 32939-submit@debbugs.gnu.org id=B32939.154086305311950 (code B ref 32939); Tue, 30 Oct 2018 01:31:01 +0000 Received: (at 32939) by debbugs.gnu.org; 30 Oct 2018 01:30:53 +0000 Received: from localhost ([127.0.0.1]:52449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHIrs-000360-Io for submit@debbugs.gnu.org; Mon, 29 Oct 2018 21:30:53 -0400 Received: from mail-it1-f171.google.com ([209.85.166.171]:54408) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHIrq-0002zz-Rr for 32939@debbugs.gnu.org; Mon, 29 Oct 2018 21:30:51 -0400 Received: by mail-it1-f171.google.com with SMTP id d6so6357909itl.4 for <32939@debbugs.gnu.org>; Mon, 29 Oct 2018 18:30:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=NLTc1dTvHWjBjtfxHG2nK8EB/+GHm/Qxr9F3M1QtO0k=; b=VQsc3bzQpzEsIO5tUPvCC3WY34IXPBvoiTlzwA4rNvJAil9MjPDYvs8R1Vm5SXw3mZ AhijKjNUD6OVd+ItIefqD78PeKr54nDs4fcm2zpXts++MV+Y7HN6kf6eSoQX3hqflJGp PJ1W8tryfF6UhAcACEptJfkoDt7730En50Jm0edoHs86EKIEe697qSf2wweDrMsxZdNS Oesrh5gD691CtiAFjmmag44rpgMVRlls1O9Wjq/7VBipuC5oQD2amazfVpK4vWAF2oqs rUiEwFz0qeaWbgsNb+AOODMMHQm8VGYc395ErgU/RXiAFihtZbRK2ccsvEGYni6z7dbQ 7KpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=NLTc1dTvHWjBjtfxHG2nK8EB/+GHm/Qxr9F3M1QtO0k=; b=bDJJRn44uFXkSMtwj8WHoMjzFbUX+sLtrG5kwBziowiFhLMAntl0iN5tkx/AmlYUCT 2X7s0dsE5twgLrxmdWaJrSQUokcVPbcJFQeYWZ86pbJaJa2Jod0FaNWOq2shTllas8sy e/ovC6B5tLnRHX5zmMHnutDOVM45qaAzaFuQOrJnC5Rj7izbqoV03T7BtQ8K/eZwrRKf 2IzJFkWHrWxQstPZPNpsvxLOnRGYZbcti7ADsdsWbPE3JTRqEE6ccrtrrolLvYXIsD5U MUQ9vBRbrgs6dQtexrnl5YXnaHqyrumswkqBPCHixO+FZ+He006b5zswzSSc0ZV05mrS Q0mA== X-Gm-Message-State: AGRZ1gJVNMQcgP0W++BlqZgiKB0tSF6OpumJRzPA8DK4McJRWkZwJAsl NOAGN0Xydzr3O8ph0iMU/Faef3MV X-Google-Smtp-Source: AJdET5c+szGPPdW3wacJk5NYSmX0Opd0fgOt47lOW5M4SIg4pXWbizSB/Ft0J3NssEmOTsgF/tWBiQ== X-Received: by 2002:a24:1351:: with SMTP id 78-v6mr145228itz.42.1540863045110; Mon, 29 Oct 2018 18:30:45 -0700 (PDT) Received: from zebian (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.googlemail.com with ESMTPSA id g8-v6sm2017306iof.11.2018.10.29.18.30.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 29 Oct 2018 18:30:44 -0700 (PDT) From: Noam Postavsky References: <87lg7dmfhp.fsf@gmail.com> <83woqw235n.fsf@gnu.org> <877ei7m172.fsf@gmail.com> <838t2joh34.fsf@gnu.org> Date: Mon, 29 Oct 2018 21:30:43 -0400 In-Reply-To: <838t2joh34.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 27 Oct 2018 12:48:47 +0300") Message-ID: <87woq0i5ks.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain Eli Zaretskii writes: > However, perhaps we should mention this behavior in "Basic Char > Syntax" and the related use of this face in "Faces for Font Lock". > WDYT? I've tried adding some mentions of it in those places (unfilled to simplify diff). Though I'm not sure if it makes sense to talk about this somewhat obscure case. >> -(ert-deftest lread-tests--funny-quote-symbols () > Should we replace this test by one that tests the fontification? Right, good point, added. And I had missed disabling fontification for backslash escaped characters, now fixed. --=-=-= Content-Type: text/plain; charset=utf-8 Content-Disposition: attachment; filename=v3-0002-Improve-errors-warnings-due-to-fancy-quoted-vars-.patch Content-Transfer-Encoding: quoted-printable Content-Description: patch >From b19dbd60af4282ab8dcd1512f6910da6671d8a4a Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Sat, 10 Mar 2018 18:12:55 -0500 Subject: [PATCH v3 2/2] Improve errors & warnings due to fancy quoted vars (Bug#32939) Add some hints to the message for byte compiler free & unused variable warnings, and 'void-variable' errors where the variable has confusable quote characters in it. * lisp/help.el (uni-confusables), uni-confusables-regexp): New constants. (help-command-error-confusable-suggestions): New function, added to `command-error-function'. (help-uni-confusable-suggestions): New function. * lisp/emacs-lisp/bytecomp.el (byte-compile-variable-ref): * lisp/emacs-lisp/cconv.el (cconv--analyze-use): Use it. * lisp/emacs-lisp/lisp-mode.el (lisp--match-confusable-symbol-character): New function. (lisp-fdefs): Use it to fontify confusable characters with font-lock-warning-face when they occur in symbol names. * doc/lispref/modes.texi (Faces for Font Lock): * doc/lispref/objects.texi (Basic Char Syntax): Recommend backslash escaping of confusable characters, and mention new fontification. * etc/NEWS: Announce the new fontification behavior. * test/lisp/emacs-lisp/lisp-mode-tests.el (lisp-fontify-confusables): New test. --- doc/lispref/modes.texi | 3 +- doc/lispref/objects.texi | 7 ++++- etc/NEWS | 4 +++ lisp/emacs-lisp/bytecomp.el | 10 +++++-- lisp/emacs-lisp/cconv.el | 6 ++-- lisp/emacs-lisp/lisp-mode.el | 18 +++++++++++- lisp/help.el | 49 +++++++++++++++++++++++++++++= ++++ test/lisp/emacs-lisp/lisp-mode-tests.el | 24 ++++++++++++++++ 8 files changed, 114 insertions(+), 7 deletions(-) diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi index 49b7e1ea3f..243e535988 100644 --- a/doc/lispref/modes.texi +++ b/doc/lispref/modes.texi @@ -3190,7 +3190,8 @@ Faces for Font Lock @table @code @item font-lock-warning-face @vindex font-lock-warning-face -for a construct that is peculiar, or that greatly changes the meaning of +for a construct that is peculiar (e.g., an unescaped confusable quote +in an Emacs Lisp symbol like @samp{=E2=80=98foo}), or that greatly changes= the meaning of other text, like @samp{;;;###autoload} in Emacs Lisp and @samp{#error} in C. =20 diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index a0940032ee..f82ee7c49a 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -347,7 +347,12 @@ Basic Char Syntax characters. However, you must add a backslash before any of the characters @samp{()[]\;"}, and you should add a backslash before any of the characters @samp{|'`#.,} to avoid confusing the Emacs commands -for editing Lisp code. You can also add a backslash before whitespace +for editing Lisp code. You should also add a backslash before Unicode +characters which resemble the previously mentioned @acronym{ASCII} +ones, to avoid confusing people reading your code. Emacs will +highlight some non-escaped commonly confused characters such as +@samp{=E2=80=98} to encourage this. + You can also add a backslash before whitespace characters such as space, tab, newline and formfeed. However, it is cleaner to use one of the easily readable escape sequences, such as @samp{\t} or @samp{\s}, instead of an actual whitespace character such diff --git a/etc/NEWS b/etc/NEWS index 3530e04467..395169253d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -1089,6 +1089,10 @@ and if the new behavior breaks your code please email 32252@debbugs.gnu.org. Because %o and %x can now format signed integers, they now support the + and space flags. =20 +** In Emacs Lisp mode, symbols with confusable quotes are highlighted. +For example, the first character in '=E2=80=98foo' would be highlighted in +'font-lock-warning-face'. + +++ ** Omitting variables after '&optional' and '&rest' is now allowed. For example (defun foo (&optional)) is no longer an error. This is diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 8b67e1007d..31d589ab02 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -3407,7 +3407,10 @@ byte-compile-variable-ref (boundp var) (memq var byte-compile-bound-variables) (memq var byte-compile-free-references)) - (byte-compile-warn "reference to free variable `%S'" var) + (let* ((varname (prin1-to-string var)) + (suggestions (help-uni-confusable-suggestions varname))) + (byte-compile-warn "reference to free variable `%s'%s" varname + (if suggestions (concat "\n " suggestions) "= "))) (push var byte-compile-free-references)) (byte-compile-dynamic-variable-op 'byte-varref var)))) =20 @@ -3423,7 +3426,10 @@ byte-compile-variable-set (boundp var) (memq var byte-compile-bound-variables) (memq var byte-compile-free-assignments)) - (byte-compile-warn "assignment to free variable `%s'" var) + (let* ((varname (prin1-to-string var)) + (suggestions (help-uni-confusable-suggestions varname))) + (byte-compile-warn "assignment to free variable `%s'%s" varname + (if suggestions (concat "\n " suggestions) "= "))) (push var byte-compile-free-assignments)) (byte-compile-dynamic-variable-op 'byte-varset var)))) =20 diff --git a/lisp/emacs-lisp/cconv.el b/lisp/emacs-lisp/cconv.el index 010026b416..b62c69868b 100644 --- a/lisp/emacs-lisp/cconv.el +++ b/lisp/emacs-lisp/cconv.el @@ -591,8 +591,10 @@ cconv--analyze-use (eq ?_ (aref (symbol-name var) 0)) ;; As a special exception, ignore "ignore". (eq var 'ignored)) - (byte-compile-warn "Unused lexical %s `%S'" - varkind var))) + (let ((suggestions (help-uni-confusable-suggestions (symbol-name va= r)))) + (byte-compile-warn "Unused lexical %s `%S'%s" + varkind var + (if suggestions (concat "\n " suggestions) ""= ))))) ;; If it's unused, there's no point converting it into a cons-cell, ev= en if ;; it's captured and mutated. (`(,binder ,_ t t ,_) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index f31b4d4dd2..619d525309 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -280,6 +280,19 @@ elisp--font-lock-backslash `(face ,font-lock-warning-face help-echo "This \\ has no effect")))) =20 +(defun lisp--match-confusable-symbol-character (limit) + ;; Match a confusable character within a Lisp symbol. + (catch 'matched + (while t + (if (re-search-forward uni-confusables-regexp limit t) + ;; Skip confusables which are backslash escaped, or inside + ;; strings or comments. + (save-match-data + (unless (or (eq (char-before (match-beginning 0)) ?\\) + (nth 8 (syntax-ppss))) + (throw 'matched t))) + (throw 'matched nil))))) + (let-when-compile ((lisp-fdefs '("defmacro" "defun")) (lisp-vdefs '("defvar")) @@ -463,7 +476,10 @@ elisp--font-lock-backslash (3 'font-lock-regexp-grouping-construct prepend)) (lisp--match-hidden-arg (0 '(face font-lock-warning-face - help-echo "Hidden behind deeper element; move to another li= ne?"))) + help-echo "Hidden behind deeper element; move to anoth= er line?"))) + (lisp--match-confusable-symbol-character + 0 '(face font-lock-warning-face + help-echo "Confusable character")) )) "Gaudy level highlighting for Emacs Lisp mode.") =20 diff --git a/lisp/help.el b/lisp/help.el index 6e06fc9e1c..2cc28fca24 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -1489,6 +1489,55 @@ help--make-usage-docstring (help--docstring-quote (format "%S" (help--make-usage fn arglist))))) =20 + +;; Just some quote-like characters for now. TODO: generate this stuff +;; from official Unicode data. +(defconst uni-confusables + '((#x2018 . "'") ;; LEFT SINGLE QUOTATION MARK + (#x2019 . "'") ;; RIGHT SINGLE QUOTATION MARK + (#x201B . "'") ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK + (#x201C . "\"") ;; LEFT DOUBLE QUOTATION MARK + (#x201D . "\"") ;; RIGHT DOUBLE QUOTATION MARK + (#x201F . "\"") ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK + (#x301E . "\"") ;; DOUBLE PRIME QUOTATION MARK + (#xFF02 . "'") ;; FULLWIDTH QUOTATION MARK + (#xFF07 . "'") ;; FULLWIDTH APOSTROPHE + )) + +(defconst uni-confusables-regexp + (concat "[" (mapcar #'car uni-confusables) "]")) + +(defun help-uni-confusable-suggestions (string) + "Return a message describing confusables in STRING." + (let ((i 0) + (confusables nil)) + (while (setq i (string-match uni-confusables-regexp string i)) + (let ((replacement (alist-get (aref string i) uni-confusables))) + (push (aref string i) confusables) + (setq string (replace-match replacement t t string)) + (setq i (+ i (length replacement))))) + (when confusables + (format-message + (if (> (length confusables) 1) + "Found confusable characters: %s; perhaps you meant: `%s'?" + "Found confusable character: %s, perhaps you meant: `%s'?") + (mapconcat (lambda (c) (format-message "`%c'" c)) + confusables ", ") + string)))) + +(defun help-command-error-confusable-suggestions (data _context _signal) + (pcase data + (`(void-variable ,var) + (let ((suggestions (help-uni-confusable-suggestions + (symbol-name var)))) + (when suggestions + (princ (concat "\n " suggestions) t)))) + (_ nil))) + +(add-function :after command-error-function + #'help-command-error-confusable-suggestions) + + (provide 'help) =20 ;;; help.el ends here diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el b/test/lisp/emacs-lisp= /lisp-mode-tests.el index 30f606d381..8339591740 100644 --- a/test/lisp/emacs-lisp/lisp-mode-tests.el +++ b/test/lisp/emacs-lisp/lisp-mode-tests.el @@ -20,6 +20,10 @@ (require 'ert) (require 'cl-lib) (require 'lisp-mode) +(require 'faceup) + + +;;; Indentation =20 (defconst lisp-mode-tests--correctly-indented-sexp "\ \(a @@ -256,7 +260,27 @@ lisp-mode-tests--correctly-indented-sexp (lisp-indent-line) (should (equal (buffer-string) "prompt> foo")))) =20 + +;;; Fontification =20 +(ert-deftest lisp-fontify-confusables () + "Unescaped 'smart quotes' should be fontified in `font-lock-warning-face= '." + (with-temp-buffer + (dolist (ch + '(#x2018 ;; LEFT SINGLE QUOTATION MARK + #x2019 ;; RIGHT SINGLE QUOTATION MARK + #x201B ;; SINGLE HIGH-REVERSED-9 QUOTATION MARK + #x201C ;; LEFT DOUBLE QUOTATION MARK + #x201D ;; RIGHT DOUBLE QUOTATION MARK + #x201F ;; DOUBLE HIGH-REVERSED-9 QUOTATION MARK + #x301E ;; DOUBLE PRIME QUOTATION MARK + #xFF02 ;; FULLWIDTH QUOTATION MARK + #xFF07 ;; FULLWIDTH APOSTROPHE + )) + (insert (format "=C2=ABw:%c=C2=BBfoo \\%cfoo\n" ch ch))) + (let ((faceup (buffer-string))) + (faceup-clean-buffer) + (should (faceup-test-font-lock-buffer 'emacs-lisp-mode faceup))))) =20 (provide 'lisp-mode-tests) ;;; lisp-mode-tests.el ends here --=20 2.11.0 --=-=-=-- From unknown Tue Jun 17 01:40:06 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32939: 27.0.50; Don't reject confusable quotes, just fontify & mention them in error messages Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 30 Oct 2018 07:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32939 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Noam Postavsky Cc: 32939@debbugs.gnu.org Received: via spool by 32939-submit@debbugs.gnu.org id=B32939.15408835809642 (code B ref 32939); Tue, 30 Oct 2018 07:13:02 +0000 Received: (at 32939) by debbugs.gnu.org; 30 Oct 2018 07:13:00 +0000 Received: from localhost ([127.0.0.1]:53154 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHOCy-0002VS-Ii for submit@debbugs.gnu.org; Tue, 30 Oct 2018 03:13:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:36049) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHOCv-0002VC-E0 for 32939@debbugs.gnu.org; Tue, 30 Oct 2018 03:12:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHOCl-0007RR-73 for 32939@debbugs.gnu.org; Tue, 30 Oct 2018 03:12:52 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40 autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:59062) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHOCl-0007R2-1p; Tue, 30 Oct 2018 03:12:47 -0400 Received: from [176.228.60.248] (port=2541 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1gHOCk-0002H7-Jt; Tue, 30 Oct 2018 03:12:46 -0400 Date: Tue, 30 Oct 2018 09:12:58 +0200 Message-Id: <83h8h3lxfp.fsf@gnu.org> From: Eli Zaretskii In-reply-to: <87woq0i5ks.fsf@gmail.com> (message from Noam Postavsky on Mon, 29 Oct 2018 21:30:43 -0400) References: <87lg7dmfhp.fsf@gmail.com> <83woqw235n.fsf@gnu.org> <877ei7m172.fsf@gmail.com> <838t2joh34.fsf@gnu.org> <87woq0i5ks.fsf@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -6.0 (------) > From: Noam Postavsky > Cc: 32939@debbugs.gnu.org > Date: Mon, 29 Oct 2018 21:30:43 -0400 > > > However, perhaps we should mention this behavior in "Basic Char > > Syntax" and the related use of this face in "Faces for Font Lock". > > WDYT? > > I've tried adding some mentions of it in those places (unfilled to > simplify diff). Though I'm not sure if it makes sense to talk about > this somewhat obscure case. I think your text is good, but... > --- a/doc/lispref/objects.texi > +++ b/doc/lispref/objects.texi > @@ -347,7 +347,12 @@ Basic Char Syntax > characters. However, you must add a backslash before any of the > characters @samp{()[]\;"}, and you should add a backslash before any > of the characters @samp{|'`#.,} to avoid confusing the Emacs commands > -for editing Lisp code. You can also add a backslash before whitespace > +for editing Lisp code. You should also add a backslash before Unicode > +characters which resemble the previously mentioned @acronym{ASCII} > +ones, to avoid confusing people reading your code. Emacs will > +highlight some non-escaped commonly confused characters such as > +@samp{‘} to encourage this. > + You can also add a backslash before whitespace ^^^^^^^^^^^^^^^^^^^^^^^^ What's the deal with this large whitespace stretch? Thanks. From debbugs-submit-bounces@debbugs.gnu.org Thu Oct 31 13:17:36 2019 Received: (at control) by debbugs.gnu.org; 31 Oct 2019 17:17:36 +0000 Received: from localhost ([127.0.0.1]:54207 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iQE4l-0005dT-OB for submit@debbugs.gnu.org; Thu, 31 Oct 2019 13:17:36 -0400 Received: from quimby.gnus.org ([80.91.231.51]:48660) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iQE4h-0005ZX-E3 for control@debbugs.gnu.org; Thu, 31 Oct 2019 13:17:33 -0400 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iQE4d-0002w2-SS for control@debbugs.gnu.org; Thu, 31 Oct 2019 18:17:29 +0100 Date: Thu, 31 Oct 2019 18:17:27 +0100 Message-Id: <87v9s46di0.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #32939 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: tags 32939 + patch quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 32939 + patch quit From unknown Tue Jun 17 01:40:06 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32939: 27.0.50; Don't reject confusable quotes, just fontify & mention them in error messages Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 17 Nov 2019 08:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32939 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Eli Zaretskii Cc: Noam Postavsky , 32939@debbugs.gnu.org Received: via spool by 32939-submit@debbugs.gnu.org id=B32939.157398017431842 (code B ref 32939); Sun, 17 Nov 2019 08:43:02 +0000 Received: (at 32939) by debbugs.gnu.org; 17 Nov 2019 08:42:54 +0000 Received: from localhost ([127.0.0.1]:40243 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWG90-0008HW-0B for submit@debbugs.gnu.org; Sun, 17 Nov 2019 03:42:54 -0500 Received: from quimby.gnus.org ([95.216.78.240]:44812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iWG8y-0008HH-Q2 for 32939@debbugs.gnu.org; Sun, 17 Nov 2019 03:42:53 -0500 Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iWG8p-00053N-BJ; Sun, 17 Nov 2019 09:42:45 +0100 From: Lars Ingebrigtsen References: <87lg7dmfhp.fsf@gmail.com> <83woqw235n.fsf@gnu.org> <877ei7m172.fsf@gmail.com> <838t2joh34.fsf@gnu.org> <87woq0i5ks.fsf@gmail.com> <83h8h3lxfp.fsf@gnu.org> Date: Sun, 17 Nov 2019 09:42:42 +0100 In-Reply-To: <83h8h3lxfp.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 30 Oct 2018 09:12:58 +0200") Message-ID: <87r226ao71.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Eli Zaretskii writes: >> I've tried adding some mentions of it in those places (unfilled to >> simplify diff). Though I'm not sure if it makes sense to talk about >> this somewhat obscure case. > > I think your text is goo [...] Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: ingebrigtsen.no] -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Eli Zaretskii writes: >> I've tried adding some mentions of it in those places (unfilled to >> simplify diff). Though I'm not sure if it makes sense to talk about >> this somewhat obscure case. > > I think your text is good, but... [...] >> + You can also add a backslash before whitespace > ^^^^^^^^^^^^^^^^^^^^^^^^ > What's the deal with this large whitespace stretch? If I read this thread correctly, the change was accepted, but never applied (as far as I can tell). Noam, were there any further changes you wanted to make before applying it? -- (domestic pets only, the antidote for overdose, milk.) bloggy blog: http://lars.ingebrigtsen.no From unknown Tue Jun 17 01:40:06 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32939: 27.0.50; Don't reject confusable quotes, just fontify & mention them in error messages Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 27 Nov 2019 19:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32939 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Lars Ingebrigtsen Cc: Eli Zaretskii , 32939@debbugs.gnu.org Received: via spool by 32939-submit@debbugs.gnu.org id=B32939.157488373818001 (code B ref 32939); Wed, 27 Nov 2019 19:43:01 +0000 Received: (at 32939) by debbugs.gnu.org; 27 Nov 2019 19:42:18 +0000 Received: from localhost ([127.0.0.1]:56238 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ia3Cc-0004gH-HZ for submit@debbugs.gnu.org; Wed, 27 Nov 2019 14:42:18 -0500 Received: from mail-qt1-f175.google.com ([209.85.160.175]:34006) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ia3Ca-0004g3-4K for 32939@debbugs.gnu.org; Wed, 27 Nov 2019 14:42:16 -0500 Received: by mail-qt1-f175.google.com with SMTP id i17so26579218qtq.1 for <32939@debbugs.gnu.org>; Wed, 27 Nov 2019 11:42:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=XclPxtA+KwcAkZRlV9VzKee3h1YUJfzwVr0WGaxqK7I=; b=ELP6+pt7QeeZsaL+CxGSy1dVfx6BzPCG5x44jv8L3HqhgpKxebpnBrwx95pZ8SYUtI aceAcA38+pHsUnfqaLQhRwHAG8z3U30Xl2SI3oWXw4ZjCVXUJdmeW52fooooMkb7utYK zQEh1AwgIIv3ZOtAUVG8fV2VLGlOHwi8d/vtCZNYZ8ZkUnFq0u0cjr6H9Y62nD50E1lL G2fFcZumNk9962B7KrNDz2fRtFfaM8OedRxIAeqi0vCLlj2I7XwoYPXIvNixhpo7ipwk tClg3+1DEuqbEMtqO3zb/uAU9iVDc1W6yTW/yiuHOLbO+uGAZQM4zlabVL55WdDO4I1w pQKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=XclPxtA+KwcAkZRlV9VzKee3h1YUJfzwVr0WGaxqK7I=; b=GRadxOCIJAjw9H23TL/wHXtHMBlOyEL7bTmMA6Pvb6Rb40+LzCejWTHTfN8C68MmVu 7EG5VreFr1ts/wHDI+fDmiO75BrsmXzz3eNQa1qzEVlSWjJ/NK7dz1LLjKW+YxCteEQR Ht4EDMFCKYwsd6+NJOTVVrf3KQRCcOqEnUZJebgcERTE3saVjVaNUWGd0Fx7YLpiE2N6 AUDkgcG9+zZk8kjS9Pjx+LJ2ANnDyJ8nktnchuhNMJS/gnFxhZpYAMKpz/IVRVt2l4M7 m8j6FrbJuGBDfbcCCHfUTmK1Sz0jy/cdU+J/r8u8/cl046pMya/IJVyyQZU1V7Wr6Pyv iZ6w== X-Gm-Message-State: APjAAAVg1Msr9mjebHQClbEh7ryZrGrPUeewgmOpKLRWFZ+s+BqtzGmx oMPssv90sv29/G1G73kSuWFEXqKo X-Google-Smtp-Source: APXvYqzAIWt9Cp3Wn2Frmndj3n+6l2UMkDuC/0wgC6zOXMJblTIddYak2UnbbiGNIY8YKgW20CnWVA== X-Received: by 2002:aed:30c3:: with SMTP id 61mr2171166qtf.251.1574883730363; Wed, 27 Nov 2019 11:42:10 -0800 (PST) Received: from vhost2 (CPE001143542e1f-CMf81d0f809fa0.cpe.net.cable.rogers.com. [99.230.38.42]) by smtp.gmail.com with ESMTPSA id t24sm2548810qtp.39.2019.11.27.11.42.09 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Nov 2019 11:42:09 -0800 (PST) From: Noam Postavsky References: <87lg7dmfhp.fsf@gmail.com> <83woqw235n.fsf@gnu.org> <877ei7m172.fsf@gmail.com> <838t2joh34.fsf@gnu.org> <87woq0i5ks.fsf@gmail.com> <83h8h3lxfp.fsf@gnu.org> <87r226ao71.fsf@gnus.org> Date: Wed, 27 Nov 2019 14:42:08 -0500 In-Reply-To: <87r226ao71.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 17 Nov 2019 09:42:42 +0100") Message-ID: <85lfs1t8bz.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (windows-nt) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Lars Ingebrigtsen writes: > If I read this thread correctly, the change was accepted, but never > applied (as far as I can tell). Noam, were there any further changes > you wanted to make before applying it? No, I just happened to take a long break from Emacs development soon after posting this and it's been sitting since then. It better go in before the pretest though, I'll push today or tomorrow. From unknown Tue Jun 17 01:40:06 2025 X-Loop: help-debbugs@gnu.org Subject: bug#32939: 27.0.50; Don't reject confusable quotes, just fontify & mention them in error messages Resent-From: Noam Postavsky Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 28 Nov 2019 23:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 32939 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Lars Ingebrigtsen Cc: Eli Zaretskii , 32939@debbugs.gnu.org Received: via spool by 32939-submit@debbugs.gnu.org id=B32939.157498354612065 (code B ref 32939); Thu, 28 Nov 2019 23:26:02 +0000 Received: (at 32939) by debbugs.gnu.org; 28 Nov 2019 23:25:46 +0000 Received: from localhost ([127.0.0.1]:59233 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iaTAQ-00038R-4O for submit@debbugs.gnu.org; Thu, 28 Nov 2019 18:25:46 -0500 Received: from mail-qk1-f174.google.com ([209.85.222.174]:37389) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iaTAL-000386-K0; Thu, 28 Nov 2019 18:25:42 -0500 Received: by mail-qk1-f174.google.com with SMTP id e187so24065893qkf.4; Thu, 28 Nov 2019 15:25:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=2Nf5UVZR/pRQI8bml6ZFcvGFZsgOWHZ9JlIxU36beyM=; b=XH+WM6Vyn4Q4aHFjdq+OVvRBEp2EqYbgHGc2NvlCE7W6gXuRIZuBV5kIFDMZnrsKG2 JGqZwfVG0LVq2jUwH2nnW/fhx3IJJCbkpmtPBKjSv4M3G13AC9T58c5fg6pcgXYvcVqs S0qITCQkEb43P3nsG1HdSIpXZKNRXakHDHSEVnTkvu93RxKhsl9cCEK9XKU2J5CSt4fe fh7lhCPa+0/PR5xCjBlcEQv5E2RtH7Qus3/g/5uM1QaTcXAw3Z71/o3HRK2OBv/koLDi n3DBFv/w0gqvBis5mpRLdpw9U+MU9JIQXa7bV8bOn2rYvpDouONU+nHRnmIjKx2E5c+F Y+MA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=2Nf5UVZR/pRQI8bml6ZFcvGFZsgOWHZ9JlIxU36beyM=; b=GM1rIh2CyM6M+QQWrjAgxBUFC01lJUb1k8ZUY9Xcat6bfAIEbXJCHDsul3OshtT2nC d94yk9m9RCThp4cnJFfbyW2Zf/CqEVuHSFChwedCjMbLE6lVTsz9kxtMhQwzq/ZfUAQW AzCcCwmeK0zc6U3ParQ3/zn9EDgDHRHqhIBuMqgSm9acYd4OpySaonrU2ORE3tiT2JuG k1SZrfz3+6KoKxinD4cQj2iThf2e0qdcbAvCgAVesLaNxC6z6P57rcMGc/jGsH5wQ6nj 1ICDAdqdkNQO4A9cJdfC45PiyF1sW3j3raviMezJ74pjPNSj6U7omz81wDNUXXLpiYWY T9FQ== X-Gm-Message-State: APjAAAXUeQlHREDgigAM7VpIYwYWHBJhInQXA8WFWAfZO7PmGi5M5gQB Vres+T5ywuSGUCD2uBb3b1J44xic X-Google-Smtp-Source: APXvYqygau3pJtl9nZUoMCyo/9A+cFVEivkNDe+SGlfa6dzPXRF11awcYY9J6L6ho5EjdmMgMyGBiA== X-Received: by 2002:ae9:f30d:: with SMTP id p13mr12781975qkg.2.1574983534796; Thu, 28 Nov 2019 15:25:34 -0800 (PST) Received: from minid (cbl-45-2-119-34.yyz.frontiernetworks.ca. [45.2.119.34]) by smtp.gmail.com with ESMTPSA id c16sm10453407qtm.48.2019.11.28.15.25.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Nov 2019 15:25:34 -0800 (PST) From: Noam Postavsky References: <87lg7dmfhp.fsf@gmail.com> <83woqw235n.fsf@gnu.org> <877ei7m172.fsf@gmail.com> <838t2joh34.fsf@gnu.org> <87woq0i5ks.fsf@gmail.com> <83h8h3lxfp.fsf@gnu.org> <87r226ao71.fsf@gnus.org> <85lfs1t8bz.fsf@gmail.com> Date: Thu, 28 Nov 2019 18:25:33 -0500 In-Reply-To: <85lfs1t8bz.fsf@gmail.com> (Noam Postavsky's message of "Wed, 27 Nov 2019 14:42:08 -0500") Message-ID: <87wobjd1n6.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) tags 32939 fixed close 32939 27.1 quit Noam Postavsky writes: > Lars Ingebrigtsen writes: > >> If I read this thread correctly, the change was accepted, but never >> applied (as far as I can tell). Noam, were there any further changes >> you wanted to make before applying it? > > No, I just happened to take a long break from Emacs development soon after > posting this and it's been sitting since then. It better go in before > the pretest though, I'll push today or tomorrow. Done. [1: b2790db049]: 2019-11-28 18:10:07 -0500 Improve errors & warnings due to fancy quoted vars (Bug#32939) https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b2790db049da98b541d07bac21ca7d7c220d3be0 [2: 85f586f3ce]: 2019-11-28 18:03:42 -0500 Stop signaling an error when reading "smart quotes" in symbols https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=85f586f3ce5c6d9598d345440fd57e0fc9b8d98b