1
0
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-11-22 07:09:47 +00:00

org.el: inline display of attached images in link descriptions

* lisp/org.el (org-display-inline-images): inline display of attached
images in link descriptions.

Previously, `org-display-inline-images' only inlined images in link
descriptions when they were explicit "file:" links. This change adds
support for "attachment:" links. E.g.:

    [[https://orgmode.org][attachment:emacs-screenshot.png]]
This commit is contained in:
Steven Allen 2023-06-01 11:49:19 -07:00 committed by Ihor Radchenko
parent ef891067a2
commit f2e71ee726
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B

View File

@ -16253,7 +16253,8 @@ conventions:
2. Its description consists in a single link of the previous
type. In this case, that link must be a well-formed plain
or angle link, i.e., it must have an explicit \"file\" type.
or angle link, i.e., it must have an explicit \"file\" or
\"attachment\" type.
Equip each image with the key-map `image-map'.
@ -16284,7 +16285,7 @@ buffer boundaries with possible narrowing."
;; "file:" links. Also check link abbreviations since
;; some might expand to "file" links.
(file-types-re
(format "\\[\\[\\(?:file%s:\\|attachment:\\|[./~]\\)\\|\\]\\[\\(<?file:\\)"
(format "\\[\\[\\(?:file%s:\\|attachment:\\|[./~]\\)\\|\\]\\[\\(<?\\(?:file\\|attachment\\):\\)"
(if (not link-abbrevs) ""
(concat "\\|" (regexp-opt link-abbrevs))))))
(while (re-search-forward file-types-re end t)
@ -16323,7 +16324,9 @@ buffer boundaries with possible narrowing."
;; description.
(= (org-element-property :contents-end link)
(match-end 0))
(match-string 2)))))))
(progn
(setq linktype (match-string 1))
(match-string 2))))))))
(when (and path (string-match-p file-extension-re path))
(let ((file (if (equal "attachment" linktype)
(progn