emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 8f28a1b: Tweak `condition-case' keyword highlights


From: Lars Ingebrigtsen
Subject: master 8f28a1b: Tweak `condition-case' keyword highlights
Date: Sun, 24 Jan 2021 15:31:19 -0500 (EST)

branch: master
commit 8f28a1b9da06a12ac3631de38119d8845f14499c
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Tweak `condition-case' keyword highlights
    
    * 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            | 7 +++++--
 test/lisp/progmodes/elisp-mode-tests.el | 9 ++++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 8780c5d..34ecfd1 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -234,8 +234,11 @@
                          (< 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.
diff --git a/test/lisp/progmodes/elisp-mode-tests.el 
b/test/lisp/progmodes/elisp-mode-tests.el
index 0da0e39..714751e 100644
--- a/test/lisp/progmodes/elisp-mode-tests.el
+++ b/test/lisp/progmodes/elisp-mode-tests.el
@@ -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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]