Compare commits

..

No commits in common. "b798b13a94bcce5a7ec4c1da295090c4281dbfd5" and "4c37de8f714586491b55bac113e4826a8805c2c2" have entirely different histories.

2 changed files with 23 additions and 22 deletions

12
init.el
View File

@ -731,7 +731,6 @@ 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
@ -739,6 +738,7 @@ 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,10 +1408,12 @@ accordingly."
:clock-resume t
:empty-lines-before 1
:empty-lines-after 1)
("q" "Quick note"
plain
(function db/goto-quick-notes)
"- [ ] %?"
("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%?")
:empty-lines-before 1
:empty-lines-after 1))))

View File

@ -335,6 +335,22 @@ 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)
@ -459,23 +475,6 @@ 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