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