[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
An unexpected delay when making text invisible
From: |
Marcin Borkowski |
Subject: |
An unexpected delay when making text invisible |
Date: |
Mon, 01 Feb 2021 05:39:38 +0100 |
User-agent: |
mu4e 1.1.0; emacs 28.0.50 |
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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- An unexpected delay when making text invisible,
Marcin Borkowski <=