From: "Daniel E. Doherty" <ded@ddoherty.net>
To: emacs-orgmode@gnu.org
Subject: 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: Tue, 06 Apr 2021 16:34:02 -0500 [thread overview]
Message-ID: <8735w3kshh.fsf@ddoherty.net> (raw)
I have a hook function (cribbed from Emacs Stack Exchange) to re-display
inline images in the current subtree after execution of a source block
if the header argument contains, ':results graphics'. As its last
action, it calls:
(org-display-inline-images nil nil beg end)
where beg and end have been set to the bounds of the current subtree.
This works perfectly if the image file is in the current directory. For
example, here is a block that displays as expected:
#+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
However, if I add a :dir header, it ceases to work:
#+begin_SRC dot :dir 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
#+RESULTS:
[[file:dot/lehman.svg]]
I have run edebug on the function, and the only difference I can detect
is the location of the image file in a subdirectory called 'dot'.
Here is my hook function, just for the record:
#+begin_SRC emacs-lisp
(setq org-startup-with-inline-images t)
(require 'subr-x)
(defun ded:org-babel-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-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-display-subtree)
#+end_SRC
------------------------------------------------------------------------
Emacs : GNU Emacs 28.0.50 (build 2, x86_64-pc-linux-gnu, GTK+ Version
3.24.20, cairo version 1.16.0)
of 2021-02-09
Package: Org mode version 9.4.4 (9.4.4-33-g5450d6-elpaplus @
/home/ded/.emacs.d/elpa/org-plus-contrib-20210322/)
current state:
==============
(setq
org-link-elisp-confirm-function 'yes-or-no-p
org-shiftdown-final-hook '(windmove-down)
org-directory "/home/ded/work/Projects/"
org-noter-notes-window-location 'other-frame
org-caldav-backup-file
"/home/ded/.emacs.d/ded/data/org-caldav-backup.org"
org-crypt-key "C0A9F2F0"
org-bibtex-headline-format-function #[257 "\300\236A\207" [:title] 3
"\n\n(fn ENTRY)"]
org-log-done 'time
org-log-into-drawer t
org-startup-folded 'overview
org-babel-after-execute-hook '(ded:org-babel-display-subtree)
org-link-abbrev-alist '(("bugzilla"
. "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
("google" . "http://www.google.com/search?q=")
("gmap" . "http://maps.google.com/maps?q=%s")
("omap" . "http://nominatim.openstreetmap.org/search?q=%s&polygon=1")
("ads" .
"http://adsabs.harvard.edu/cgi-bin/nph-abs_connect?author=%s&db_key=AST")
)
org-agenda-files "/home/ded/work/Projects/agenda-files"
org-capture-templates '(("t" "Todo Item" entry (file+headline
"Office.org" "Tasks")
"* TODO %? \n %a")
("a" "Appointment" entry (file+headline
"Office.org" "Appointments")
"* %? \n %a")
("p" "Phone Call Log" entry (file+headline
"Office.org" "Phone calls")
"* %U Phone call with %^{Name|%:name} \n\n
%?")
("l" "Link" entry (file+headline "Links.org"
"Links")
"* %a %^g\n %?\n %T\n %i")
("i" "Invoice" entry (file+headline
"Office.org" "Invoices")
"* %^T %^G\n %?")
("j" "Journal Entry" entry (file+olp+datetree
"Journal.org")
"* Entered on %U\n %i%?\n%a")
)
org-format-latex-options '(:foreground default :background default
:scale 1.6 :html-foreground
"Black" :html-background "Transparent"
:html-scale 1.0 :matchers
("begin" "$1" "$" "$$" "\\(" "\\["))
org-babel-noweb-wrap-end "»"
org-refile-targets '((nil :maxlevel . 3) (org-agenda-files :maxlevel
. 3))
org-export-before-parsing-hook '(org-attach-expand-links)
org-icalendar-exclude-tags '("noical")
org-refile-use-outline-path 'file
org-finalize-agenda-hook '(ded:org-agenda-to-appt)
org-archive-hook '(org-attach-archive-delete-maybe)
org-footnote-auto-adjust t
org-file-apps '((auto-mode . emacs) ("\\.mm\\'" . default)
("\\.x?html?\\'" . default)
("\\.pdf\\'" . default) ("ods" . "oocalc"))
org-odt-format-inlinetask-function
'org-odt-format-inlinetask-default-function
org-ascii-format-drawer-function #[771 "\207" [] 4 "\n\n(fn NAME
CONTENTS WIDTH)"]
org-cycle-hook '(org-cycle-hide-archived-subtrees
org-cycle-hide-drawers org-cycle-show-empty-lines
org-optimize-window-after-visibility-change)
org-noter-auto-save-last-location t
org-export-with-broken-links t
org-link-from-user-regexp "\\<ded@micah\\>\\|\\<Daniel E\\. Doherty\\>"
org-export-use-babel nil
org-noter-doc-property-in-notes t
org-clock-persist-query-save t
org-mode-hook '(#<subr
F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_7> org-tempo-setup
org-clock-load ded:org-hook beginend-org-mode
#[0 "\301\211\207" [imenu-create-index-function
org-imenu-get-tree] 2]
#[0 "\300\301\302\303\304$\207"
[add-hook change-major-mode-hook org-show-all append
local] 5]
#[0 "\300\301\302\303\304$\207"
[add-hook change-major-mode-hook
org-babel-show-result-all append local] 5]
org-babel-result-hide-spec org-babel-hide-all-hashes
org-eldoc-load)
org-babel-load-languages '((C) (C++) (R . t) (asymptote . t) (awk . t)
(calc . t) (clojure . t)
(css . t) (ditaa . t) (dot . t) (emacs-lisp
. t) (gnuplot . t)
(haskell . t) (js . t) (latex . t) (ledger
. t) (lisp . t)
(mathematica . t) (org . t) (perl . t)
(python . t) (ruby . t)
(scheme . t) (screen . t) (shell . t) (sql
. t) (sqlite . t))
org-shiftup-final-hook '(windmove-up)
org-mime-html-hook '((lambda nil
(org-mime-change-element-style "blockquote"
"border-left: 2px solid gray; padding-left:
4px;")
)
(lambda nil
(org-mime-change-element-style "pre"
(format "color: %s; background-color: %s;
padding: 0.5em;" "#E6E1DC" "#232323")
)
)
)
org-roam-directory "/home/ded/work/Projects/Notes"
org-table-copy-increment nil
outline-mode-hook '(beginend-outline-mode)
org-agenda-span 'day
org-latex-format-drawer-function #[514 "\207" [] 3 "\n\n(fn _
CONTENTS)"]
org-icalendar-use-scheduled '(event-if-todo event-if-not-todo
todo-start)
org-table-number-regexp
"^\\([<>]?[\\$,-+^.0-9]*[,0-9][-+^.0-9eEdDx()%:]*\\|[<>]?[-+]?0[xX][[:xdigit:].]+\\|[<>]?[-+]?[\\$0-9]+#[,0-9a-zA-Z.]+\\|nan\\|[-+u]?inf\\)$"
org-latex-format-headline-function
'org-latex-format-headline-default-function
org-babel-noweb-wrap-start "«"
org-confirm-shell-link-function 'yes-or-no-p
org-reveal-start-hook '(org-decrypt-entry)
org-noter-insert-note-no-questions t
org-html-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME
CONTENTS)"]
outline-isearch-open-invisible-function 'outline-isearch-open-invisible
org-use-sub-superscripts nil
org-roam-buffer-preview-function 'org-roam-buffer--preview
org-icalendar-include-todo t
org-roam-buffer-prepare-hook '(org-roam-buffer--insert-title
org-roam-buffer--insert-backlinks
org-roam-buffer--insert-ref-links)
org-startup-indented t
org-latex-classes '(("beamer" "\\documentclass[presentation]{beamer}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("article" "\\documentclass[11pt]{article}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("report" "\\documentclass[11pt]{report}"
("\\part{%s}" . "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("book" "\\documentclass[11pt]{book}" ("\\part{%s}"
. "\\part*{%s}")
("\\chapter{%s}" . "\\chapter*{%s}")
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}"))
("komaarticle" "\\documentclass[11pt]{scrartcl}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
("memo" "\\documentclass[11pt]{memo}"
("\\section{%s}" . "\\section*{%s}")
("\\subsection{%s}" . "\\subsection*{%s}")
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
("\\paragraph{%s}" . "\\paragraph*{%s}")
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))
)
org-table-auto-blank-field nil
org-highlight-latex-and-related '(latex)
org-odt-format-headline-function
'org-odt-format-headline-default-function
org-use-speed-commands t
org-src-ask-before-returning-to-edit-buffer nil
org-agenda-mode-hook '(beginend-org-agenda-mode)
org-latex-inactive-timestamp-format "\\textrm{%s}"
org-agenda-before-write-hook '(org-agenda-add-entry-text)
org-roam-title-change-hook '(org-roam--update-file-name-on-title-change
org-roam--update-links-on-title-change)
org-roam-dailies-calendar-hook
'(org-roam-dailies-calendar-mark-entries)
org-capture-prepare-finalize-hook '(org-roam-capture--install-finalize)
org-latex-packages-alist '(("" "minted") ("" "color") ("" "listings")
("" "booktabs"))
org-babel-tangle-lang-exts '(("ruby" . "rb") ("python" . "py") ("perl"
. "pl") ("mathematica" . "m")
("lisp" . "lisp") ("latex" . "tex")
("haskell" . "hs")
("clojurescript" . "cljs") ("clojure"
. "clj") ("awk" . "awk")
("asymptote" . "asy") ("emacs-lisp"
. "el") ("elisp" . "el"))
org-src-mode-hook '(doom-modeline-set-org-src-modeline
org-src-babel-configure-edit-buffer
org-src-mode-configure-edit-buffer)
org-icalendar-store-UID t
org-confirm-elisp-link-function 'yes-or-no-p
org-roam-title-to-slug-function 'org-roam--title-to-slug
org-noter-separate-notes-from-heading t
org-tags-exclude-from-inheritance '("crypt")
org-icalendar-include-body 1000
org-todo-keywords '((sequence "TODO(t)" "WAIT(w)" "|" "DONE(d)"
"CNCL(x)"))
org-roam-completion-system 'ivy
org-deadline-warning-days 5
org-mime-src-mode-hook '(org-mime-src-mode-configure-edit-buffer)
org-clock-out-hook '(org-clock-remove-empty-clock-drawer)
org-latex-listings 'minted
org-structure-template-alist '(("r" . "SRC ruby")
("d" . "SRC dot :file file_name.dot
:cmdline -Kdot -Tpng")
("m" . "SRC emacs-lisp") ("a" . "export
ascii") ("c" . "center")
("C" . "comment") ("e" . "example") ("E"
. "export")
("h" . "export html") ("l" . "export
latex") ("q" . "quote")
("s" . "src") ("v" . "verse"))
org-footnote-fill-after-inline-note-extraction t
org-shiftright-final-hook '(windmove-right)
org-speed-command-hook '(org-speed-command-activate
org-babel-speed-command-activate)
org-html-format-inlinetask-function
'org-html-format-inlinetask-default-function
org-clock-persist-file "/home/ded/.emacs.d/ded/cache/org-clock-save.el"
org-ascii-format-inlinetask-function
'org-ascii-format-inlinetask-default
org-caldav-files
'("/home/ded/work/ReviveInvestingLLC/CotyInc---Laubies/LaubiesPierre/2672973/CotyNotes.org"
"/home/ded/work/ReviveInvestingLLC/Pulte---PulteTrust/PulteNotes.org"
"/home/ded/work/ReviveInvestingLLC/AytuBiosciInc---Boyd/BoydSteven/2685394/AytuNotes.org"
"/home/ded/work/Projects/Nextcloud.org"
"/home/ded/work/Projects/Notes.org"
"/home/ded/work/Projects/Office.org" "/home/ded/work/Projects/Home.org"
"/home/ded/work/Projects/Invest.org")
org-icalendar-use-deadline '(event-if-todo event-if-not-todo todo-due)
org-latex-default-class "komaarticle"
org-latex-active-timestamp-format "\\textrm{%s}"
org-odt-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME
CONTENTS)"]
org-icalendar-combined-name "Org"
org-table-convert-region-max-lines 2000
org-export-backends '(ascii beamer html icalendar latex man odt
texinfo)
org-icalendar-alarm-time 60
org-icalendar-include-sexps nil
org-bullets-bullet-list '("① " "② " "③ " "④ " "⑤ " "⑥ " "⑦ " "⑧ "
"⑨ ")
org-confirm-babel-evaluate nil
org-icalendar-combined-description "Appointments from all org agenda
files"
org-export-with-smart-quotes t
org-export-with-email t
org-clock-persist 'history
org-latex-format-inlinetask-function
'org-latex-format-inlinetask-default-function
org-caldav-url "https://db1.ddoherty.net/remote.php/dav/calendars/ded"
org-tab-first-hook '(org-babel-hide-result-toggle-maybe
org-babel-header-arg-expand)
org-texinfo-format-headline-function
'org-texinfo-format-headline-default-function
org-link-shell-confirm-function 'yes-or-no-p
org-shiftleft-final-hook '(windmove-left)
org-babel-pre-tangle-hook '(save-buffer)
org-agenda-loop-over-headlines-in-active-region nil
org-attach-id-dir "/home/ded/.emacs.d/ded/data/"
org-noter-hide-other nil
org-noter-notes-search-path '("/home/ded/work/Projects/Notes")
org-occur-hook '(org-first-headline-recenter)
org-metadown-hook '(org-babel-pop-to-session-maybe)
org-link-parameters '(("attachment" :follow org-attach-follow :complete
org-attach-complete-link)
("mu4e" :follow mu4e-org-open :store
mu4e-org-store-link)
("eww" :follow org-eww-open :store
org-eww-store-link)
("rmail" :follow org-rmail-open :store
org-rmail-store-link)
("mhe" :follow org-mhe-open :store
org-mhe-store-link)
("irc" :follow org-irc-visit :store
org-irc-store-link :export org-irc-export)
("info" :follow org-info-open :export
org-info-export :store
org-info-store-link)
("gnus" :follow org-gnus-open :store
org-gnus-store-link)
("docview" :follow org-docview-open :export
org-docview-export :store
org-docview-store-link)
("bibtex" :follow org-bibtex-open :store
org-bibtex-store-link)
("bbdb" :follow org-bbdb-open :export
org-bbdb-export :complete
org-bbdb-complete-link :store
org-bbdb-store-link)
("w3m" :store org-w3m-store-link) ("roam" :follow
org-roam-link-follow-link)
("man" :follow org-man-open :export nil) ("id"
:follow org-id-open)
("elfeed" :follow elfeed-link-open :store
elfeed-link-store-link) ("file+sys")
("file+emacs") ("shell" :follow
org-link--open-shell)
("news" :follow
#[514 "\301\300\302Q\"\207" ["news" browse-url
":"] 6 "\n\n(fn URL ARG)"])
("mailto" :follow
#[514 "\301\300\302Q\"\207" ["mailto" browse-url
":"] 6 "\n\n(fn URL ARG)"]
)
("https" :follow
#[514 "\301\300\302Q\"\207" ["https" browse-url
":"] 6 "\n\n(fn URL ARG)"])
("http" :follow
#[514 "\301\300\302Q\"\207" ["http" browse-url
":"] 6 "\n\n(fn URL ARG)"])
("ftp" :follow
#[514 "\301\300\302Q\"\207" ["ftp" browse-url
":"] 6 "\n\n(fn URL ARG)"])
("help" :follow org-link--open-help) ("file"
:complete org-link-complete-file)
("elisp" :follow org-link--open-elisp) ("doi"
:follow org-link--open-doi))
org-roam-capture-function 'org-capture
org-html-format-headline-function
'org-html-format-headline-default-function
org-caldav-inbox "/home/ded/work/Projects/Nextcloud.org"
outline-minor-mode-hook-hook
'(outline-minor-faces-add-font-lock-keywords)
org-metaup-hook '(org-babel-load-in-session-maybe)
org-caldav-save-directory "/home/ded/work/Projects/"
org-refile-allow-creating-parent-nodes t
org-agenda-include-diary t
org-startup-with-inline-images t
org-footnote-define-inline t
org-speed-commands-user '(("0" . delete-window) ("1"
. delete-other-windows)
("2" . split-window-vertically) ("3"
. split-window-horizontally)
("h" . hide-other) ("k" . org-kill-note-or-show-branches)
("r" . org-reveal) ("s" . org-save-all-org-buffers)
("z" . org-add-note)
("J" . org-clock-goto))
org-return-follows-link t
org-outline-path-complete-in-steps nil
org-icalendar-combined-agenda-file
"/home/ded/work/Projects/cal/org.ics"
org-noter-always-create-frame nil
org-special-ctrl-a/e t
org-table-header-line-p t
org-caldav-calendar-id "D7FBFCCB-DED5-492E-9E60-E30D8767BF0C"
org-src-lang-modes '(("dot" . graphviz-dot) ("mathematica" . wolfram)
("redis" . redis) ("php" . php)
("arduino" . arduino) ("C" . c) ("C++" . c++)
("asymptote" . asy) ("bash" . sh)
("beamer" . latex) ("calc" . fundamental) ("cpp"
. c++) ("ditaa" . artist)
("dot" . fundamental) ("elisp" . emacs-lisp)
("ocaml" . tuareg)
("screen" . shell-script) ("shell" . sh) ("sqlite"
. sql))
org-tab-before-tab-emulation-hook '(org-tempo-complete-tag)
org-icalendar-categories '(category local-tags)
org-texinfo-format-inlinetask-function
'org-texinfo-format-inlinetask-default-function
org-caldav-resume-aborted 'always
org-clock-sound "/home/ded/.emacs.d/ded/etc/pill.ogg"
org-list-allow-alphabetical t
org-texinfo-format-drawer-function #[514 "\207" [] 3 "\n\n(fn NAME
CONTENTS)"]
)
--
====================================================
Daniel E. Doherty
ded@ddoherty.net
next reply other threads:[~2021-04-06 21:34 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-06 21:34 Daniel E. Doherty [this message]
2021-04-07 1:14 ` Bug: Display Inline Images from Subdirectory [9.4.4 (9.4.4-33-g5450d6-elpaplus @ /home/ded/.emacs.d/elpa/org-plus-contrib-20210322/)] Nick Dokos
2021-04-08 11:57 ` Daniel E. Doherty
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=8735w3kshh.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).