[org] auto-insert timestamp in new headings

This commit is contained in:
contrapunctus 2021-05-28 13:43:51 +05:30
parent c909deb9cb
commit 457ba0b886
1 changed files with 15 additions and 10 deletions

View File

@ -1792,16 +1792,17 @@ _u_: next word ^_l_: edit lines^ _s_: next whole symbol
"xpm" "pbm" "pgm" "ppm" "webp") t)))))
;; https://lists.gnu.org/archive/html/emacs-orgmode/2018-02/msg00082.html
(defun org-link-gemini-export-link (link desc format)
"Create export version of LINK and DESC to FORMAT."
(let ((link (concat "gemini://" link)))
(cond
((eq format 'html)
(format "<a href=\"%s\">%s</a>" link desc))
((eq format 'latex)
(format "\\href{%s}{%s}" link desc))
(t ;; `ascii', `md', `hugo', etc.
(format "[%s](%s)" desc link)))))
(org-link-set-parameters "gemini" :export #'org-link-gemini-export-link))
"Create export version of LINK and DESC to FORMAT."
(let ((link (concat "gemini://" link)))
(cond
((eq format 'html)
(format "<a href=\"%s\">%s</a>" link desc))
((eq format 'latex)
(format "\\href{%s}{%s}" link desc))
(t ;; `ascii', `md', `hugo', etc.
(format "[%s](%s)" desc link)))))
(org-link-set-parameters "gemini" :export #'org-link-gemini-export-link)
(add-hook 'org-insert-heading-hook #'contrapunctus-org-insert-timestamp))
(defun cp-org-insert-block (type &optional lang)
"Insert block of TYPE at point, or at beginning and end of region.
@ -1925,6 +1926,10 @@ BUG - improper behaviour with checkboxes.
(mapconcat #'identity current-tags ",")
'org-tags-history)))))
(defun contrapunctus-org-insert-timestamp ()
(save-excursion
(insert "\n" "<" (format-time-string "%FT%T%z") ">")))
(use-package org-indent
:hook (org-mode . org-indent-mode))