all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Pogonyshev <pogonyshev@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: invisible text and navigation commands
Date: Mon, 02 Oct 2017 19:20:42 +0300	[thread overview]
Message-ID: <837ewd34it.fsf@gnu.org> (raw)
In-Reply-To: <CAG7BpaqcLUAU_hWU8rDeVQSvnCMiNoqsYbzpYe59buYNQO+MpA@mail.gmail.com> (message from Paul Pogonyshev on Sun, 1 Oct 2017 21:21:12 +0200)

> From: Paul Pogonyshev <pogonyshev@gmail.com>
> 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.



  parent reply	other threads:[~2017-10-02 16:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-01 19:21 invisible text and navigation commands Paul Pogonyshev
2017-10-02 13:50 ` Robert Weiner
2017-10-02 17:15   ` Paul Pogonyshev
2017-10-02 16:20 ` Eli Zaretskii [this message]
2017-10-02 17:21   ` Paul Pogonyshev
2017-10-03  0:44     ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=837ewd34it.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=pogonyshev@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.