mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-17 11:20:39 -08:00
Allow reveal.el to toggle `display' properties
* lisp/reveal.el (reveal-open-new-overlays): Allow also toggling `displa' overlay properties (bug#28785).
This commit is contained in:
parent
8147d939ae
commit
2c7224f894
2 changed files with 30 additions and 9 deletions
5
etc/NEWS
5
etc/NEWS
|
|
@ -2130,6 +2130,11 @@ valid event type.
|
||||||
|
|
||||||
* Lisp Changes in Emacs 27.1
|
* Lisp Changes in Emacs 27.1
|
||||||
|
|
||||||
|
** 'reveal-mode' can now also be used for more than to toggle between
|
||||||
|
invisible and visible: It can also toggle 'display' properties in
|
||||||
|
overlays. This is only done on 'display' properties that have the
|
||||||
|
'reveal-toggle-invisible' property set.
|
||||||
|
|
||||||
+++
|
+++
|
||||||
** 'process-contact' now takes an optional NO-BLOCK parameter to allow
|
** 'process-contact' now takes an optional NO-BLOCK parameter to allow
|
||||||
not waiting for a process to be set up.
|
not waiting for a process to be set up.
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,11 @@
|
||||||
;; is always visible. When point enters a region of hidden text,
|
;; is always visible. When point enters a region of hidden text,
|
||||||
;; `reveal-mode' temporarily makes it visible.
|
;; `reveal-mode' temporarily makes it visible.
|
||||||
;;
|
;;
|
||||||
|
;; Overlays can also use the `display' property. For them to be
|
||||||
|
;; revealed, the `reveal-toggle-invisible' property also has to be
|
||||||
|
;; present, and should be a function to toggle between having a
|
||||||
|
;; display property and not.
|
||||||
|
;;
|
||||||
;; This is normally used in conjunction with `outline-minor-mode',
|
;; This is normally used in conjunction with `outline-minor-mode',
|
||||||
;; `hs-minor-mode', `hide-ifdef-mode', ...
|
;; `hs-minor-mode', `hide-ifdef-mode', ...
|
||||||
;;
|
;;
|
||||||
|
|
@ -103,20 +108,31 @@ Each element has the form (WINDOW . OVERLAY).")
|
||||||
(overlays-at (point))))
|
(overlays-at (point))))
|
||||||
(setq old-ols (delq ol old-ols))
|
(setq old-ols (delq ol old-ols))
|
||||||
(when (overlay-start ol) ;Check it's still live.
|
(when (overlay-start ol) ;Check it's still live.
|
||||||
(let ((inv (overlay-get ol 'invisible)) open)
|
;; We either have an invisible overlay, or a display
|
||||||
(when (and inv
|
;; overlay. Always reveal invisible text, but only reveal
|
||||||
;; There's an `invisible' property. Make sure it's
|
;; display properties if `reveal-toggle-invisible' is
|
||||||
;; actually invisible, and ellipsized.
|
;; present.
|
||||||
|
(let ((inv (overlay-get ol 'invisible))
|
||||||
|
(disp (and (overlay-get ol 'display)
|
||||||
|
(overlay-get ol 'reveal-toggle-invisible)))
|
||||||
|
open)
|
||||||
|
(when (and (or (and inv
|
||||||
|
;; There's an `invisible' property.
|
||||||
|
;; Make sure it's actually invisible,
|
||||||
|
;; and ellipsized.
|
||||||
(and (consp buffer-invisibility-spec)
|
(and (consp buffer-invisibility-spec)
|
||||||
(cdr (assq inv buffer-invisibility-spec)))
|
(cdr (assq inv buffer-invisibility-spec))))
|
||||||
|
disp)
|
||||||
(or (setq open
|
(or (setq open
|
||||||
(or (overlay-get ol 'reveal-toggle-invisible)
|
(or (overlay-get ol 'reveal-toggle-invisible)
|
||||||
(and (symbolp inv)
|
(and (symbolp inv)
|
||||||
(get inv 'reveal-toggle-invisible))
|
(get inv 'reveal-toggle-invisible))
|
||||||
(overlay-get ol 'isearch-open-invisible-temporary)))
|
(overlay-get
|
||||||
|
ol 'isearch-open-invisible-temporary)))
|
||||||
(overlay-get ol 'isearch-open-invisible)
|
(overlay-get ol 'isearch-open-invisible)
|
||||||
(and (consp buffer-invisibility-spec)
|
(and (consp buffer-invisibility-spec)
|
||||||
(cdr (assq inv buffer-invisibility-spec))))
|
(cdr (assq inv buffer-invisibility-spec)))))
|
||||||
|
(when inv
|
||||||
(overlay-put ol 'reveal-invisible inv))
|
(overlay-put ol 'reveal-invisible inv))
|
||||||
(push (cons (selected-window) ol) reveal-open-spots)
|
(push (cons (selected-window) ol) reveal-open-spots)
|
||||||
(if (null open)
|
(if (null open)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue