From 8e5865b9157a0562ece360f4fc3eb7f2ecfc9d89 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 29 Sep 2021 17:23:41 -0500 Subject: Track chd.el --- lisp/chd.el | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 lisp/chd.el (limited to 'lisp') 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 @@ +;;; chd.el --- CHD customizations -*- lexical-binding: t -*- + +(require 'acdw-org) +(require 'org) + +(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))) + +;;; 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 -- cgit 1.4.1-21-gabe81