unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>, emacs-devel@gnu.org
Subject: Re: Dialling down symbol escaping slightly?
Date: Fri, 11 Mar 2022 04:44:04 +0100	[thread overview]
Message-ID: <87r1792lx7.fsf@gnus.org> (raw)
In-Reply-To: <87cziu47tt.fsf@gnus.org> (Lars Ingebrigtsen's message of "Thu, 10 Mar 2022 07:53:18 +0100")

Lars Ingebrigtsen <larsi@gnus.org> writes:

> Or rather -- that's what I was kind of asking -- whether doing what I
> described would break the Lisp reader in any way.  I don't think so, but
> there may be cases I'm not aware of.

There was the `.?' case, so it's not just `.'.  So how about the
following -- it's more conservative than originally proposed, and leaves
open the possibility of introducing other future syntaxes starting with
a dot.

diff --git a/src/print.c b/src/print.c
index 8cce8a1ad8..3ede628b09 100644
--- a/src/print.c
+++ b/src/print.c
@@ -2180,6 +2180,11 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
 			  && !NILP (string_to_number (p, 10, &len))
 			  && len == size_byte);
 
+	/* We don't escape "." or "?" (unless they're the first
+	   character in the symbol name).  */
+	if (*p == '?' || *p == '.')
+	  confusing = true;
+
 	if (! NILP (Vprint_gensym)
 	    && !SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (obj))
 	  print_c_string ("#:", printcharfun);
@@ -2201,8 +2206,8 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
 	      {
 		if (c == '\"' || c == '\\' || c == '\''
 		    || c == ';' || c == '#' || c == '(' || c == ')'
-		    || c == ',' || c == '.' || c == '`'
-		    || c == '[' || c == ']' || c == '?' || c <= 040
+		    || c == ',' || c == '`'
+		    || c == '[' || c == ']' || c <= 040
 		    || c == NO_BREAK_SPACE
 		    || confusing)
 		  {

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



  reply	other threads:[~2022-03-11  3:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10  2:47 Dialling down symbol escaping slightly? Lars Ingebrigtsen
2022-03-10  5:50 ` [External] : " Drew Adams
2022-03-10  6:46 ` Eli Zaretskii
2022-03-10  6:50   ` Lars Ingebrigtsen
2022-03-10  6:53     ` Lars Ingebrigtsen
2022-03-11  3:44       ` Lars Ingebrigtsen [this message]
2022-03-14  9:29         ` 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=87r1792lx7.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --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).