aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoão Távora2021-09-21 22:20:17 +0100
committerJoão Távora2021-09-27 01:07:11 +0100
commit90cbf0cb8d9959b94ba09f1faa0dcb50c8dbddbd (patch)
treee76f8770ee587a6cfc0f77bd20ec2ce2c199eca1 /src
parent68d73eb154c745cbba7b3fd6a0a0a087d7c157da (diff)
downloademacs-90cbf0cb8d9959b94ba09f1faa0dcb50c8dbddbd.tar.gz
emacs-90cbf0cb8d9959b94ba09f1faa0dcb50c8dbddbd.zip
Consider shorthands in Elisp's elisp-completion-at-point
Instead of referencing obarray directly, that function has to consider a collection of completions which includes the shorthand versions of some of the symbols. That collection changes from buffer to buffer, depending on the choice of elisp-shorthands. To make this process efficient, and avoid needless recalculation of the above collection, a new obarray-specific cache was invented. The Elisp variable obarray-cache is immediately nullified if something touches the obarray. * lisp/progmodes/elisp-mode.el : New helper. (elisp-completion-at-point): Use new helpers. (elisp--completion-local-symbols) (elisp--fboundp-considering-shorthands) (elisp--bboundp-considering-shorthands): New helpers * src/lread.c (intern_driver): Nullify Qobarray_cache. (syms_of_lread): Add Qobarray_cache. * test/lisp/progmodes/elisp-mode-tests.el (elisp-shorthand-completion-at-point): New test. * test/lisp/progmodes/elisp-resources/simple-shorthand-test.el (f-test-complete-me): New fixture.
Diffstat (limited to 'src')
-rw-r--r--src/lread.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/lread.c b/src/lread.c
index 4b7fcc2875b..51a7084821e 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4356,6 +4356,7 @@ intern_sym (Lisp_Object sym, Lisp_Object obarray, Lisp_Object index)
4356Lisp_Object 4356Lisp_Object
4357intern_driver (Lisp_Object string, Lisp_Object obarray, Lisp_Object index) 4357intern_driver (Lisp_Object string, Lisp_Object obarray, Lisp_Object index)
4358{ 4358{
4359 SET_SYMBOL_VAL (XSYMBOL (Qobarray_cache), Qnil);
4359 return intern_sym (Fmake_symbol (string), obarray, index); 4360 return intern_sym (Fmake_symbol (string), obarray, index);
4360} 4361}
4361 4362
@@ -5427,4 +5428,5 @@ that are loaded before your customizations are read! */);
5427 DEFVAR_LISP ("elisp-shorthands", Velisp_shorthands, 5428 DEFVAR_LISP ("elisp-shorthands", Velisp_shorthands,
5428 doc: /* Alist of known symbol name shorthands*/); 5429 doc: /* Alist of known symbol name shorthands*/);
5429 Velisp_shorthands = Qnil; 5430 Velisp_shorthands = Qnil;
5431 DEFSYM (Qobarray_cache, "obarray-cache");
5430} 5432}