[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org d4522dd4df: lisp/org.el: Fix toggling overlays in r
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org d4522dd4df: lisp/org.el: Fix toggling overlays in region |
Date: |
Wed, 23 Nov 2022 21:57:56 -0500 (EST) |
branch: externals/org
commit d4522dd4df66be128662a0f2b26163e99c3b4f93
Author: Ihor Radchenko <yantar92@posteo.net>
Commit: Ihor Radchenko <yantar92@posteo.net>
lisp/org.el: Fix toggling overlays in region
* lisp/org.el (org--inline-image-overlays): New function returning
overlays in region.
(org-toggle-inline-images): Respect BEG and END arguments when
determining presence of overlays.
(org-remove-inline-images): Clear up deleted overlays.
Reported-by: William Denton <wtd@pobox.com>
Link:
https://orgmode.org/list/alpine.DEB.2.22.394.2211221559080.61289@shell3.miskatonic.org
---
lisp/org.el | 31 +++++++++++++++++++++++--------
1 file changed, 23 insertions(+), 8 deletions(-)
diff --git a/lisp/org.el b/lisp/org.el
index 26a8db3535..64b33e5976 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16136,21 +16136,32 @@ SNIPPETS-P indicates if this is run to create snippet
images for HTML."
(defvar-local org-inline-image-overlays nil)
+(defun org--inline-image-overlays (&optional beg end)
+ "Return image overlays between BEG and END."
+ (let* ((beg (or beg (point-min)))
+ (end (or end (point-max)))
+ (overlays (overlays-in beg end))
+ result)
+ (dolist (ov overlays result)
+ (when (memq ov org-inline-image-overlays)
+ (push ov result)))))
+
(defun org-toggle-inline-images (&optional include-linked beg end)
"Toggle the display of inline images.
INCLUDE-LINKED is passed to `org-display-inline-images'."
(interactive "P")
- (if org-inline-image-overlays
+ (if (org--inline-image-overlays beg end)
(progn
- (org-remove-inline-images beg end)
- (when (called-interactively-p 'interactive)
+ (org-remove-inline-images beg end)
+ (when (called-interactively-p 'interactive)
(message "Inline image display turned off")))
(org-display-inline-images include-linked nil beg end)
(when (called-interactively-p 'interactive)
- (message (if org-inline-image-overlays
- (format "%d images displayed inline"
- (length org-inline-image-overlays))
- "No images to display inline")))))
+ (let ((new (org--inline-image-overlays beg end)))
+ (message (if new
+ (format "%d images displayed inline"
+ (length new))
+ "No images to display inline"))))))
(defun org-redisplay-inline-images ()
"Assure display of inline images and refresh them."
@@ -16395,7 +16406,11 @@ buffer boundaries with possible narrowing."
(dolist (ov overlays)
(when (memq ov org-inline-image-overlays)
(setq org-inline-image-overlays (delq ov org-inline-image-overlays))
- (delete-overlay ov)))))
+ (delete-overlay ov)))
+ ;; Clear removed overlays.
+ (dolist (ov org-inline-image-overlays)
+ (unless (overlay-buffer ov)
+ (setq org-inline-image-overlays (delq ov
org-inline-image-overlays))))))
(defvar org-self-insert-command-undo-counter 0)
(defvar org-speed-command nil)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/org d4522dd4df: lisp/org.el: Fix toggling overlays in region,
ELPA Syncer <=