diff options
Diffstat (limited to 'lisp/chd.el')
-rw-r--r-- | lisp/chd.el | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/lisp/chd.el b/lisp/chd.el deleted file mode 100644 index c6efad0..0000000 --- a/lisp/chd.el +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | ;;; chd.el --- CHD customizations -*- lexical-binding: t -*- | ||
2 | |||
3 | (require 'acdw-org) | ||
4 | (require 'org) | ||
5 | |||
6 | (defvar chd/dir (acdw/sync-dir "Click Here Digital/") | ||
7 | "Where Click Here stuff is stored.") | ||
8 | |||
9 | (defun chd/dir (file &optional make-directory) | ||
10 | "Expand FILE relative to variable `chd/dir'. | ||
11 | If MAKE-DIRECTORY is non-nil, ensure the file's | ||
12 | containing directory exists." | ||
13 | (let ((file-name (expand-file-name (convert-standard-filename file) | ||
14 | chd/dir))) | ||
15 | (when make-directory | ||
16 | (make-directory (file-name-directory file-name) :parents)) | ||
17 | file-name)) | ||
18 | |||
19 | (defun chd/narrow-to-task (&optional point) | ||
20 | "Narrow the buffer to the task POINT is in." | ||
21 | (interactive "d") | ||
22 | (when point (goto-char point)) | ||
23 | (if (called-interactively-p 'interactive) | ||
24 | (save-excursion | ||
25 | (while (not (org-entry-is-todo-p)) | ||
26 | (acdw/org-previous-heading-widen 1)) | ||
27 | (org-narrow-to-subtree)) | ||
28 | ;; well this is dumb... | ||
29 | (while (not (org-entry-is-todo-p)) | ||
30 | (acdw/org-previous-heading-widen 1)) | ||
31 | (org-narrow-to-subtree))) | ||
32 | |||
33 | (defun chd/clock-in () | ||
34 | "Clock in to the current task." | ||
35 | (save-excursion | ||
36 | (chd/narrow-to-task) | ||
37 | (org-clock-in))) | ||
38 | |||
39 | (defun chd/do-the-thing () | ||
40 | "Copy the plain version of the current task and open its link." | ||
41 | (interactive) | ||
42 | (chd/narrow-to-task) | ||
43 | (save-excursion | ||
44 | ;; Prepare buffer | ||
45 | (acdw/flyspell-correct-f7) ; This is defined... elsewhere. | ||
46 | |||
47 | ;; Export the buffer and copy it | ||
48 | (pcase (org-entry-get (point-min) "EXPORTAS" t) | ||
49 | ("html" (acdw/org-export-copy-html)) | ||
50 | (_ (acdw/org-export-copy))) | ||
51 | |||
52 | ;; Open the link to the doc | ||
53 | (org-back-to-heading) | ||
54 | (org-open-at-point))) | ||
55 | |||
56 | (defun chd/insert-client () | ||
57 | "Insert the current client at point." | ||
58 | (interactive) | ||
59 | (if-let ((client (org-entry-get nil "CLIENT" :inherit))) | ||
60 | (insert client) | ||
61 | (beep) | ||
62 | (user-error "No client found in current subtree"))) | ||
63 | |||
64 | ;;; Click Bits! | ||
65 | (require 'acdw-autoinsert) | ||
66 | (require 'acdw) | ||
67 | (require 'private (acdw/sync-dir "private")) | ||
68 | (acdw/define-auto-insert '(:replace t) | ||
69 | (cons (chd/dir "Click Bits" t) "Click Bits!") | ||
70 | chd/click-bits-skeleton) | ||
71 | |||
72 | ;;; NOTES | ||
73 | ;; org-protocol: https://orgmode.org/worg/org-contrib/org-protocol.html | ||
74 | ;; the bit i wanna pull from TaskIQ: 'document.getElementById("preview") | ||
75 | (provide 'chd) | ||
76 | ;;; chd.el ends here | ||