unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#61998: 29.0.60; `treesit-simple-indent-presets' `prev-line' has incorrect position
@ 2023-03-06  4:29 Troy Brown
  2023-03-08  0:27 ` Yuan Fu
  0 siblings, 1 reply; 2+ messages in thread
From: Troy Brown @ 2023-03-06  4:29 UTC (permalink / raw)
  To: 61998

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))))





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

* bug#61998: 29.0.60; `treesit-simple-indent-presets' `prev-line'  has incorrect position
  2023-03-06  4:29 bug#61998: 29.0.60; `treesit-simple-indent-presets' `prev-line' has incorrect position Troy Brown
@ 2023-03-08  0:27 ` Yuan Fu
  0 siblings, 0 replies; 2+ messages in thread
From: Yuan Fu @ 2023-03-08  0:27 UTC (permalink / raw)
  To: brownts; +Cc: 61998-done


Troy Brown <brownts@troybrown.dev> 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





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

end of thread, other threads:[~2023-03-08  0:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-06  4:29 bug#61998: 29.0.60; `treesit-simple-indent-presets' `prev-line' has incorrect position Troy Brown
2023-03-08  0:27 ` 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).