]> 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>
Wed, 22 Sep 2021 10:33:55 +0000 (11:33 +0100)
commit5811e055c0f46e0a2163027d26c54cde642d21c9
tree87802ade9014f234b75e187d30ca7865226f5740
parentd9cab4177b2ee5b2c528afe834ad2484b37ff605
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