emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: invisible text and navigation commands


From: Eli Zaretskii
Subject: Re: invisible text and navigation commands
Date: Mon, 02 Oct 2017 19:20:42 +0300

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]