Compare commits

..

3 Commits

Author SHA1 Message Date
b798b13a94
Add capture template for quick notes
Am adding lots of quick notes, a capture template should be helpful here.
2025-11-16 17:53:07 +01:00
6565ad5933
Remove obsolete Org capture template 2025-11-16 17:29:03 +01:00
52b2c29644
Remove some obsolete function 2025-11-16 17:24:31 +01:00
2 changed files with 22 additions and 23 deletions

12
init.el
View File

@ -731,6 +731,7 @@ split horizontally again, but this extra work should not matter much."
db/find-parent-task
db/ensure-running-clock
db/save-current-org-task-to-file
db/goto-quick-notes
db/org-remaining-effort-of-current-item
db/org-cmp-remaining-effort
org-dblock-write:db/org-workload-report
@ -738,7 +739,6 @@ split horizontally again, but this extra work should not matter much."
endless/org-ispell
db/org-agenda-insert-active-filters
db/org-agenda-insert-efforts
db/org-timestamp-difference
db/org-capture-code-snippet
db/org-onenote-open
db/org-outlook-open
@ -1408,12 +1408,10 @@ accordingly."
:clock-resume t
:empty-lines-before 1
:empty-lines-after 1)
("r" "Respond"
entry
(file db/org-default-refile-file)
,(concat "* TODO [#B] Reply: %:subject (%:from) :EMAIL:\n"
":PROPERTIES:\n:CREATED: %U\n:END:\n"
"\n%a%?")
("q" "Quick note"
plain
(function db/goto-quick-notes)
"- [ ] %?"
:empty-lines-before 1
:empty-lines-after 1))))

View File

@ -335,22 +335,6 @@ Add this function to `org-agenda-finalize-hook' to enable this."
;;; Capturing
(defun db/org-timestamp-difference (stamp-1 stamp-2)
"Return time difference between two Org mode timestamps.
STAMP-1 and STAMP-2 must be understood by
`org-parse-time-string'."
;; Things copied from `org-clock-update-time-maybe
(let* ((s (-
(float-time
(apply #'encode-time (org-parse-time-string stamp-2 t)))
(float-time
(apply #'encode-time (org-parse-time-string stamp-1 t)))))
(neg (< s 0))
(s (abs s))
(h (floor (/ s 3600)))
(m (floor (/ (- s (* 3600 h)) 60))))
(format (if neg "-%d:%02d" "%2d:%02d") h m)))
;; Capture Code Snippets
;; from http://ul.io/nb/2018/04/30/better-code-snippets-with-org-capture/
(defun db/org-capture-code-snippet (filename)
@ -475,6 +459,23 @@ Via %%(with-temp-buffer (db/org-add-link-to-current-clock) (string-trim (buffer-
(delete-char -1))
(insert "\n\n"))))
(defun db/goto-quick-notes ()
"Go to position where next quick note should be inserted.
Quick notes are inserted into `db/org-default-refile-file', directly
before the first page feed character. Quick notes are expected to be
inserted as list items."
(unless (file-writable-p db/org-default-refile-file)
(user-error "Default refile file «%s» not writable" db/org-default-refile-file))
(set-buffer (find-file db/org-default-refile-file))
(unless (search-forward-regexp "^\f" nil t)
(user-error "No page feed found in default refile file"))
(beginning-of-line)
(open-line 2))
;;; Refiling