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 ;; 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