GNU bug report logs -
#77077
Markers in treesit_check_node
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Mon, 17 Mar 2025 18:01:02 UTC
Severity: normal
Fixed in version 31.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
>> treesit_check_position (Lisp_Object obj, struct buffer *buf)
>> {
>> + if (MARKERP (obj))
>> + obj = make_fixnum (marker_position (obj));
>> +
>
> We call XFIXNUM (obj) after treesit_check_position in a lot of places. Your
> patch didn’t cause any crash?
No crashes at all. I guess this is because of automatic conversion of
markers to integers.
> Anyway, I think we should keep treesit_check_position as-is. And
> change treesit-indent-region to convert markers to integers. Integer
> and marker might be interchangeable in Lisp, but I don’t think it’s
> a good idea to mingle them in C.
OK, then let's fix only treesit-indent-region:
diff --git a/lisp/treesit.el b/lisp/treesit.el
index 46332cb1e4b..7410c0f32a8 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -2602,6 +2602,8 @@ treesit--indent-region-batch-size
(defun treesit-indent-region (beg end)
"Indent the region between BEG and END.
Similar to `treesit-indent', but indent a region instead."
+ (when (markerp beg) (setq beg (marker-position beg)))
+ (when (markerp end) (setq end (marker-position end)))
(treesit-update-ranges beg end)
;; We indent `treesit--indent-region-batch-size' lines at a time, to
;; reduce the number of times the parser needs to re-parse. In each
This bug report was last modified 58 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.