From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: invisible text and navigation commands Date: Mon, 02 Oct 2017 19:20:42 +0300 Message-ID: <837ewd34it.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1506961273 8906 195.159.176.226 (2 Oct 2017 16:21:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 2 Oct 2017 16:21:13 +0000 (UTC) Cc: emacs-devel@gnu.org To: Paul Pogonyshev Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Oct 02 18:21:08 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dz3Sp-0001YW-9n for ged-emacs-devel@m.gmane.org; Mon, 02 Oct 2017 18:21:03 +0200 Original-Received: from localhost ([::1]:53289 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz3Sw-0001Ld-Jj for ged-emacs-devel@m.gmane.org; Mon, 02 Oct 2017 12:21:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58904) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz3Sp-0001LL-EL for emacs-devel@gnu.org; Mon, 02 Oct 2017 12:21:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dz3Sm-0003zs-86 for emacs-devel@gnu.org; Mon, 02 Oct 2017 12:21:03 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:42581) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dz3Sm-0003zo-4E; Mon, 02 Oct 2017 12:21:00 -0400 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:2021 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1dz3Sl-0007Mc-Ep; Mon, 02 Oct 2017 12:20:59 -0400 In-reply-to: (message from Paul Pogonyshev on Sun, 1 Oct 2017 21:21:12 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:219016 Archived-At: > From: Paul Pogonyshev > 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.