Org functions for fast current-date insert

This commit is contained in:
MitchMarq42 2022-09-24 19:02:57 -08:00
parent 19311193ee
commit a100cbf42f
2 changed files with 24 additions and 4 deletions

View File

@ -8,9 +8,9 @@
;;; Code: ;;; Code:
(defvar org-directory (expand-file-name "org/" "~")) (defvar org-directory (expand-file-name "org/" "~"))
(defvar org-agenda-files '("~/org/"))
(defvar org-vw-dir org-directory) ;; whoops (defvar org-vw-dir org-directory) ;; whoops
(defvar org-wiki-regex (defvar org-wiki-regex "\\`[^.].*\\.org\\'")
(rx (literal org-vw-dir) "/" (regexp ".+") ".org" eol))
(defun org-vw-get-filename (word) (defun org-vw-get-filename (word)
"Given WORD, generate the absolute filename for that org-vw entry." "Given WORD, generate the absolute filename for that org-vw entry."
@ -69,7 +69,24 @@
;; Below, I attempt to generalize tangling a whole directory of org files into ;; Below, I attempt to generalize tangling a whole directory of org files into
;; whichever export format, and then apply that. ;; whichever export format, and then apply that.
(require 'ox-hugo) ;; (require 'ox-hugo)
;; --------- LET THY BRAIN NO LONGER TREMBLE, FOR I AM BECOME COMPLETE ---------
(defun mitch-insert-current-datetime ()
"Insert the current date and time in my preffered format, with a newline at
the end."
(interactive)
(insert
(format "%s %s\n" (calendar-date-string (calendar-current-date))
(format-time-string "%-l:%M %p"))))
(defun mitch-2nd-heading-now ()
"Insert a brand new 2nd level Org heading containing the current date/time.
Start insert mode."
(interactive)
(insert "** ")
(mitch-insert-current-datetime)
(evil-insert 1))
(provide 'mitch-orgstuff) (provide 'mitch-orgstuff)
;;; mitch-orgstuff.el ends here ;;; mitch-orgstuff.el ends here

View File

@ -491,7 +491,10 @@ targets."
(add-hook 'after-save-hook (add-hook 'after-save-hook
#'(lambda () (if (equal major-mode 'org-mode) #'(lambda () (if (equal major-mode 'org-mode)
(org-babel-tangle)))) (org-babel-tangle))))
:hook (org-mode . turn-off-line-numbers)) (require 'mitch-orgstuff)
:hook
(org-mode . turn-off-line-numbers)
(org-mode . org-vw-mode))
(use-package org-tempo (use-package org-tempo
:straight (:type built-in) :straight (:type built-in)
:after org :after org