From 3fb025137b185eb91a5dbd6d0bf37956c70e67fb Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 17 Aug 2017 15:55:15 +0200 Subject: [PATCH] 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. --- lisp/org.el | 47 +++++++++++++++++++---------------------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 03a8acf17..6144d6c16 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) -- 2.11.4.GIT