summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/lisp-mode.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/lisp-mode.el')
-rw-r--r--lisp/emacs-lisp/lisp-mode.el40
1 files changed, 14 insertions, 26 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 4c9a39fe174..108d5ccb0e3 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)
@@ -217,6 +218,7 @@
(< (point) pos))))))))))
(defun lisp--el-match-keyword (limit)
+ ;; FIXME: Move to elisp-mode.el.
(catch 'found
(while (re-search-forward "(\\(\\(?:\\sw\\|\\s_\\)+\\)\\_>" limit t)
(let ((sym (intern-soft (match-string 1))))
@@ -227,17 +229,6 @@
(match-beginning 0)))))
(throw 'found t))))))
-(defun lisp--el-font-lock-flush-elisp-buffers (&optional file)
- ;; Don't flush during load unless called from after-load-functions.
- ;; In that case, FILE is non-nil. It's somehow strange that
- ;; load-in-progress is t when an after-load-function is called since
- ;; that should run *after* the load...
- (when (or (not load-in-progress) file)
- (dolist (buf (buffer-list))
- (with-current-buffer buf
- (when (derived-mode-p 'emacs-lisp-mode)
- (font-lock-flush))))))
-
(pcase-let
((`(,vdefs ,tdefs
,el-defs-re ,cl-defs-re
@@ -582,10 +573,6 @@ font-lock keywords will not be case sensitive."
(font-lock-syntactic-face-function
. lisp-font-lock-syntactic-face-function)))
(setq-local prettify-symbols-alist lisp--prettify-symbols-alist)
- (when elisp
- (add-hook 'after-load-functions #'lisp--el-font-lock-flush-elisp-buffers)
- (setq-local electric-pair-text-pairs
- (cons '(?\` . ?\') electric-pair-text-pairs)))
(setq-local electric-pair-skip-whitespace 'chomp)
(setq-local electric-pair-open-newline-between-pairs nil))
@@ -868,9 +855,10 @@ is the buffer position of the start of the containing expression."
;; Handle prefix characters and whitespace
;; following an open paren. (Bug#1012)
(backward-prefix-chars)
- (while (and (not (looking-back "^[ \t]*\\|([ \t]+"))
- (or (not containing-sexp)
- (< (1+ containing-sexp) (point))))
+ (while (not (or (looking-back "^[ \t]*\\|([ \t]+"
+ (line-beginning-position))
+ (and containing-sexp
+ (>= (1+ containing-sexp) (point)))))
(forward-sexp -1)
(backward-prefix-chars))
(setq calculate-lisp-indent-last-sexp (point)))