diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-08-17 15:55:15 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-08-17 15:55:15 +0200 |
commit | 3fb025137b185eb91a5dbd6d0bf37956c70e67fb (patch) | |
tree | 9d316452821973afc383970878e5f69d62edab1a | |
parent | 6ec148a26390f830165791acb32f311d1b174276 (diff) | |
download | org-mode-3fb025137b185eb91a5dbd6d0bf37956c70e67fb.tar.gz |
Fix previous commit
* lisp/org.el (org-display-inline-images): Fix thinko in previous
commit. Also remove code related to nested links as this is no
longer possible in Org syntax.
-rw-r--r-- | lisp/org.el | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/lisp/org.el b/lisp/org.el index 03a8acf..6144d6c 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -19353,17 +19353,18 @@ boundaries." (when (fboundp 'clear-image-cache) (clear-image-cache))) (org-with-wide-buffer (goto-char (or beg (point-min))) - (let ((case-fold-search t) - (file-extension-re (image-file-name-regexp)) - (link-abbrevs (append org-link-abbrev-alist-local - org-link-abbrev-alist)) - ;; Check absolute, relative file names and explicit "file:" - ;; links. Also check link abbreviations since some might - ;; expand to "file" links. - (file-types-re (format "[][]\\[\\(?:file\\|[./~]%s\\)" - (and link-abbrevs - (format "\\|\\(?:%s:\\)" - (regexp-opt link-abbrevs)))))) + (let* ((case-fold-search t) + (file-extension-re (image-file-name-regexp)) + (link-abbrevs (mapcar #'car + (append org-link-abbrev-alist-local + org-link-abbrev-alist))) + ;; Check absolute, relative file names and explicit + ;; "file:" links. Also check link abbreviations since + ;; some might expand to "file" links. + (file-types-re (format "[][]\\[\\(?:file\\|[./~]%s\\)" + (and link-abbrevs + (format "\\|\\(?:%s:\\)" + (regexp-opt link-abbrevs)))))) (while (re-search-forward file-types-re end t) (let ((link (save-match-data (org-element-context)))) ;; Check if we're at an inline image, i.e., an image file @@ -19419,23 +19420,13 @@ boundaries." nil :width width))) (when image - (let* ((link - ;; If inline image is the description - ;; of another link, be sure to - ;; consider the latter as the one to - ;; apply the overlay on. - (let ((parent - (org-element-property :parent link))) - (if (eq (org-element-type parent) 'link) - parent - link))) - (ov (make-overlay - (org-element-property :begin link) - (progn - (goto-char - (org-element-property :end link)) - (skip-chars-backward " \t") - (point))))) + (let ((ov (make-overlay + (org-element-property :begin link) + (progn + (goto-char + (org-element-property :end link)) + (skip-chars-backward " \t") + (point))))) (overlay-put ov 'display image) (overlay-put ov 'face 'default) (overlay-put ov 'org-image-overlay t) |