about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lisp/acdw.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index 0790f2e..40aff5d 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el
@@ -395,6 +395,30 @@ first."
395 (setq deactivate-mark t) 395 (setq deactivate-mark t)
396 nil) 396 nil)
397 397
398(defun acdw/org-export-copy ()
399 "copy a tree"
400 (interactive)
401 (require 'ox-ascii)
402 (let ((extracted-heading (acdw/org-extract-heading-text)))
403 ;; Export to ASCII - not async, subtree only, visible-only, body-only
404 (let ((org-export-show-temporary-export-buffer nil))
405 (org-ascii-export-as-ascii nil t t t))
406 (with-current-buffer "*Org ASCII Export*"
407 (goto-char (point-min))
408 (insert extracted-heading)
409 (newline)
410 (newline)
411
412 (unfill-region (point-min) (point-max))
413 (flush-lines "^$" (point-min) (point-max))
414
415 (copy-region-as-kill (point-min) (point-max)))
416
417 (when (called-interactively-p 'interactive)
418 (indicate-copied-region))
419 (setq deactivate-mark t)
420 nil))
421
398(defun acdw/org-extract-heading-text () 422(defun acdw/org-extract-heading-text ()
399 "Extract the heading text from an `org-mode' heading." 423 "Extract the heading text from an `org-mode' heading."
400 (let ((heading (org-no-properties (org-get-heading t t t t)))) 424 (let ((heading (org-no-properties (org-get-heading t t t t))))