emacs-diffs
[Top][All Lists]
Advanced

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

master f411cc3a957 1/6: * lisp/emacs-lisp/lisp-mode.el (lisp-ppss): Fix


From: Stefan Monnier
Subject: master f411cc3a957 1/6: * lisp/emacs-lisp/lisp-mode.el (lisp-ppss): Fix performance bug
Date: Sat, 17 Jun 2023 18:06:22 -0400 (EDT)

branch: master
commit f411cc3a9578eae4ea4549959109817a467f9a16
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * lisp/emacs-lisp/lisp-mode.el (lisp-ppss): Fix performance bug
    
    (nth 2 ppss) can be absent but not incorrect, so don't recompute ppss
    for (nth 2 ppss) when (nth 2 ppss) is already provided.
    When calling `lisp-indent-line` on all the lines in a region, this
    sometimes introduced a gratuitous O(N²) complexity.
---
 lisp/emacs-lisp/lisp-mode.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index d44c9d6e23d..9914ededb85 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -876,7 +876,7 @@ complete sexp in the innermost containing list at position
 2 (counting from 0).  This is important for Lisp indentation."
   (unless pos (setq pos (point)))
   (let ((pss (syntax-ppss pos)))
-    (if (nth 9 pss)
+    (if (and (not (nth 2 pss)) (nth 9 pss))
         (let ((sexp-start (car (last (nth 9 pss)))))
           (parse-partial-sexp sexp-start pos nil nil (syntax-ppss sexp-start)))
       pss)))



reply via email to

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