aboutsummaryrefslogtreecommitdiffstats
path: root/oni-org
diff options
context:
space:
mode:
authorGravatar Tom Willemse2021-06-30 11:12:50 -0700
committerGravatar Tom Willemse2021-06-30 11:12:50 -0700
commit9d74d0341d963dc0028e719508f9f9370133101a (patch)
tree889a919b476c5196b314b4dfe65dbce89aa360b9 /oni-org
parentcc07bf0f58abeffadcf8090654e4223458f44d5a (diff)
downloademacs-config-9d74d0341d963dc0028e719508f9f9370133101a.tar.gz
emacs-config-9d74d0341d963dc0028e719508f9f9370133101a.zip
[oni-org] Add function to enable showing inline images on startup
Diffstat (limited to 'oni-org')
-rw-r--r--oni-org/oni-org.el23
1 files changed, 21 insertions, 2 deletions
diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el
index df7348b..12c4c32 100644
--- a/oni-org/oni-org.el
+++ b/oni-org/oni-org.el
@@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local
-;; Version: 2021.0622.201820
+;; Version: 2021.0630.111102
;; Package-Requires: (oni-yasnippet oni-alert oni-hydra org org-contrib org-bullets org-edna diminish all-the-icons org-journal)
;; This program is free software; you can redistribute it and/or modify
@@ -56,6 +56,21 @@
(expand-file-name "icons" oni-org-root)
"The directory where ‘oni-org’ stores its icons.")
+(defun oni-org-document-add-inline-images-startup ()
+ "Add a line to the current org buffer that will make it load images inline."
+ (interactive)
+ (unless (derived-mode-p 'org-mode)
+ (error "Not currently in an org-mode buffer"))
+ (save-excursion
+ (goto-char (point-min))
+ (let ((header-end (or (search-forward "\n\n" nil t)
+ (point-max)))
+ (case-fold-search t))
+ (goto-char (point-min))
+ (unless (search-forward "#+startup: inlineimages" header-end t)
+ (goto-char (1- header-end))
+ (insert "#+STARTUP: inlineimages\n")))))
+
(defun oni-org-expand-to-home (file-name)
"Expand FILE-NAME to the base directory for that system.
The base for all org files on Windows is u:/, but on my linux
@@ -134,6 +149,9 @@ _l_: Store link ^^ _j_: Journal entry
^^ ^^ _f_: Add roam note
^^ ^^ _i_: Insert other note
^^ ^^ _I_: Insert and edit note
+^^ ^Document^^^
+^^^^^^------------------------------------------------------------------------
+_di_: Add inlineimages STARTUP
"
("l" org-store-link)
("a" org-agenda)
@@ -151,7 +169,8 @@ _l_: Store link ^^ _j_: Journal entry
(error "Couldn’t load org-roam, you should install ‘oni-org-roam’")))
("I" (if (require 'oni-org-roam nil t)
(call-interactively 'org-roam-insert)
- (error "Couldn’t load org-roam, you should install ‘oni-org-roam’"))))
+ (error "Couldn’t load org-roam, you should install ‘oni-org-roam’")))
+ ("di" oni-org-document-add-inline-images-startup))
(defun oni-org-in-dblock-p ()
"Non-nil when point belongs to a dynamic block."