diff options
| author | Stefan Monnier | 2015-04-15 16:39:18 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2015-04-15 16:39:18 -0400 |
| commit | 59fd76c178ada8a8b3eb5e3e00609001e9f0195f (patch) | |
| tree | daf818c4149f2803ed1008a456a4d61b500955e8 | |
| parent | 17a8618dc7396ef485c38b4b7c37c591839b3ec5 (diff) | |
| download | emacs-59fd76c178ada8a8b3eb5e3e00609001e9f0195f.tar.gz emacs-59fd76c178ada8a8b3eb5e3e00609001e9f0195f.zip | |
* lisp/emacs-lisp/lisp-mode.el (lisp--el-non-funcall-position-p):
Avoid pathological slowdown at top-level in large file.
| -rw-r--r-- | 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 4c9a39fe174..45d5a0b410c 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el | |||
| @@ -181,22 +181,23 @@ | |||
| 181 | nil))) | 181 | nil))) |
| 182 | res)) | 182 | res)) |
| 183 | 183 | ||
| 184 | (defun lisp--el-non-funcall-position-p (&optional pos) | 184 | (defun lisp--el-non-funcall-position-p (pos) |
| 185 | "Heuristically determine whether POS is an evaluated position." | 185 | "Heuristically determine whether POS is an evaluated position." |
| 186 | (setf pos (or pos (point))) | ||
| 187 | (save-match-data | 186 | (save-match-data |
| 188 | (save-excursion | 187 | (save-excursion |
| 189 | (ignore-errors | 188 | (ignore-errors |
| 190 | (goto-char pos) | 189 | (goto-char pos) |
| 191 | (or (eql (char-before) ?\') | 190 | (or (eql (char-before) ?\') |
| 192 | (let ((parent | 191 | (let* ((ppss (syntax-ppss)) |
| 193 | (progn | 192 | (paren-posns (nth 9 ppss)) |
| 194 | (up-list -1) | 193 | (parent |
| 195 | (cond | 194 | (when paren-posns |
| 195 | (goto-char (car (last paren-posns))) ;(up-list -1) | ||
| 196 | (cond | ||
| 196 | ((ignore-errors | 197 | ((ignore-errors |
| 197 | (and (eql (char-after) ?\() | 198 | (and (eql (char-after) ?\() |
| 198 | (progn | 199 | (when (cdr paren-posns) |
| 199 | (up-list -1) | 200 | (goto-char (car (last paren-posns 2))) |
| 200 | (looking-at "(\\_<let\\*?\\_>")))) | 201 | (looking-at "(\\_<let\\*?\\_>")))) |
| 201 | (goto-char (match-end 0)) | 202 | (goto-char (match-end 0)) |
| 202 | 'let) | 203 | 'let) |