org-display-inline-images: Expand environment variables in image path

* lisp/org.el (org-display-inline-images): Expand environment
variables in the link path, just like `org-open-file' does.

Reported-by: Pan Xie <xiepan@skyguard.com.cn>
Link: https://orgmode.org/list/7a012430-6084-e693-1a86-f14d0512bebc@skyguard.com.cn
This commit is contained in:
Ihor Radchenko 2023-05-31 11:20:02 +03:00
parent 24ed8b204e
commit 3123caa8e9
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 2 additions and 0 deletions

View File

@ -16378,6 +16378,8 @@ buffer boundaries with possible narrowing."
(require 'org-attach)
(ignore-errors (org-attach-expand path)))
(expand-file-name path))))
;; Expand environment variables.
(when file (setq file (substitute-in-file-name file)))
(when (and file (file-exists-p file))
(let ((width (org-display-inline-image--width link))
(old (get-char-property-and-overlay