unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#31948: 26.1; smie-indent-forward-token forward-sexp in strings
@ 2018-06-23 13:22 Leo Liu
  2018-06-23 18:15 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Leo Liu @ 2018-06-23 13:22 UTC (permalink / raw)
  To: 31948; +Cc: Stefan Monnier


smie-indent-forward-token appears unpredictable because sometimes it
errs with (scan-error "Unbalanced parentheses" 32 33) sometimes not.

I dug a bit deeper and found the following behaviour that might be
questionable.

For example, in a ruby-mode buffer with the following content, place
point inside the first "", and M-: (smie-indent-forward-token). Point
moves to the subsequent "" no matter how far away the second "" is.

-------- buffer content --------
"",
beg do
end
abc,
abc,
abc,
""
--------------------------------

Is this a bug?

Leo





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

* bug#31948: 26.1; smie-indent-forward-token forward-sexp in strings
  2018-06-23 13:22 bug#31948: 26.1; smie-indent-forward-token forward-sexp in strings Leo Liu
@ 2018-06-23 18:15 ` Stefan Monnier
  2018-06-24  8:23   ` Leo Liu
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2018-06-23 18:15 UTC (permalink / raw)
  To: Leo Liu; +Cc: 31948

> For example, in a ruby-mode buffer with the following content, place
> point inside the first "", and M-: (smie-indent-forward-token). Point
> moves to the subsequent "" no matter how far away the second "" is.
>
> -------- buffer content --------
> "",
> beg do
> end
> abc,
> abc,
> abc,
> ""
> --------------------------------
>
> Is this a bug?

It doesn't look like a bug, in the sense that smie-indent-forward-token
should be able to assume it's called from a position outside of
a string/comment.

IOW I'd tend to put the blame on the code that calls this function.


        Stefan





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

* bug#31948: 26.1; smie-indent-forward-token forward-sexp in strings
  2018-06-23 18:15 ` Stefan Monnier
@ 2018-06-24  8:23   ` Leo Liu
  2018-06-24 13:39     ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Leo Liu @ 2018-06-24  8:23 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 31948

On 2018-06-23 14:15 -0400, Stefan Monnier wrote:
> It doesn't look like a bug, in the sense that smie-indent-forward-token
> should be able to assume it's called from a position outside of
> a string/comment.
>
> IOW I'd tend to put the blame on the code that calls this function.

I remember reading something along these lines but cannot find it. Is
this documented somewhere? If not should it be documented?

Leo





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

* bug#31948: 26.1; smie-indent-forward-token forward-sexp in strings
  2018-06-24  8:23   ` Leo Liu
@ 2018-06-24 13:39     ` Stefan Monnier
  2021-08-12 13:40       ` Lars Ingebrigtsen
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Monnier @ 2018-06-24 13:39 UTC (permalink / raw)
  To: Leo Liu; +Cc: 31948

>> It doesn't look like a bug, in the sense that smie-indent-forward-token
>> should be able to assume it's called from a position outside of
>> a string/comment.
>> IOW I'd tend to put the blame on the code that calls this function.
> I remember reading something along these lines but cannot find it.

I don't think it's clearly documented.

> If not should it be documented?

You could try and clarify that the starting point is expected to be
*between* tokens (tho that could also be interpreted to include being
in the middle of a comment).


        Stefan





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

* bug#31948: 26.1; smie-indent-forward-token forward-sexp in strings
  2018-06-24 13:39     ` Stefan Monnier
@ 2021-08-12 13:40       ` Lars Ingebrigtsen
  0 siblings, 0 replies; 5+ messages in thread
From: Lars Ingebrigtsen @ 2021-08-12 13:40 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 31948, Leo Liu

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> If not should it be documented?
>
> You could try and clarify that the starting point is expected to be
> *between* tokens (tho that could also be interpreted to include being
> in the middle of a comment).

I've now basically copied that sentence to the doc string in Emacs 28,
and I'm therefore closing this bug report.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





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

end of thread, other threads:[~2021-08-12 13:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-23 13:22 bug#31948: 26.1; smie-indent-forward-token forward-sexp in strings Leo Liu
2018-06-23 18:15 ` Stefan Monnier
2018-06-24  8:23   ` Leo Liu
2018-06-24 13:39     ` Stefan Monnier
2021-08-12 13:40       ` Lars Ingebrigtsen

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