From: Fabrice Popineau <fabrice.popineau@gmail.com>
To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>
Subject: Display inline images for shortcuts links
Date: Thu, 17 Aug 2017 14:20:45 +0200 [thread overview]
Message-ID: <CAFgFV9PffGXUjCcGzXS7Tj2R+O-a9HrKTBEHY9hd5MaBoSx1Og@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1494 bytes --]
Would it be possible to enable inline images for shortcuts links ?
Currently, the function `org-display-inline-images' checks for a hard coded
file: link.
In the case of :
#+LINK: temp file:c:/temp/%h
[[file:cover.jpg]]
[[temp:cover.jpg]]
The first link will be matched, but not the second one.
(Unless I missed something?)
A small patch like the one attached enables to display inline images for
all links.
But maybe relying on the org-element API is not the smarter move here.
( I voluntarily kept the old lines commented in the patch. )
Regards,
Fabrice
diff --git a/lisp/org.el b/lisp/org.el
index b05eac57e..0b45ecec2 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -19398,9 +19398,12 @@ boundaries."
(org-with-wide-buffer
(goto-char (or beg (point-min)))
(let ((case-fold-search t)
- (file-extension-re (image-file-name-regexp)))
- (while (re-search-forward "[][]\\[\\(?:file\\|[./~]\\)" end t)
- (let ((link (save-match-data (org-element-context))))
+ (file-extension-re (image-file-name-regexp))
+ (parse-tree (org-element-parse-buffer)))
+ (org-element-map parse-tree 'link
+ (lambda (link)
+ ;; (while (re-search-forward "[][]\\[\\(?:file\\|[./~]\\)" end
t)
+ ;; (let ((link (save-match-data (org-element-context))))))
;; Check if we're at an inline image.
(when (and (equal (org-element-property :type link) "file")
(or include-linked
[-- Attachment #2: Type: text/html, Size: 2152 bytes --]
next reply other threads:[~2017-08-17 12:21 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-17 12:20 Fabrice Popineau [this message]
2017-08-17 13:59 ` Display inline images for shortcuts links Nicolas Goaziou
2017-08-17 20:05 ` Fabrice Popineau
2017-08-18 10:06 ` Fabrice Popineau
2017-08-18 10:27 ` Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFgFV9PffGXUjCcGzXS7Tj2R+O-a9HrKTBEHY9hd5MaBoSx1Og@mail.gmail.com \
--to=fabrice.popineau@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.