* An unexpected delay when making text invisible
@ 2021-02-01 4:39 Marcin Borkowski
2021-02-01 14:50 ` Eli Zaretskii
2021-02-01 15:23 ` Stefan Monnier
0 siblings, 2 replies; 3+ messages in thread
From: Marcin Borkowski @ 2021-02-01 4:39 UTC (permalink / raw)
To: Help Gnu Emacs mailing list
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: An unexpected delay when making text invisible
2021-02-01 4:39 An unexpected delay when making text invisible Marcin Borkowski
@ 2021-02-01 14:50 ` Eli Zaretskii
2021-02-01 15:23 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Eli Zaretskii @ 2021-02-01 14:50 UTC (permalink / raw)
To: help-gnu-emacs
> From: Marcin Borkowski <mbork@mbork.pl>
> Date: Mon, 01 Feb 2021 05:39:38 +0100
>
> 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?
It's a bug, please report it. We probably need to add
buffer-invisibility-spec to the list at the end of frame.el.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: An unexpected delay when making text invisible
2021-02-01 4:39 An unexpected delay when making text invisible Marcin Borkowski
2021-02-01 14:50 ` Eli Zaretskii
@ 2021-02-01 15:23 ` Stefan Monnier
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2021-02-01 15:23 UTC (permalink / raw)
To: help-gnu-emacs
> 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.
When display is affected by the content of a *variable*, it's often
necessary to tell Emacs that the display is out-of-date by calling
`force-mode-line-update`.
If such a call solves your problem, please file a bug report (so
`add-to-invisibility-spec` calls it and you don't have to).
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-01 15:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-01 4:39 An unexpected delay when making text invisible Marcin Borkowski
2021-02-01 14:50 ` Eli Zaretskii
2021-02-01 15:23 ` Stefan Monnier
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).