all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 20852@debbugs.gnu.org
Subject: bug#20852: 24.3; update-file-autoloads doesn't accept unescaped parenthesis character literal
Date: Tue, 30 Jun 2015 20:43:01 +0000	[thread overview]
Message-ID: <CAArVCkQxtDeVA=p4vYsOzrBahZ5vB0YcvN1SJur6Fv62nL0VGQ@mail.gmail.com> (raw)
In-Reply-To: <CAArVCkQ9FG9hZos8g5oKG1FUss9nncFGVVqp-QfHR6yoE3p-PQ@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 219 bytes --]

Philipp Stephani <p.stephani2@gmail.com> schrieb am So., 28. Juni 2015 um
15:12 Uhr:

> OK, I'll try to come up with a patch.
>

I've attached a patch that uses the same mechanism as the check for
old-style backquotes.

[-- Attachment #1.2: Type: text/html, Size: 577 bytes --]

[-- Attachment #2: 0001-lread.c-Fload-Warn-about-missing-backslashes.patch --]
[-- Type: application/octet-stream, Size: 2653 bytes --]

From 570b3fa697a9597169a27ac47b1a56f5440203b9 Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Tue, 30 Jun 2015 22:38:35 +0200
Subject: [PATCH] * lread.c (Fload): Warn about missing backslashes

* lread.c (load_warn_unescaped_character_literals, Fload, read1)
(syms_of_lread): Warn if unescaped parenthesis character literals
are found (Bug#20152).
---
 src/lread.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/src/lread.c b/src/lread.c
index 11c8d00..c2df2bd 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -952,6 +952,15 @@ load_warn_old_style_backquotes (Lisp_Object file)
     }
 }
 
+static void
+load_warn_unescaped_character_literals (Lisp_Object file) {
+  if (!NILP (Vunescaped_character_literals))
+    {
+      AUTO_STRING (format, "Loading `%s': unescaped parenthesis character literals detected!");
+      CALLN (Fmessage, format, file);
+    }
+}
+
 DEFUN ("get-load-suffixes", Fget_load_suffixes, Sget_load_suffixes, 0, 0, 0,
        doc: /* Return the suffixes that `load' should try if a suffix is \
 required.
@@ -1194,6 +1203,11 @@ Return t if the file exists and loads successfully.  */)
   specbind (Qold_style_backquotes, Qnil);
   record_unwind_protect (load_warn_old_style_backquotes, file);
 
+  /* Check for the presence of unescaped parenthesis character literals
+     and warn about them. */
+  specbind (Qunescaped_character_literals, Qnil);
+  record_unwind_protect(load_warn_unescaped_character_literals, file);
+
   if (!memcmp (SDATA (found) + SBYTES (found) - 4, ".elc", 4)
       || (fd >= 0 && (version = safe_to_load_version (fd)) > 0))
     /* Load .elc files directly, but not when they are
@@ -2971,6 +2985,9 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
 	if (c == ' ' || c == '\t')
 	  return make_number (c);
 
+	if (c == '(' || c == ')')
+	  Vunescaped_character_literals = Qt;
+
 	if (c == '\\')
 	  c = read_escape (readcharfun, 0);
 	modifiers = c & CHAR_MODIFIER_MASK;
@@ -4678,6 +4695,10 @@ variables, this must be set in the first line of a file.  */);
   Vold_style_backquotes = Qnil;
   DEFSYM (Qold_style_backquotes, "old-style-backquotes");
 
+  DEFVAR_LISP ("unescaped-character-literals", Vunescaped_character_literals,
+               doc: /* Set to non-nil when `read' encounters a deprecated unescaped character literal.  */);
+  DEFSYM (Qunescaped_character_literals, "unescaped-character-literals");
+
   DEFVAR_BOOL ("load-prefer-newer", load_prefer_newer,
                doc: /* Non-nil means `load' prefers the newest version of a file.
 This applies when a filename suffix is not explicitly specified and
-- 
2.4.4


  reply	other threads:[~2015-06-30 20:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19 19:22 bug#20852: 24.3; update-file-autoloads doesn't accept unescaped parenthesis character literal Philipp Stephani
2015-06-19 21:24 ` Stefan Monnier
2015-06-21 12:13   ` Philipp Stephani
2015-06-22  1:18     ` Stefan Monnier
2015-06-28 13:12       ` Philipp Stephani
2015-06-30 20:43         ` Philipp Stephani [this message]
2015-07-02 15:50           ` Stefan Monnier
     [not found]             ` <20170501142718.3510-1-phst@google.com>
2017-05-01 17:59               ` bug#20852: [PATCH] Warn about missing backslashes during load Stefan Monnier
2017-05-01 18:41                 ` Philipp Stephani
2017-05-06 21:14             ` [PATCH] Make `old-style-backquotes' variable internal Philipp
2017-05-07  2:31               ` Eli Zaretskii
2017-05-07 11:49                 ` Philipp
2017-05-13 10:35                   ` Philipp Stephani

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='CAArVCkQxtDeVA=p4vYsOzrBahZ5vB0YcvN1SJur6Fv62nL0VGQ@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=20852@debbugs.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 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.