emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master f266622cdb3 8/8: ; Optimize shorthand insertion in loaddefs-gener


From: João Távora
Subject: master f266622cdb3 8/8: ; Optimize shorthand insertion in loaddefs-generate--parse-file
Date: Sat, 3 Feb 2024 09:44:08 -0500 (EST)

branch: master
commit f266622cdb34044f364976796a4e7ac003d7a1b3
Author: Joseph Turner <joseph@ushin.org>
Commit: João Távora <joaotavora@gmail.com>

    ; Optimize shorthand insertion in loaddefs-generate--parse-file
    
    * lisp/emacs-lisp/loaddefs-gen.el (loaddefs-generate--parse-file):
    Optimize.
---
 lisp/emacs-lisp/loaddefs-gen.el | 9 ++++++---
 1 file 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]