]> code.delx.au - gnu-emacs/blobdiff - lisp/emacs-lisp/lisp-mode.el
Removes the predicate from lisp-complete-symbol (Bug#20456)
[gnu-emacs] / lisp / emacs-lisp / lisp-mode.el
index 4c9a39fe174436d223480ae8f8c8be93b3529667..108d5ccb0e300f6a9b4b427bb23216fa52691029 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)
                          (< (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))))
                              (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)))