fix(org): invisible inline images in org-tree-slide-mode

Our method of hiding meta lines (like '#+attr_org: ...') was too
effective; it ended up hiding the following image as well!

Fix #5524
This commit is contained in:
Henrik Lissner 2021-09-27 13:37:41 +02:00
parent 5f1a26290c
commit c92937f890

View file

@ -15,13 +15,6 @@
(remove-hook 'kill-buffer-hook #'+org-present--cleanup-org-tree-slides-mode (remove-hook 'kill-buffer-hook #'+org-present--cleanup-org-tree-slides-mode
'local))) 'local)))
(defun +org-present--make-invisible (beg end)
(unless (assq '+org-present buffer-invisibility-spec)
(add-to-invisibility-spec '(+org-present)))
(let ((overlay (make-overlay beg (1+ end))))
(push overlay +org-present--overlays)
(overlay-put overlay 'invisible '+org-present)))
;; ;;
;;; Hooks ;;; Hooks
@ -32,9 +25,10 @@
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "^[[:space:]]*\\(#\\+\\)\\(\\(?:BEGIN\\|END\\|ATTR\\)[^[:space:]]+\\).*" nil t) (while (re-search-forward "^[[:space:]]*\\(#\\+\\)\\(\\(?:BEGIN\\|END\\|ATTR\\)[^[:space:]]+\\).*" nil t)
(+org-present--make-invisible (org-flag-region (match-beginning 1)
(match-beginning 1) (match-end 0)
(match-end 0))))) org-tree-slide-mode
t))))
;;;###autoload ;;;###autoload
(defun +org-present-hide-leading-stars-h () (defun +org-present-hide-leading-stars-h ()
@ -42,7 +36,10 @@
(save-excursion (save-excursion
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward "^\\(\\*+\\)" nil t) (while (re-search-forward "^\\(\\*+\\)" nil t)
(+org-present--make-invisible (match-beginning 1) (match-end 1))))) (org-flag-region (match-beginning 1)
(match-end 1)
org-tree-slide-mode
t))))
;;;###autoload ;;;###autoload
(defun +org-present-remove-overlays-h () (defun +org-present-remove-overlays-h ()