[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: invisible text and navigation commands
From: |
Paul Pogonyshev |
Subject: |
Re: invisible text and navigation commands |
Date: |
Mon, 2 Oct 2017 19:21:38 +0200 |
> You didn't show an example
Sorry, I just thought there could be no misunderstandings. Your example
shows exactly what I meant, sort of confirming that.
> So for C-f and C-b you should
> already have what you want, but M-f and M-b is not covered, and you
> will have to write code similar to forward-visible-line.
That answers my question, though not in a way I'd hoped for :( It's
an overkill to
write a customized command for all of M-f, M-a and so on. I just wanted to
know if Emacs already has some variable like `ignore-invisible-text-when-moving'
which I could just bind to t in my mode and be done.
Paul
On 2 October 2017 at 18:20, Eli Zaretskii <address@hidden> wrote:
>> From: Paul Pogonyshev <address@hidden>
>> Date: Sun, 1 Oct 2017 21:21:12 +0200
>>
>> My mode implements filtering in a read-only buffer by attaching `invisible'
>> property to text chunks and then
>> modifying `buffer-invsibility-spec' variable. This way I can hide/show large
>> pieces of text pretty much instantly
>> and without modifying anything. However, I noticed that commands like M-f
>> etc. still "see through" the hidden
>> text and will stop at points where something is hidden.
>>
>> Question: is it somehow possible to make M-f and so on (of course, for
>> interactive use only) ignore invisible
>> text completely, as if it was not there at all? If not, could such a feature
>> be implemented in future?
>
> You didn't show an example, but I'm guessing that your invisible
> property causes "words" to appear on display which are made up from
> parts of words in the buffer text. IOW, you have something like this
> in the buffer:
>
> word1bla yak-yak word2
>
> and then you make the middle part of the text invisible such that
> what's displayed is this:
>
> word1word2
>
> and you then want M-f to move all the way to after '2', but what you
> see instead is that it stops at 'w' after '1'. Is that correct?
>
> Emacs already moves point to the first visible character after some
> command ends up with point on invisible text, but it never moves more
> than to the closest visible character. So for C-f and C-b you should
> already have what you want, but M-f and M-b is not covered, and you
> will have to write code similar to forward-visible-line.
>
> Note that there's a caveat here: when invisible text splices parts of
> words into "display words", the definition of what is a word for this
> purpose is not trivial. You should decide what exactly do you want to
> do before writing the code.