unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#62158: treesit-end-of-defun error
@ 2023-03-13  7:28 Juri Linkov
  2023-03-13 22:04 ` Yuan Fu
  0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2023-03-13  7:28 UTC (permalink / raw)
  To: 62158; +Cc: yuan fu, dmitry gutov

X-Debbugs-Cc: Yuan Fu <casouri@gmail.com>, Dmitry Gutov <dgutov@yandex.ru>

Since this is a separate problem, I'm closing bug#62086
and opening a new bug report:

>>>> I don't know if the second bug is related to this, but while
>>>> in the same file, also type 'C-M-l' ('reposition-window').
>>>> It raises the error:
>>>>   Debugger entered--Lisp error: (wrong-type-argument number-or-marker-p nil)
>>>>     treesit-end-of-defun()
>>>>     end-of-defun(-1)
>>>>     reposition-window(nil nil)
>>>>     reposition-window(nil 89)
>>>>     funcall-interactively(reposition-window nil 89)
>>>>     command-execute(reposition-window)
>> I see it only in some files in test/lisp/progmodes/ruby-mode-resources/
>> e.g. ruby-parenless-call-arguments-indent.rb, ruby-method-call-indent.rb,
>> ruby-block-indent.rb.  But not in e.g. ruby-after-operator-indent.rb.
>> Also everywhere in test/lisp/progmodes/js-resources/js-indent-init-dynamic.js,
>> js-indent-init-t.js.  But not in e.g. js-chain.js.
>
> Thanks, I can repro. I might have been trying the wrong binding at the end
> last night (C-l instead of C-M-l).
>
> The fix seems to be easy:
>
> diff --git a/lisp/treesit.el b/lisp/treesit.el
> index c118f5d52a4..b271a1f0c4b 100644
> --- a/lisp/treesit.el
> +++ b/lisp/treesit.el
> @@ -1882,6 +1882,7 @@ treesit-end-of-defun
>  `treesit-defun-skipper'."
>    (interactive "^p\nd")
>    (let ((orig-point (point)))
> +    (if (or (null arg) (= arg 0)) (setq arg 1))
>      (catch 'done
>        (dotimes (_ 2) ; Not making progress is better than infloop.
>
> But I'm not quite sure if that is what we want to do.
>
> More naturally, I think, would be to remove the argument from
> treesit-end-of-defun altogether (and adjust the code accordingly), because
> end-of-defun-function is documented to take no arguments.
>
> The only other place where treesit-end-of-defun seems to be used is the
> <remap> <end-of-defun> binding set up by treesit-major-mode-setup.
>
> Why not keep the default bindings for these? When
> beginning-of-defun-function and end-of-defun-function are set
> appropriately, they should work fine. Don't they?
>
> Cc'ing Yuan on that subject.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-03-21 21:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-13  7:28 bug#62158: treesit-end-of-defun error Juri Linkov
2023-03-13 22:04 ` Yuan Fu
2023-03-20 18:21   ` Juri Linkov
2023-03-20 18:43   ` Dmitry Gutov
2023-03-21 21:26     ` Yuan Fu

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).