From: Marcin Borkowski <mbork@mbork.pl>
To: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: An unexpected delay when making text invisible
Date: Mon, 01 Feb 2021 05:39:38 +0100 [thread overview]
Message-ID: <87zh0ommet.fsf@mbork.pl> (raw)
Hi all,
I'm not sure if this shouldn't go to bug-gnu-emacs, but I'll ask here
first, because it may happen that it's me who's doing something wrong.
I've been experimenting with the `invisible' text property, and
I noticed that after running `add-to-invisibility-spec' the text I want
to make invisible can still be seen - at least until I e.g. change
buffers. I thought that I needed to add `(redisplay)', but that didn't
help, either. Here is a piece of code which exhibits the issue.
--8<---------------cut here---------------start------------->8---
(defun invisibility-test-setup ()
"Set up the buffer for invisibility testing."
(interactive)
(switch-to-buffer "*Invisibility test*")
(erase-buffer)
(insert "This line is always visible.\nAnd this one not.")
(local-set-key (kbd "t") #'invisibility-test-toggle)
(goto-char (point-min))
(end-of-line)
(put-text-property (point) (point-max) 'invisible 'invisible-test-property))
(defvar invisibility-test-state t)
(defun invisibility-test-toggle ()
"Toggle the state of the second line."
(interactive)
(if invisibility-test-state
(remove-from-invisibility-spec 'invisible-test-property)
(add-to-invisibility-spec 'invisible-test-property))
(setq invisibility-test-state (not invisibility-test-state)))
--8<---------------cut here---------------end--------------->8---
I checked this in emacs -Q, too. Say M-x invisibility-test-setup and
then:
- if you say M-x invisibility-test-toggle, everything is fine - but
then, the buffer is changed from the minibuffer to some other one.
- if you press `t', nothing happens until you e.g. switch buffers (just
pressing M-x to change to the minibuffer is also enough).
Am I doing something wrong? I expected that pressing `t' would switch
between visible and invisible instantly. Why does it not?
TIA,
--
Marcin Borkowski
http://mbork.pl
next reply other threads:[~2021-02-01 4:39 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 4:39 Marcin Borkowski [this message]
2021-02-01 14:50 ` An unexpected delay when making text invisible Eli Zaretskii
2021-02-01 15:23 ` 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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zh0ommet.fsf@mbork.pl \
--to=mbork@mbork.pl \
--cc=help-gnu-emacs@gnu.org \
/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.
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).