* Re: master 370d403: Explain in the manual how to make `cursor-intangible' work
[not found] ` <20211114021444.BD421209C6@vcs0.savannah.gnu.org>
@ 2021-11-14 16:05 ` Stefan Monnier
2021-11-14 16:09 ` Lars Ingebrigtsen
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2021-11-14 16:05 UTC (permalink / raw)
To: emacs-devel; +Cc: Lars Ingebrigtsen
> +@lisp
> +(insert
> + (propertize "xxxx" 'cursor-intangible t)
> + (propertize "x" 'cursor-intangible t 'rear-nonsticky t))
> +@end lisp
Then again, you can also do:
(insert
(propertize "xxxx" 'cursor-intangible t)
(propertize "x"))
or
(insert
(propertize "xxxxx" 'cursor-intangible t 'rear-nonsticky t))
or even
(insert
(propertize "xxxxx" 'cursor-intangible t 'rear-nonsticky '(cursor-intangible)))
-- Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: master 370d403: Explain in the manual how to make `cursor-intangible' work
2021-11-14 16:05 ` master 370d403: Explain in the manual how to make `cursor-intangible' work Stefan Monnier
@ 2021-11-14 16:09 ` Lars Ingebrigtsen
2021-11-14 18:08 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-14 16:09 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Then again, you can also do:
>
> (insert
> (propertize "xxxx" 'cursor-intangible t)
> (propertize "x"))
Sure, but I thought it was more pedagogical with the rear-nonsticky.
> or
>
> (insert
> (propertize "xxxxx" 'cursor-intangible t 'rear-nonsticky t))
Nope; doesn't work.
> or even
>
> (insert
> (propertize "xxxxx" 'cursor-intangible t 'rear-nonsticky '(cursor-intangible)))
That one either.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: master 370d403: Explain in the manual how to make `cursor-intangible' work
2021-11-14 16:09 ` Lars Ingebrigtsen
@ 2021-11-14 18:08 ` Stefan Monnier
2021-11-14 18:13 ` Lars Ingebrigtsen
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2021-11-14 18:08 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel
>> Then again, you can also do:
>>
>> (insert
>> (propertize "xxxx" 'cursor-intangible t)
>> (propertize "x"))
>
> Sure, but I thought it was more pedagogical with the rear-nonsticky.
I don't have a preference, but I feel like the text should try and
explain that there are options and that the example is just
one approach. At the same time, it seems "out of scope".
I guess what I'm getting it is that we should not have to clarify this
here but should instead point to some other place that explains those
issues in general.
Maybe we should point out that the effect of the property is only
relevant on *positions* between chars, as defined by
`get-pos-property`.
>> or
>>
>> (insert
>> (propertize "xxxxx" 'cursor-intangible t 'rear-nonsticky t))
>
> Nope; doesn't work.
Bummer!
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: master 370d403: Explain in the manual how to make `cursor-intangible' work
2021-11-14 18:08 ` Stefan Monnier
@ 2021-11-14 18:13 ` Lars Ingebrigtsen
2021-11-14 18:24 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-14 18:13 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> I don't have a preference, but I feel like the text should try and
> explain that there are options and that the example is just
> one approach. At the same time, it seems "out of scope".
>
> I guess what I'm getting it is that we should not have to clarify this
> here but should instead point to some other place that explains those
> issues in general.
>
> Maybe we should point out that the effect of the property is only
> relevant on *positions* between chars, as defined by
> `get-pos-property`.
Have some mercy on the poor, poor programmers. They just want to insert
some characters into the buffer that the cursor skips over, not gain
deep, lasting insights in the Emacs display machinery.
An example is worth more than three essays on intervals in general.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: master 370d403: Explain in the manual how to make `cursor-intangible' work
2021-11-14 18:13 ` Lars Ingebrigtsen
@ 2021-11-14 18:24 ` Stefan Monnier
2021-11-14 18:39 ` Lars Ingebrigtsen
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2021-11-14 18:24 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel
Lars Ingebrigtsen [2021-11-14 19:13:23] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> I don't have a preference, but I feel like the text should try and
>> explain that there are options and that the example is just
>> one approach. At the same time, it seems "out of scope".
>>
>> I guess what I'm getting it is that we should not have to clarify this
>> here but should instead point to some other place that explains those
>> issues in general.
>>
>> Maybe we should point out that the effect of the property is only
>> relevant on *positions* between chars, as defined by
>> `get-pos-property`.
>
> Have some mercy on the poor, poor programmers. They just want to insert
> some characters into the buffer that the cursor skips over, not gain
> deep, lasting insights in the Emacs display machinery.
>
> An example is worth more than three essays on intervals in general.
Note that in your example of 5 X where you want the cursor to be able to
jump from "just before XXXXX" to "just after XXXXX", your 5 X are not
"intangible" since you can jump from before to after (you might call
them "atomic" maybe, but "intangible" doesn't seem quite right).
That's why the code behaves as it does: If you have " XXXX " and want to
make "XXXX" intangible (i.e. make it so the cursor pretends that "XXXX"
isn't there, i.e. it takes two `C-f` to move from beginning to end),
then you place `cursor-intangible` on those "XXXX" and nothing more.
No special "extra char" or stickness involved.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: master 370d403: Explain in the manual how to make `cursor-intangible' work
2021-11-14 18:24 ` Stefan Monnier
@ 2021-11-14 18:39 ` Lars Ingebrigtsen
2021-11-14 22:33 ` Stefan Monnier
0 siblings, 1 reply; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-14 18:39 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Note that in your example of 5 X where you want the cursor to be able to
> jump from "just before XXXXX" to "just after XXXXX", your 5 X are not
> "intangible" since you can jump from before to after (you might call
> them "atomic" maybe, but "intangible" doesn't seem quite right).
I don't think I was the one who called this `cursor-intangible', was it?
People use it to make the cursor skip in fun ways, but `intangible' is
an odd name for it.
> That's why the code behaves as it does: If you have " XXXX " and want to
> make "XXXX" intangible (i.e. make it so the cursor pretends that "XXXX"
> isn't there, i.e. it takes two `C-f` to move from beginning to end),
> then you place `cursor-intangible` on those "XXXX" and nothing more.
> No special "extra char" or stickness involved.
Yes there is. See bug#51095 for somebody who's understandably confused
about what it all means.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: master 370d403: Explain in the manual how to make `cursor-intangible' work
2021-11-14 18:39 ` Lars Ingebrigtsen
@ 2021-11-14 22:33 ` Stefan Monnier
2021-11-15 5:51 ` Lars Ingebrigtsen
0 siblings, 1 reply; 8+ messages in thread
From: Stefan Monnier @ 2021-11-14 22:33 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel
Lars Ingebrigtsen [2021-11-14 19:39:35] wrote:
> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> Note that in your example of 5 X where you want the cursor to be able to
>> jump from "just before XXXXX" to "just after XXXXX", your 5 X are not
>> "intangible" since you can jump from before to after (you might call
>> them "atomic" maybe, but "intangible" doesn't seem quite right).
>
> I don't think I was the one who called this `cursor-intangible', was it?
> People use it to make the cursor skip in fun ways, but `intangible' is
> an odd name for it.
If you read my description carefully, you'll see that the text marked
with `cursor-intangible` is indeed intangible. It's only when you want
it to be "atomic" that you need to do something funny (like place the
`cursor-intangible` on all-but-one char). So I think "intangible" is
not a bad choice (tho, indeed, it's a largely accidental/historical
name inherited from the deprecated `intangible` property).
> Yes there is. See bug#51095 for somebody who's understandably confused
> about what it all means.
Agreed. But I think your code example just makes it seem like the
current behavior is just wrong, whereas the problem is that it
implements something a bit different from what the OP wanted.
So I think we should better explain our meaning of "intangible" and then
explain how it might relate to a notion of "atomicity" (and how to get
that when you want it).
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: master 370d403: Explain in the manual how to make `cursor-intangible' work
2021-11-14 22:33 ` Stefan Monnier
@ 2021-11-15 5:51 ` Lars Ingebrigtsen
0 siblings, 0 replies; 8+ messages in thread
From: Lars Ingebrigtsen @ 2021-11-15 5:51 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> Agreed. But I think your code example just makes it seem like the
> current behavior is just wrong, whereas the problem is that it
> implements something a bit different from what the OP wanted.
I don't really see how the example makes it seem that the current
behaviour is wrong. It just demonstrates the (non-obvious) effect that
rear-nonsticky has here.
> So I think we should better explain our meaning of "intangible" and then
> explain how it might relate to a notion of "atomicity" (and how to get
> that when you want it).
Sounds a bit academic to me.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2021-11-15 5:51 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20211114021443.12484.87085@vcs0.savannah.gnu.org>
[not found] ` <20211114021444.BD421209C6@vcs0.savannah.gnu.org>
2021-11-14 16:05 ` master 370d403: Explain in the manual how to make `cursor-intangible' work Stefan Monnier
2021-11-14 16:09 ` Lars Ingebrigtsen
2021-11-14 18:08 ` Stefan Monnier
2021-11-14 18:13 ` Lars Ingebrigtsen
2021-11-14 18:24 ` Stefan Monnier
2021-11-14 18:39 ` Lars Ingebrigtsen
2021-11-14 22:33 ` Stefan Monnier
2021-11-15 5:51 ` 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).