]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/emacs-lisp/lisp-mode.el (lisp--el-non-funcall-position-p):
authorStefan Monnier <monnier@iro.umontreal.ca>
Wed, 15 Apr 2015 20:39:18 +0000 (16:39 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Wed, 15 Apr 2015 20:39:18 +0000 (16:39 -0400)
Avoid pathological slowdown at top-level in large file.

lisp/emacs-lisp/lisp-mode.el

index 4c9a39fe174436d223480ae8f8c8be93b3529667..45d5a0b410c36ada1ca51c4cad892b54fd9b8c49 100644 (file)
             nil)))
     res))
 
-(defun lisp--el-non-funcall-position-p (&optional pos)
+(defun lisp--el-non-funcall-position-p (pos)
   "Heuristically determine whether POS is an evaluated position."
-  (setf pos (or pos (point)))
   (save-match-data
     (save-excursion
       (ignore-errors
         (goto-char pos)
         (or (eql (char-before) ?\')
-            (let ((parent
-                   (progn
-                     (up-list -1)
-                     (cond
+            (let* ((ppss (syntax-ppss))
+                   (paren-posns (nth 9 ppss))
+                   (parent
+                    (when paren-posns
+                      (goto-char (car (last paren-posns))) ;(up-list -1)
+                      (cond
                        ((ignore-errors
                           (and (eql (char-after) ?\()
-                               (progn
-                                 (up-list -1)
+                               (when (cdr paren-posns)
+                                 (goto-char (car (last paren-posns 2)))
                                  (looking-at "(\\_<let\\*?\\_>"))))
                         (goto-char (match-end 0))
                         'let)