emacs-diffs
[Top][All Lists]
Advanced

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

feature/tree-sitter 8ad4c4009e 09/14: Add treesit-indent-error


From: Yuan Fu
Subject: feature/tree-sitter 8ad4c4009e 09/14: Add treesit-indent-error
Date: Fri, 4 Nov 2022 13:19:10 -0400 (EDT)

branch: feature/tree-sitter
commit 8ad4c4009e1c7360df6f59175b1a701d7f4ecfae
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    Add treesit-indent-error
    
    * lisp/treesit.el (treesit-indent-error): New error.
    (treesit--simple-indent-eval): Signal treesit-indent-error.
---
 lisp/treesit.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/treesit.el b/lisp/treesit.el
index 21b19299d8..d6feca2f4a 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -877,6 +877,10 @@ If LOUDLY is non-nil, display some debugging information."
 
 ;;; Indent
 
+(define-error 'treesit-indent-error
+              "Generic tree-sitter indentation error"
+              'treesit-error)
+
 (defvar treesit--indent-verbose nil
   "If non-nil, log progress when indenting.")
 
@@ -1105,7 +1109,8 @@ the function."
              exp
            ;; Matchers only return lambdas, anchors only return
            ;; integer, so we should never see a variable.
-           (error "Couldn't find the preset corresponding to %s" exp)))
+           (signal 'treesit-indent-error
+                   '("Couldn't find the preset corresponding to %s") exp)))
         (t exp)))
 
 ;; This variable might seem unnecessary: why split



reply via email to

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