emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Daniel E. Doherty" <ded@ddoherty.net>
To: emacs-orgmode@gnu.org
Subject: Re: Bug: Display Inline Images from Subdirectory [9.4.4 (9.4.4-33-g5450d6-elpaplus @ /home/ded/.emacs.d/elpa/org-plus-contrib-20210322/)]
Date: Thu, 08 Apr 2021 06:57:00 -0500	[thread overview]
Message-ID: <87k0pdj7p0.fsf@ddoherty.net> (raw)
In-Reply-To: <87blaq6glc.fsf@alphaville.usersys.redhat.com>


On Tue, Apr 06 2021, Nick Dokos wrote:

>
> FWIW, this works fine for me: Org mode version 9.4.4
> (release_9.4.4-231-gf46925 @ /home/nick/elisp/org-mode/lisp/)
>
> The only things I had to do was 1) to make the above into a tree by
> adding a headline (otherwise, I guess org-mark-subtree would complain:
> Not in a subtree) and 2) create the dot subdirectory.

Nick,

Thanks for trying this out.  I tried this again using emacs -Q with both
emacs27 and emacs28, and I still get the same result, i.e., it produces
the link but does not display it inline.  Both versions supported
display of SVG graphics files.

,----[ Org and Emacs Versions ]
| Org version: Org mode version 9.4.4 (9.4.4-33-g5450d6-elpaplus @ 
  /home/ded/.emacs.d/elpa/org-plus-contrib-20210322/)
|
| GNU Emacs 28.0.50 (build 7, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, 
  cairo version 1.16.0) of 2021-04-02
|
| and
|
| GNU Emacs 27.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, 
  cairo version 1.16.0) of 2020-09-19
`----

I did the following:

1. Start emacs with the -Q flag
2. Load the file inline.el (shown below)
3. Create a directory 'dots' in the current directory
4. Open the file inline.org (shown below)
5. Run C-c C-c on the dot src block in inline.org and confirm execution
   of the block
6. Org creates the SVG file, but does not display it.
7. If I remove the ':dir dots' header argument, the image /does/ display
   inline.

,----[ inline.el ]
| (org-babel-do-load-languages
|  'org-babel-load-languages
|  '(
|    (dot . t)
|    (emacs-lisp . t)
|    (ruby . t)))
|
|
| (setq org-startup-with-inline-images t)
| (require 'subr-x)
| (defun ded:org-babel-inline-display-subtree ()
|   "Redisplay inline images in subtree if cursor in source block with 
    :result graphics."
|
|   (when (org-in-src-block-p)
|     (let (beg end)
|       (save-mark-and-excursion
|         (org-mark-subtree)
|         (setq beg (point))
|         (setq end (mark)))
|       (when-let ((info (org-babel-get-src-block-info t))
|                  (params (org-babel-process-params (nth 2 info)))
|                  (result-params (cdr (assq :result-params params)))
|                  ((member "graphics" result-params)))
|         (org-display-inline-images nil nil beg end)))))
|
| (add-hook 'org-babel-after-execute-hook 
  #'ded:org-babel-inline-display-subtree)
`----

,----[ inline.org ]
| * Supreme Court
| ** Blau v. Lehman, 368 U.S. 403 (1962).
| #+begin_SRC dot :file lehman.svg :cmdline -Kdot -Tsvg :results 
   graphics
|   digraph lehman {
|     Thomas [shape=circle];
|     TideWater [shape = box, label="Tide Water\nSecurities\n(Issuer)"];
|     Lehman [shape = box];
|     Thomas -> TideWater [label="Director"];
|     Lehman -> TideWater [label="Shareholder"];
|     Thomas -> Lehman [label="Partner"];
|   }
| #+end_SRC
`----

If others could try this out, I would appreciate it.

--
====================================================
Daniel E. Doherty
ded@ddoherty.net


  reply	other threads:[~2021-04-08 12:14 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-06 21:34 Bug: Display Inline Images from Subdirectory [9.4.4 (9.4.4-33-g5450d6-elpaplus @ /home/ded/.emacs.d/elpa/org-plus-contrib-20210322/)] Daniel E. Doherty
2021-04-07  1:14 ` Nick Dokos
2021-04-08 11:57   ` Daniel E. Doherty [this message]
2021-04-10 20:54     ` Kyle Meyer
2021-04-13 13:21       ` Daniel E. Doherty

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k0pdj7p0.fsf@ddoherty.net \
    --to=ded@ddoherty.net \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).