Add two new Org functions

They help me insert timestamps, which can sometimes be tedious.
This commit is contained in:
Gergely Polonkai 2021-03-18 06:25:18 +01:00
parent a2164f7972
commit 4497b54fb0
No known key found for this signature in database
GPG Key ID: 2D2885533B869ED4
1 changed files with 25 additions and 0 deletions

View File

@ -1090,6 +1090,31 @@ PRIORITY may be one of the characters ?A, ?B, or ?C."
(org-agenda arg "c")) (org-agenda arg "c"))
#+end_src #+end_src
*** Insert the current timestamp
#+begin_src emacs-lisp
(defun gpolonkai/org-insert-current-timestamp (&optional arg)
"Insert the current timestamp"
(interactive "P")
(org-time-stamp '(16) arg))
#+end_src
*** Insert a heading with CREATED set to the current time
This emulates how Orgzly work with my current settings.
#+begin_src emacs-lisp
(defun gpolonkai/org-insert-heading-created (&optional arg)
(interactive "p")
(let* ((org-insert-heading-respect-content t)
(format-string (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]"))
(timestamp (format-time-string format-string (current-time))))
(if (> arg 1)
(org-insert-subheading '(4))
(org-insert-heading))
(org-set-property "CREATED" timestamp)))
#+end_src
* UI preferences * UI preferences
** Tweak window chrome ** Tweak window chrome