]> git.eshelyaron.com Git - emacs.git/commit
Move most of the shorthand implementation to C code
authorJoão Távora <joaotavora@gmail.com>
Sat, 19 Sep 2020 21:16:38 +0000 (22:16 +0100)
committerJoão Távora <joaotavora@gmail.com>
Sat, 19 Sep 2020 21:16:38 +0000 (22:16 +0100)
commitcfc00db5d4ce0b825776ed4aa4a151464642b878
treed7aa2711e0322477d89c85c2a76c847a5e43bc3c
parent01d7325c82c3b26294b97e3b97b22346c7e2f85f
Move most of the shorthand implementation to C code

This very likely isn't the final form of the implementation.  For one,
the reader is much slower and allocates a Lisp string for every atom
read, regardless if its already interned or not, which perhaps has the
potential to be catastrophic in terms of GC.

But it passes the tests.

The solution to this, is probably to simplify the semantics of
shorthand-shorthands.  Instead of making it a regexp-to-longhand
alist, make it just prefix-to-longhand.  Then we wouldn't need to call
Fstring_match in oblookup_considering_shorthand, meaning we wouldn't
need a Lisp string there.

* lisp/shorthand.el (shorthand-shorthands): Move to C code.
(shorthand--expand-shorthand): Remove.
(shorthand-read-wrapper): Remove.
(shorthand-intern-soft-wrapper): Remove.
(read, intern-soft): No longer advise.

* src/lread.c:
(read1, Fintern, Fintern_soft, Funintern): Use
oblookup_considering_shorthand.
(oblookup_considering_shorthand): New helper.
(syms_of_lread): Declare shorthand-shorthands.
lisp/shorthand.el
src/lread.c