diff --git a/init.el b/init.el index 51c9f7c..5e604b3 100644 --- a/init.el +++ b/init.el @@ -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 @@ -1406,6 +1407,12 @@ accordingly." :clock-in t :clock-resume t :empty-lines-before 1 + :empty-lines-after 1) + ("q" "Quick note" + plain + (function db/goto-quick-notes) + "- [ ] %?" + :empty-lines-before 1 :empty-lines-after 1)))) ;; Babel diff --git a/site-lisp/db-org.el b/site-lisp/db-org.el index f36c884..fd8d642 100644 --- a/site-lisp/db-org.el +++ b/site-lisp/db-org.el @@ -459,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