diff options
Diffstat (limited to 'lisp/acdw.el')
-rw-r--r-- | lisp/acdw.el | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lisp/acdw.el b/lisp/acdw.el index d3b0bf9..dcf7b19 100644 --- a/lisp/acdw.el +++ b/lisp/acdw.el | |||
@@ -402,6 +402,30 @@ first." | |||
402 | (setq deactivate-mark t) | 402 | (setq deactivate-mark t) |
403 | nil) | 403 | nil) |
404 | 404 | ||
405 | (defun acdw/org-export-copy () | ||
406 | "copy a tree" | ||
407 | (interactive) | ||
408 | (require 'ox-ascii) | ||
409 | (let ((extracted-heading (acdw/org-extract-heading-text))) | ||
410 | ;; Export to ASCII - not async, subtree only, visible-only, body-only | ||
411 | (let ((org-export-show-temporary-export-buffer nil)) | ||
412 | (org-ascii-export-as-ascii nil t t t)) | ||
413 | (with-current-buffer "*Org ASCII Export*" | ||
414 | (goto-char (point-min)) | ||
415 | (insert extracted-heading) | ||
416 | (newline) | ||
417 | (newline) | ||
418 | |||
419 | (unfill-region (point-min) (point-max)) | ||
420 | (flush-lines "^$" (point-min) (point-max)) | ||
421 | |||
422 | (copy-region-as-kill (point-min) (point-max))) | ||
423 | |||
424 | (when (called-interactively-p 'interactive) | ||
425 | (indicate-copied-region)) | ||
426 | (setq deactivate-mark t) | ||
427 | nil)) | ||
428 | |||
405 | (defun acdw/org-extract-heading-text () | 429 | (defun acdw/org-extract-heading-text () |
406 | "Extract the heading text from an `org-mode' heading." | 430 | "Extract the heading text from an `org-mode' heading." |
407 | (let ((heading (org-no-properties (org-get-heading t t t t)))) | 431 | (let ((heading (org-no-properties (org-get-heading t t t t)))) |