all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: npostavs@users.sourceforge.net
To: Glenn Morris <rgm@gnu.org>
Cc: 2967@debbugs.gnu.org, Alan Mackenzie <acm@muc.de>,
	Stefan Monnier <monnier@iro.umontreal.ca>
Subject: bug#2967: smart quotes in .emacs
Date: Tue, 06 Jun 2017 23:46:48 -0400	[thread overview]
Message-ID: <87ink8xxw7.fsf@users.sourceforge.net> (raw)
In-Reply-To: <qza9y25xiy.fsf@fencepost.gnu.org> (Glenn Morris's message of "Fri, 10 Aug 2012 15:59:01 -0400")

Glenn Morris <rgm@gnu.org> writes:

> I assume the OP means something like:
>
> (set 'foo t)
>
> where the quote character is actually U+2019 "RIGHT SINGLE QUOTATION MARK"
> rather than a plain old-ASCII apostrophe.
>
> This leads to errors like:
>
>   Symbol's value as variable is void: 'foo

Adding Alan to Cc, I think this is relevant also to the scenario in
Bug#23425.

I propose making these funny quotes give a read syntax error in symbol
name contexts.  Theoretically this breaks backwards compability with
code that uses variables containing them, but probably no such code
exists.

Something like this (not sure if this is the best way to test for them):

--- i/src/lread.c
+++ w/src/lread.c
@@ -3349,6 +3349,15 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
 	     ? multibyte_chars_in_text ((unsigned char *) read_buffer,
 					nbytes)
 	     : nbytes);
+        if (!quoted && multibyte)
+          {
+            switch (STRING_CHAR ((unsigned char *) read_buffer))
+              {
+              case 0x2018:      /* LEFT SINGLE QUOTATION MARK */
+              case 0x2019:      /* RIGHT SINGLE QUOTATION MARK */
+                invalid_syntax ("strange quote");
+              }
+          }
 	Lisp_Object name = ((uninterned_symbol && ! NILP (Vpurify_flag)
 			     ? make_pure_string : make_specified_string)
 			    (read_buffer, nchars, nbytes, multibyte));

We then get the following error from evaluating (read (format-message "'foo")):

Debugger entered--Lisp error: (invalid-read-syntax "strange quote")
  read("’foo")
  eval((read (format-message "'foo")) nil)






  reply	other threads:[~2017-06-07  3:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-12 12:53 bug#2967: smart quotes in .emacs Kit O'Connell
2009-04-13 12:23 ` Stefan Monnier
2012-08-10 19:59   ` Glenn Morris
2017-06-07  3:46     ` npostavs [this message]
2017-06-07  5:09       ` Eli Zaretskii
2017-07-17  0:49         ` npostavs
2017-07-22  9:20           ` Eli Zaretskii
2017-07-22 14:41             ` npostavs

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

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

  git send-email \
    --in-reply-to=87ink8xxw7.fsf@users.sourceforge.net \
    --to=npostavs@users.sourceforge.net \
    --cc=2967@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=monnier@iro.umontreal.ca \
    --cc=rgm@gnu.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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.