[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
feature/shorthand-namespacing 82528bc 03/11: Robustify checking of short
From: |
Jo�o T�vora |
Subject: |
feature/shorthand-namespacing 82528bc 03/11: Robustify checking of shorthand-shorthands |
Date: |
Wed, 22 Sep 2021 18:54:01 -0400 (EDT) |
branch: feature/shorthand-namespacing
commit 82528bcb590440681ef299067997269fc72c2c0c
Author: João Távora <joaotavora@gmail.com>
Commit: João Távora <joaotavora@gmail.com>
Robustify checking of shorthand-shorthands
* src/lread.c (oblookup_considering_shorthand): Maybe warn when we
find fishy shorthand-shorthands.
---
src/lread.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/lread.c b/src/lread.c
index f7d0a8c..33a7bd0 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4553,19 +4553,30 @@ oblookup (Lisp_Object obarray, register const char
*ptr, ptrdiff_t size, ptrdiff
Lisp_Object
oblookup_considering_shorthand (Lisp_Object obarray, Lisp_Object* string)
{
+ Lisp_Object original = *string; /* Save pointer to original string... */
Lisp_Object tail = Vshorthand_shorthands;
FOR_EACH_TAIL_SAFE(tail)
{
Lisp_Object pair = XCAR (tail);
+ if (!CONSP (pair)) goto undo;
Lisp_Object shorthand = XCAR (pair);
Lisp_Object longhand = XCDR (pair);
- CHECK_STRING (shorthand);
- CHECK_STRING (longhand);
- Lisp_Object match = Fstring_match(shorthand, *string, Qnil);
+ if (!STRINGP (shorthand) || !STRINGP (longhand)) goto undo;
+ Lisp_Object match = Fstring_match (shorthand, *string, Qnil);
if (!NILP(match)){
*string = Freplace_match(longhand, Qnil, Qnil, *string, Qnil);
}
}
+ goto fine;
+ undo:
+ {
+ static const char* warn =
+ "Fishy value of `shorthand-shorthands'. "
+ "Consider reviewing before evaluating code.";
+ message_dolog (warn, sizeof(warn), 0, 0);
+ *string = original; /* ...so we can any failed trickery here. */
+ }
+ fine:
return oblookup(obarray, SSDATA (*string), SCHARS (*string), SBYTES
(*string));
}
- 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 <=
- 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, 2021/09/22
- 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