[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 59fd76c: * lisp/emacs-lisp/lisp-mode.el (lisp--el-n
From: |
Stefan Monnier |
Subject: |
[Emacs-diffs] master 59fd76c: * lisp/emacs-lisp/lisp-mode.el (lisp--el-non-funcall-position-p): |
Date: |
Wed, 15 Apr 2015 20:39:23 +0000 |
branch: master
commit 59fd76c178ada8a8b3eb5e3e00609001e9f0195f
Author: Stefan Monnier <address@hidden>
Commit: Stefan Monnier <address@hidden>
* lisp/emacs-lisp/lisp-mode.el (lisp--el-non-funcall-position-p):
Avoid pathological slowdown at top-level in large file.
---
lisp/emacs-lisp/lisp-mode.el | 17 +++++++++--------
1 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 4c9a39f..45d5a0b 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -181,22 +181,23 @@
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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 59fd76c: * lisp/emacs-lisp/lisp-mode.el (lisp--el-non-funcall-position-p):,
Stefan Monnier <=