1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 06:20:55 -08:00

; Optimize shorthand insertion in loaddefs-generate--parse-file

* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--parse-file):
Optimize.
This commit is contained in:
Joseph Turner 2024-02-03 08:32:37 -06:00 committed by João Távora
parent 9a51fbb69f
commit f266622cdb

View file

@ -404,10 +404,13 @@ don't include."
(save-excursion
;; since we're "open-coding" we have to repeat more
;; complicated logic in `hack-local-variables'.
(when (re-search-forward "read-symbol-shorthands: *" nil t)
(let* ((commentless (replace-regexp-in-string
(when-let ((beg
(re-search-forward "read-symbol-shorthands: *" nil t)))
;; `read-symbol-shorthands' alist ends with two parens.
(let* ((end (re-search-forward ")[;\n\s]*)"))
(commentless (replace-regexp-in-string
"\n\\s-*;+" ""
(buffer-substring (point) (point-max))))
(buffer-substring beg end)))
(unsorted-shorthands (car (read-from-string commentless))))
(setq read-symbol-shorthands
(sort unsorted-shorthands