]> git.eshelyaron.com Git - emacs.git/commitdiff
Tweak `condition-case' keyword highlights
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 24 Jan 2021 20:31:09 +0000 (21:31 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 24 Jan 2021 20:31:09 +0000 (21:31 +0100)
* lisp/emacs-lisp/lisp-mode.el (lisp--el-non-funcall-position-p):
Tweak `condition-case' position check to skip the VAR form.

lisp/emacs-lisp/lisp-mode.el
test/lisp/progmodes/elisp-mode-tests.el

index 8780c5dcd305ff241dcd80d9af3ed9581c4d25b7..34ecfd1c25446bd5429670dd8f371eea0607c3ac 100644 (file)
                          (< pos (point))))
                   (and (eq parent 'condition-case)
                        (progn
-                         (forward-sexp 2)
-                         (< (point) pos))))))))))
+                         (forward-sexp 1)
+                         ;; If we're in the second form, then we're in
+                         ;; a funcall position.
+                         (not (< (point) pos (progn (forward-sexp 1)
+                                                    (point)))))))))))))
 
 (defun lisp--el-match-keyword (limit)
   ;; FIXME: Move to elisp-mode.el.
index 0da0e393535601562e4679aa3552e0f898a06f15..714751eafc83f8028dcd4a505434cb03be5d9f36 100644 (file)
@@ -877,7 +877,7 @@ to (xref-elisp-test-descr-to-target xref)."
                           "(\\(if\\)")
               nil)))
 
-(ert-deftest test-elisp-font-keywords-if ()
+(ert-deftest test-elisp-font-keywords-4 ()
   :expected-result :failed ; FIXME bug#43265
   (should (eq (test--font '(condition-case nil
                                (foo)
@@ -885,5 +885,12 @@ to (xref-elisp-test-descr-to-target xref)."
                           "(\\(if\\)")
               nil)))
 
+(ert-deftest test-elisp-font-keywords-5 ()
+  (should (eq (test--font '(condition-case (when a)
+                               (foo)
+                             (error t))
+                          "(\\(when\\)")
+              nil)))
+
 (provide 'elisp-mode-tests)
 ;;; elisp-mode-tests.el ends here