diff options
author | Tom Willemse | 2021-06-30 11:22:09 -0700 |
---|---|---|
committer | Tom Willemse | 2021-06-30 11:22:09 -0700 |
commit | 7f233420c8ce97ba79bf82f47c4f0138087301e1 (patch) | |
tree | b403657388737c1c6786aebc9b2cd4216dc1f104 | |
parent | 9d74d0341d963dc0028e719508f9f9370133101a (diff) | |
download | emacs-config-7f233420c8ce97ba79bf82f47c4f0138087301e1.tar.gz emacs-config-7f233420c8ce97ba79bf82f47c4f0138087301e1.zip |
[oni-org] Add functions to remove and toggle inlineimages
-rw-r--r-- | oni-org/oni-org.el | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/oni-org/oni-org.el b/oni-org/oni-org.el index 12c4c32..9b9605e 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.0630.111102 +;; Version: 2021.0630.112155 ;; 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 @@ -71,6 +71,36 @@ (goto-char (1- header-end)) (insert "#+STARTUP: inlineimages\n"))))) + (defun oni-org-document-remove-inline-images-startup () + "Remove 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)) + (when (search-forward "#+startup: inlineimages" header-end t) + (kill-whole-line))))) + +(defun oni-org-document-toggle-inline-images-startup () + "Add or remove 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)) + (if (search-forward "#+startup: inlineimages" header-end t) + (kill-whole-line) + (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 |