[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/shorthand-namespacing a2df797 11/11: Add mechanism for escaping
From: |
João Távora |
Subject: |
feature/shorthand-namespacing a2df797 11/11: Add mechanism for escaping shorthand substitution |
Date: |
Wed, 22 Sep 2021 18:54:03 -0400 (EDT) |
branch: feature/shorthand-namespacing
commit a2df797f8321f411bce8997ddcd11f74d3f74df1
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Add mechanism for escaping shorthand substitution
* src/lread.c (read1): Add skip_shorthand variable. Add a '#\'
case. Sometimes call oblookup instead of
oblookup_considering_shorthand.
---
src/lread.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/src/lread.c b/src/lread.c
index c68c04e..509e834 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2972,6 +2972,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool
first_in_list)
{
int c;
bool uninterned_symbol = false;
+ bool skip_shorthand = false;
bool multibyte;
char stackbuf[stackbufsize];
current_thread->stack_top = stackbuf;
@@ -3367,6 +3368,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool
first_in_list)
if (c == ':')
{
uninterned_symbol = true;
+ read_hash_prefixed_symbol:
c = READCHAR;
if (!(c > 040
&& c != NO_BREAK_SPACE
@@ -3380,6 +3382,12 @@ read1 (Lisp_Object readcharfun, int *pch, bool
first_in_list)
}
goto read_symbol;
}
+ /* #/foo is the shorthand-oblivious symbol named foo. */
+ if (c == '\\')
+ {
+ skip_shorthand = true;
+ goto read_hash_prefixed_symbol;
+ }
/* ## is the empty symbol. */
if (c == '#')
return Fintern (empty_unibyte_string, Qnil);
@@ -3760,7 +3768,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool
first_in_list)
ptrdiff_t nbytes = p - read_buffer;
UNREAD (c);
- if (!quoted && !uninterned_symbol)
+ if (!quoted && !uninterned_symbol && !skip_shorthand)
{
ptrdiff_t len;
Lisp_Object result = string_to_number (read_buffer, 10, &len);
@@ -3795,10 +3803,14 @@ read1 (Lisp_Object readcharfun, int *pch, bool
first_in_list)
ptrdiff_t longhand_chars = 0;
ptrdiff_t longhand_bytes = 0;
- Lisp_Object tem
- = oblookup_considering_shorthand
+ Lisp_Object tem;
+ if (skip_shorthand)
+ tem = oblookup (obarray, read_buffer, nchars, nbytes);
+ else {
+ tem = oblookup_considering_shorthand
(obarray, read_buffer, nchars, nbytes,
&longhand, &longhand_chars, &longhand_bytes);
+ }
if (SYMBOLP (tem))
result = tem;
- branch feature/shorthand-namespacing created (now a2df797), João Távora, 2021/09/22
- feature/shorthand-namespacing d9cab41 01/11: First Elisp version of lisp/shorthand.el, failing some tests, João Távora, 2021/09/22
- feature/shorthand-namespacing fe4e4c2 04/11: Integrate shorthand functionality into elisp-mode.el, João Távora, 2021/09/22
- feature/shorthand-namespacing 82528bc 03/11: Robustify checking of shorthand-shorthands, João Távora, 2021/09/22
- feature/shorthand-namespacing 881478b 10/11: Consider shorthands in Elisp's elisp-completion-at-point, João Távora, 2021/09/22
- feature/shorthand-namespacing 2f95a95 05/11: Add a test for byte-compilation, João Távora, 2021/09/22
- feature/shorthand-namespacing d102e30 07/11: Rework docstring of hack-elisp-shorthands, João Távora, 2021/09/22
- feature/shorthand-namespacing eed51f2 08/11: Adjust C style and add comments to shorthand code, João Távora, 2021/09/22
- feature/shorthand-namespacing 62523a0 06/11: Rework elisp-shorthands to only allow only prefix substitution, João Távora, 2021/09/22
- feature/shorthand-namespacing a2df797 11/11: Add mechanism for escaping shorthand substitution,
João Távora <=
- feature/shorthand-namespacing 5811e05 02/11: Move most of the shorthand implementation to C code, João Távora, 2021/09/22
- feature/shorthand-namespacing 39a63cd 09/11: * lisp/emacs-lisp/magnars-string.el: New file., João Távora, 2021/09/22