From 4497b54fb09ece5406dfcf09d940c0991cd70816 Mon Sep 17 00:00:00 2001 From: Gergely Polonkai Date: Thu, 18 Mar 2021 06:25:18 +0100 Subject: [PATCH] Add two new Org functions They help me insert timestamps, which can sometimes be tedious. --- configuration.org | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/configuration.org b/configuration.org index 4cddb76..e78dd7f 100644 --- a/configuration.org +++ b/configuration.org @@ -1090,6 +1090,31 @@ PRIORITY may be one of the characters ?A, ?B, or ?C." (org-agenda arg "c")) #+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 ** Tweak window chrome