Subject: bug#61998: closed (Re: bug#61998: 29.0.60; `treesit-simple-indent-presets' `prev-line' has incorrect position)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 08 Mar 2023 00:29:02 +0000

Your bug report

#61998: 29.0.60; `treesit-simple-indent-presets' `prev-line' has incorrect position

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
61998: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=61998
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#61998: 29.0.60; `treesit-simple-indent-presets' `prev-line' has incorrect position
From: Yuan Fu <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Tue, 7 Mar 2023 16:27:54 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

Troy Brown <[email-masked]> writes:

> I'm expecting `prev-line' to return the position of the first non-space
> character on the previous line.  However, it instead returns the number
> of characters skipped on the previous line to move to the first
> non-space character (i.e., the result of calling `skip-chars-foward').
>
> It appears there is a missing call to `point' that should appear at the
> end of the defined lambda.
>
>          (cons 'prev-line (lambda (_n _p bol &rest _)
>                             (save-excursion
>                               (goto-char bol)
>                               (forward-line -1)
> -                             (skip-chars-forward " \t"))))
> +                             (skip-chars-forward " \t")
> +                             (point))))

Thanks for the catch! I fixed it on emacs-29.

Yuan

Subject: 29.0.60; `treesit-simple-indent-presets' `prev-line' has incorrect position
From: Troy Brown <[email-masked]>
To: [email-masked]
Date: Sun, 5 Mar 2023 23:29:59 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

I'm expecting `prev-line' to return the position of the first non-space
character on the previous line.  However, it instead returns the number
of characters skipped on the previous line to move to the first
non-space character (i.e., the result of calling `skip-chars-foward').

It appears there is a missing call to `point' that should appear at the
end of the defined lambda.

         (cons 'prev-line (lambda (_n _p bol &rest _)
                            (save-excursion
                              (goto-char bol)
                              (forward-line -1)
-                             (skip-chars-forward " \t"))))
+                             (skip-chars-forward " \t")
+                             (point))))