emacs-diffs
[Top][All Lists]
Advanced

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

emacs-29 67bc96c9d9: Remove treesit-defun-prefer-top-level and friends


From: Yuan Fu
Subject: emacs-29 67bc96c9d9: Remove treesit-defun-prefer-top-level and friends
Date: Fri, 16 Dec 2022 18:23:14 -0500 (EST)

branch: emacs-29
commit 67bc96c9d94717353d4e0cc283e5235f7c0de330
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    Remove treesit-defun-prefer-top-level and friends
    
    Because they are not used anymore, after the new defun navigation is
    installed.
    
    * lisp/treesit.el (treesit-defun-prefer-top-level)
    (treesit--defun-maybe-top-level): Remove.
---
 lisp/treesit.el | 32 --------------------------------
 1 file changed, 32 deletions(-)

diff --git a/lisp/treesit.el b/lisp/treesit.el
index a5eda436c8..068c443dc2 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -1591,38 +1591,6 @@ newline after a defun, or the beginning of a defun.
 
 If the value is nil, no skipping is performed.")
 
-(defvar-local treesit-defun-prefer-top-level nil
-  "When non-nil, Emacs prefers top-level defun.
-
-In some languages, a defun could be nested in another one.
-Normally Emacs stops at the first defun it encounters.  If this
-variable's value is t, Emacs tries to find the top-level defun,
-and ignores nested ones.
-
-This variable can also be a list of cons cells of the
-form (FROM . TO), where FROM and TO are tree-sitter node type
-regexps.  When Emacs finds a defun node whose type matches any of
-the FROM regexps in the list, it then tries to find a
-higher-level node matching the corresponding TO regexp.")
-
-(defun treesit--defun-maybe-top-level (node)
-  "Maybe return the top-level equivalent of NODE.
-For the detailed semantic see `treesit-defun-prefer-top-level'."
-  (pcase treesit-defun-prefer-top-level
-    ('nil node)
-    ('t (or (treesit-node-top-level
-             node treesit-defun-type-regexp)
-            node))
-    ((pred consp)
-     (cl-loop
-      for con in treesit-defun-prefer-top-level
-      for from = (car con)
-      for to = (cdr con)
-      if (string-match-p from (treesit-node-type node))
-      return (or (treesit-node-top-level node to)
-                 node)
-      finally return node))))
-
 (defun treesit-beginning-of-defun (&optional arg)
   "Move backward to the beginning of a defun.
 



reply via email to

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