From e5c025158ef6e383aa892ef88e63a2a32de3d7fb Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Tue, 18 Oct 2022 12:08:21 -0500 Subject: Add a bunch of other stuff or whatever --- lisp/+org.el | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 lisp/+org.el (limited to 'lisp/+org.el') diff --git a/lisp/+org.el b/lisp/+org.el new file mode 100644 index 0000000..b17a1fa --- /dev/null +++ b/lisp/+org.el @@ -0,0 +1,44 @@ +;;; +org.el --- -*- lexical-binding: t -*- + +;;; Copy org trees as HTML + +;; Thanks to Oleh Krehel, via [[https://emacs.stackexchange.com/questions/54292/copy-results-of-org-export-directly-to-clipboard][this StackExchange question]]. +(defun +org-export-clip-to-html + (&optional async subtreep visible-only body-only ext-plist post-process) + "Export region to HTML, and copy it to the clipboard. +Arguments ASYNC, SUBTREEP, VISIBLE-ONLY, BODY-ONLY, EXT-PLIST, +and POST-PROCESS are passed to `org-export-to-file'." + (interactive) ; XXX: hould this be interactive? + (message "Exporting Org to HTML...") + (let ((org-tmp-file "/tmp/org.html")) + (org-export-to-file 'html org-tmp-file + async subtreep visible-only body-only ext-plist post-process) + (start-process "xclip" "*xclip*" + "xclip" "-verbose" + "-i" org-tmp-file + "-t" "text/html" + "-selection" "clipboard")) + (message "Exporting Org to HTML...done.")) + +;; Specialized functions +(defun +org-export-clip-subtree-to-html () + "Export current subtree to HTML." + (interactive) + (+org-export-clip-to-html nil :subtree)) + +;;; Unsmartify quotes and dashes and stuff. + +(defun +org-unsmartify () + "Replace \"smart\" punctuation with their \"dumb\" counterparts." + (interactive) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward "[“”‘’–—]" nil t) + (let ((replace (pcase (match-string 0) + ((or "“" "”") "\"") + ((or "‘" "’") "'") + ("–" "--") + ("—" "---")))) + (replace-match replace nil nil))))) + +(provide '+org) -- cgit 1.4.1-21-gabe81