diff options
| -rw-r--r-- | etc/NEWS | 5 | ||||
| -rw-r--r-- | lisp/reveal.el | 34 |
2 files changed, 30 insertions, 9 deletions
| @@ -2130,6 +2130,11 @@ valid event type. | |||
| 2130 | 2130 | ||
| 2131 | * Lisp Changes in Emacs 27.1 | 2131 | * Lisp Changes in Emacs 27.1 |
| 2132 | 2132 | ||
| 2133 | ** 'reveal-mode' can now also be used for more than to toggle between | ||
| 2134 | invisible and visible: It can also toggle 'display' properties in | ||
| 2135 | overlays. This is only done on 'display' properties that have the | ||
| 2136 | 'reveal-toggle-invisible' property set. | ||
| 2137 | |||
| 2133 | +++ | 2138 | +++ |
| 2134 | ** 'process-contact' now takes an optional NO-BLOCK parameter to allow | 2139 | ** 'process-contact' now takes an optional NO-BLOCK parameter to allow |
| 2135 | not waiting for a process to be set up. | 2140 | not waiting for a process to be set up. |
diff --git a/lisp/reveal.el b/lisp/reveal.el index 67740c8149b..5483073474e 100644 --- a/lisp/reveal.el +++ b/lisp/reveal.el | |||
| @@ -26,6 +26,11 @@ | |||
| 26 | ;; is always visible. When point enters a region of hidden text, | 26 | ;; is always visible. When point enters a region of hidden text, |
| 27 | ;; `reveal-mode' temporarily makes it visible. | 27 | ;; `reveal-mode' temporarily makes it visible. |
| 28 | ;; | 28 | ;; |
| 29 | ;; Overlays can also use the `display' property. For them to be | ||
| 30 | ;; revealed, the `reveal-toggle-invisible' property also has to be | ||
| 31 | ;; present, and should be a function to toggle between having a | ||
| 32 | ;; display property and not. | ||
| 33 | ;; | ||
| 29 | ;; This is normally used in conjunction with `outline-minor-mode', | 34 | ;; This is normally used in conjunction with `outline-minor-mode', |
| 30 | ;; `hs-minor-mode', `hide-ifdef-mode', ... | 35 | ;; `hs-minor-mode', `hide-ifdef-mode', ... |
| 31 | ;; | 36 | ;; |
| @@ -103,21 +108,32 @@ Each element has the form (WINDOW . OVERLAY).") | |||
| 103 | (overlays-at (point)))) | 108 | (overlays-at (point)))) |
| 104 | (setq old-ols (delq ol old-ols)) | 109 | (setq old-ols (delq ol old-ols)) |
| 105 | (when (overlay-start ol) ;Check it's still live. | 110 | (when (overlay-start ol) ;Check it's still live. |
| 106 | (let ((inv (overlay-get ol 'invisible)) open) | 111 | ;; We either have an invisible overlay, or a display |
| 107 | (when (and inv | 112 | ;; overlay. Always reveal invisible text, but only reveal |
| 108 | ;; There's an `invisible' property. Make sure it's | 113 | ;; display properties if `reveal-toggle-invisible' is |
| 109 | ;; actually invisible, and ellipsized. | 114 | ;; present. |
| 110 | (and (consp buffer-invisibility-spec) | 115 | (let ((inv (overlay-get ol 'invisible)) |
| 111 | (cdr (assq inv buffer-invisibility-spec))) | 116 | (disp (and (overlay-get ol 'display) |
| 117 | (overlay-get ol 'reveal-toggle-invisible))) | ||
| 118 | open) | ||
| 119 | (when (and (or (and inv | ||
| 120 | ;; There's an `invisible' property. | ||
| 121 | ;; Make sure it's actually invisible, | ||
| 122 | ;; and ellipsized. | ||
| 123 | (and (consp buffer-invisibility-spec) | ||
| 124 | (cdr (assq inv buffer-invisibility-spec)))) | ||
| 125 | disp) | ||
| 112 | (or (setq open | 126 | (or (setq open |
| 113 | (or (overlay-get ol 'reveal-toggle-invisible) | 127 | (or (overlay-get ol 'reveal-toggle-invisible) |
| 114 | (and (symbolp inv) | 128 | (and (symbolp inv) |
| 115 | (get inv 'reveal-toggle-invisible)) | 129 | (get inv 'reveal-toggle-invisible)) |
| 116 | (overlay-get ol 'isearch-open-invisible-temporary))) | 130 | (overlay-get |
| 131 | ol 'isearch-open-invisible-temporary))) | ||
| 117 | (overlay-get ol 'isearch-open-invisible) | 132 | (overlay-get ol 'isearch-open-invisible) |
| 118 | (and (consp buffer-invisibility-spec) | 133 | (and (consp buffer-invisibility-spec) |
| 119 | (cdr (assq inv buffer-invisibility-spec)))) | 134 | (cdr (assq inv buffer-invisibility-spec))))) |
| 120 | (overlay-put ol 'reveal-invisible inv)) | 135 | (when inv |
| 136 | (overlay-put ol 'reveal-invisible inv)) | ||
| 121 | (push (cons (selected-window) ol) reveal-open-spots) | 137 | (push (cons (selected-window) ol) reveal-open-spots) |
| 122 | (if (null open) | 138 | (if (null open) |
| 123 | (overlay-put ol 'invisible nil) | 139 | (overlay-put ol 'invisible nil) |