org: restrict inline image display to narrowed part

* lisp/org.el (org-display-inline-images): Clarify documentation and
  introduce the narrowing borders to the function.
This commit is contained in:
Marco Wahl 2019-11-22 11:29:26 +01:00
parent 3649d95b13
commit 43c086f4f7
1 changed files with 112 additions and 109 deletions

View File

@ -16661,14 +16661,17 @@ exported files will look like.
When optional argument REFRESH is non-nil, refresh existing
images between BEG and END. This will create new image displays
only if necessary. BEG and END default to the buffer
boundaries."
only if necessary.
BEG and END define the considered part. They default to the
buffer boundaries with possible narrowing."
(interactive "P")
(when (display-graphic-p)
(unless refresh
(org-remove-inline-images)
(when (fboundp 'clear-image-cache) (clear-image-cache)))
(org-with-point-at (or beg 1)
(let ((end (or end (point-max))))
(org-with-point-at (or beg (point-min))
(let* ((case-fold-search t)
(file-extension-re (image-file-name-regexp))
(link-abbrevs (mapcar #'car
@ -16774,7 +16777,7 @@ boundaries."
ov 'modification-hooks
(list 'org-display-inline-remove-overlay))
(overlay-put ov 'keymap image-map)
(push ov org-inline-image-overlays)))))))))))))))
(push ov org-inline-image-overlays))))))))))))))))
(defun org-display-inline-remove-overlay (ov after _beg _end &optional _len)
"Remove inline-display overlay if a corresponding region is modified."