summary refs log tree commit diff stats
path: root/lisp
diff options
context:
space:
mode:
Diffstat (limited to 'lisp')
-rw-r--r--lisp/+org.el49
1 files changed, 49 insertions, 0 deletions
diff --git a/lisp/+org.el b/lisp/+org.el index 77c9836..7b4ac4a 100644 --- a/lisp/+org.el +++ b/lisp/+org.el
@@ -542,5 +542,54 @@ language name.")
542;; `org-verbatim' and `org-code' are apparently already things, so we skip them 542;; `org-verbatim' and `org-code' are apparently already things, so we skip them
543;; here. 543;; here.
544 544
545;;; Copy org trees as HTML
546
547;; Thanks to Oleh Krehel, via [[https://emacs.stackexchange.com/questions/54292/copy-results-of-org-export-directly-to-clipboard][this StackExchange question]].
548(defun +org-export-clip-to-html
549 (&optional async subtreep visible-only body-only ext-plist post-process)
550 "Export region to HTML, and copy it to the clipboard.
551Arguments ASYNC, SUBTREEP, VISIBLE-ONLY, BODY-ONLY, EXT-PLIST,
552and POST-PROCESS are passed to `org-export-to-file'."
553 (message "Exporting Org to HTML...")
554 (let ((org-tmp-file "/tmp/org.html"))
555 (org-export-to-file 'html org-tmp-file
556 async subtreep visible-only body-only ext-plist post-process)
557 (start-process "xclicp" "*xclip*"
558 "xclip" "-verbose"
559 "-i" org-tmp-file
560 "-t" "text/html"
561 "-selection" "clipboard"))
562 (message "Exporting Org to HTML...done."))
563
564;; Specialized functions
565(defun +org-export-clip-subtree-to-html ()
566 "Export current subtree to HTML."
567 (interactive)
568 (+org-export-clip-to-html nil :subtree nil :body-only))
569
570;;; Taskwise functions
571;; TODO: break out into another library
572
573(defun +org-upto-task ()
574 "Go to the heading of the current task."
575 (interactive)
576 (while (not (org-get-todo-state))
577 (org-up-heading-or-point-min)))
578
579(defun +org-narrow-to-task ()
580 "Narrow the buffer to current task."
581 (interactive)
582 (+org-upto-task)
583 (org-narrow-to-subtree))
584
585(defun +org-task-clock-in (&optional select start-time)
586 "Start the clock on the current task.
587SELECT and START-TIME, if provided, are passed on to
588`org-clock-in'."
589 (interactive)
590 (save-excursion
591 (+org-upto-task)
592 (call-interactively #'org-clock-in)))
593
545(provide '+org) 594(provide '+org)
546;;; +org.el ends here 595;;; +org.el ends here