diff options
author | Joseph Turner <joseph@ushin.org> | 2024-02-03 08:32:37 -0600 |
---|---|---|
committer | João Távora <joaotavora@gmail.com> | 2024-02-03 08:40:03 -0600 |
commit | f266622cdb34044f364976796a4e7ac003d7a1b3 (patch) | |
tree | 956519aeded9d9aadd6d4d0ef505ba7baaaf2508 /lisp/emacs-lisp | |
parent | 9a51fbb69fc9dc4aa415308889ae667ee65660d7 (diff) | |
download | emacs-f266622cdb34044f364976796a4e7ac003d7a1b3.tar.gz emacs-f266622cdb34044f364976796a4e7ac003d7a1b3.tar.bz2 emacs-f266622cdb34044f364976796a4e7ac003d7a1b3.zip |
; Optimize shorthand insertion in loaddefs-generate--parse-file
* lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--parse-file):
Optimize.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/loaddefs-gen.el | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/loaddefs-gen.el b/lisp/emacs-lisp/loaddefs-gen.el index 8aacbf406b6..fe29469d08c 100644 --- a/lisp/emacs-lisp/loaddefs-gen.el +++ b/lisp/emacs-lisp/loaddefs-gen.el @@ -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 |