diff options
author | Case Duckworth | 2021-09-29 17:23:41 -0500 |
---|---|---|
committer | Case Duckworth | 2021-09-29 17:23:41 -0500 |
commit | 8e5865b9157a0562ece360f4fc3eb7f2ecfc9d89 (patch) | |
tree | 763164c45aa8fa71e02000763079e091bf522a0d /lisp | |
parent | Change avy and link-hint binds to use j (diff) | |
download | emacs-8e5865b9157a0562ece360f4fc3eb7f2ecfc9d89.tar.gz emacs-8e5865b9157a0562ece360f4fc3eb7f2ecfc9d89.zip |
Track chd.el
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/chd.el | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/lisp/chd.el b/lisp/chd.el new file mode 100644 index 0000000..697c134 --- /dev/null +++ b/lisp/chd.el | |||
@@ -0,0 +1,49 @@ | |||
1 | ;;; chd.el --- CHD customizations -*- lexical-binding: t -*- | ||
2 | |||
3 | (require 'acdw-org) | ||
4 | (require 'org) | ||
5 | |||
6 | (defun chd/narrow-to-task (&optional point) | ||
7 | "Narrow the buffer to the task POINT is in." | ||
8 | (interactive "d") | ||
9 | (when point (goto-char point)) | ||
10 | (if (called-interactively-p 'interactive) | ||
11 | (save-excursion | ||
12 | (while (not (org-entry-is-todo-p)) | ||
13 | (acdw/org-previous-heading-widen 1)) | ||
14 | (org-narrow-to-subtree)) | ||
15 | ;; well this is dumb... | ||
16 | (while (not (org-entry-is-todo-p)) | ||
17 | (acdw/org-previous-heading-widen 1)) | ||
18 | (org-narrow-to-subtree))) | ||
19 | |||
20 | (defun chd/clock-in () | ||
21 | "Clock in to the current task." | ||
22 | (save-excursion | ||
23 | (chd/narrow-to-task) | ||
24 | (org-clock-in))) | ||
25 | |||
26 | (defun chd/do-the-thing () | ||
27 | "Copy the plain version of the current task and open its link." | ||
28 | (interactive) | ||
29 | (chd/narrow-to-task) | ||
30 | (save-excursion | ||
31 | ;; Prepare buffer | ||
32 | (acdw/flyspell-correct-f7) ; This is defined... elsewhere. | ||
33 | |||
34 | ;; Export the buffer and copy it | ||
35 | (pcase (org-entry-get (point-min) "EXPORTAS" t) | ||
36 | ("html" (acdw/org-export-copy-html)) | ||
37 | (_ (acdw/org-export-copy))) | ||
38 | |||
39 | ;; Open the link to the doc | ||
40 | (org-back-to-heading) | ||
41 | (org-open-at-point))) | ||
42 | |||
43 | ;;; NOTES | ||
44 | ;; org-protocol: https://orgmode.org/worg/org-contrib/org-protocol.html | ||
45 | ;; the bit i wanna pull from TaskIQ: 'document.getElementById("preview") | ||
46 | |||
47 | |||
48 | (provide 'chd) | ||
49 | ;;; chd.el ends here | ||