diff options
author | Case Duckworth | 2021-09-15 17:33:49 -0500 |
---|---|---|
committer | Case Duckworth | 2021-09-15 17:33:49 -0500 |
commit | cbe051fd637dc529d271331a49582c9f60b26ba8 (patch) | |
tree | 61bac7cc6fe3d8aa1e8783bde9a1b26630551fb4 /lisp | |
parent | DO store customizations (diff) | |
download | emacs-cbe051fd637dc529d271331a49582c9f60b26ba8.tar.gz emacs-cbe051fd637dc529d271331a49582c9f60b26ba8.zip |
Add acdw/org-export-copy
Better'n `acdw/copy-region-plain'
Diffstat (limited to 'lisp')
-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 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)))) |