summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2021-10-11 22:19:51 +0100
committerJoão Távora <joaotavora@gmail.com>2021-10-11 22:29:16 +0100
commitcf1409db71152926767da189bf044c3a63e77128 (patch)
treedc5aa47220a48823b5e7139a630d7b790b7db89f /src
parentb3d0f53b296a0876ec7a55ae840868e65ed54e14 (diff)
Don't apply shorthands to punctuation-only symbols (bug#51089)
This includes symbols used for arithmetic functions such as -, /=, etc. Using "-" or "/=" is still possible but doing so won't shadow those functions. * doc/lispref/symbols.texi (Shorthand, Exceptions): New subsubsection. * src/lread.c (read1): Exempt punctionation-only symbols from oblookup_considering_shorthand. * test/lisp/progmodes/elisp-mode-tests.el (elisp-dont-shadow-punctuation-only-symbols): Tweak test.
Diffstat (limited to 'src')
-rw-r--r--src/lread.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lread.c b/src/lread.c
index 07580d11d13..128b46aefef 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3805,7 +3805,12 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
ptrdiff_t longhand_bytes = 0;
Lisp_Object tem;
- if (skip_shorthand)
+ if (skip_shorthand ||
+ /* The following ASCII characters are used in the
+ only "core" Emacs Lisp symbols that are
+ exclusively comprised of 'symbol constituent'
+ syntax. */
+ strspn(read_buffer, "^*+-/<=>_|") >= nbytes)
tem = oblookup (obarray, read_buffer, nchars, nbytes);
else
tem = oblookup_considering_shorthand (obarray, read_buffer,