summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2009-05-21 09:14:33 +0200
committerCarsten Dominik <carsten.dominik@gmail.com>2009-05-21 09:14:33 +0200
commit91f77d702944ea26d8aa80bff7c8de5d30faed12 (patch)
tree23b67524b91a386e86a916deb99b56424e6275bf
parent7c9a908ca4ab822656850b10c0743b84130a7fc2 (diff)
downloadorg-mode-91f77d702944ea26d8aa80bff7c8de5d30faed12.tar.gz
Export: Make all export commands push the result to the kill ring
All export commands now push the result to the kill ring by default. This is subject to the variable `org-export-push-to-kill-ring'. Also, this commit adds a new variable `org-export-show-temporary-export-buffer' which can be used to turn off the display of the temporary buffer containing the exported text. Since this stuff is now automatically pushed onto the kill ring, some people might prefer not to see this buffer.
-rwxr-xr-xlisp/ChangeLog34
-rw-r--r--lisp/org-ascii.el17
-rw-r--r--lisp/org-docbook.el6
-rw-r--r--lisp/org-exp.el25
-rw-r--r--lisp/org-html.el6
-rw-r--r--lisp/org-latex.el6
6 files changed, 74 insertions, 20 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 38f69f2..777d635 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,39 @@
2009-05-21 Carsten Dominik <carsten.dominik@gmail.com>
+ * org-exp.el (org-export-push-to-kill-ring): New function.
+ (org-export-copy-to-kill-ring): New option.
+
+ * org-latex.el (org-export-as-latex): Call
+ `org-export-push-to-kill-ring'.
+
+ * org-html.el (org-export-as-html): Call
+ `org-export-push-to-kill-ring'.
+
+ * org-docbook.el (org-export-as-docbook): Call
+ `org-export-push-to-kill-ring'.
+
+ * org-ascii.el (org-export-as-ascii): Call
+ `org-export-push-to-kill-ring'.
+
+ * org-exp.el (org-export-show-temporary-export-buffer): New
+ option.
+
+ * org-latex.el (org-export-as-latex): Use
+ `org-export-show-temporary-export-buffer'.
+
+ * org-html.el (org-export-as-html): Use
+ `org-export-show-temporary-export-buffer'.
+
+ * org-docbook.el (org-export-as-docbook): Use
+ `org-export-show-temporary-export-buffer'.
+
+ * org-ascii.el (org-export-as-ascii-to-buffer): Use
+ `org-export-show-temporary-export-buffer'.
+
+ * org-exp.el (org-export-show-temporary-export-buffer): New
+ option.
+ (org-export-push-to-kill-ring): New function.
+
* org-colview.el (org-columns-compile-map): New variable.
(org-columns-new, org-columns-compute)
(org-columns-number-to-string, org-columns-uncompile-format)
diff --git a/lisp/org-ascii.el b/lisp/org-ascii.el
index 8401352..427775f 100644
--- a/lisp/org-ascii.el
+++ b/lisp/org-ascii.el
@@ -33,12 +33,6 @@
:tag "Org Export ASCII"
:group 'org-export)
-(defcustom org-export-ascii-copy-to-kill t
- "Non-nil means, copy ASCII export aways to kill ring.
-This makes it easy to generate ASCII and then paste it."
- :group 'org-export-ascii
- :type 'boolean)
-
(defcustom org-export-ascii-underline '(?\$ ?\# ?^ ?\~ ?\= ?\-)
"Characters for underlining headings in ASCII export.
In the given sequence, these characters will be used for level 1, 2, ..."
@@ -72,7 +66,8 @@ in this way, it will be wrapped."
No file is created. The prefix ARG is passed through to `org-export-as-ascii'."
(interactive "P")
(org-export-as-ascii arg nil nil "*Org ASCII Export*")
- (switch-to-buffer-other-window "*Org ASCII Export*"))
+ (when org-export-show-temporary-export-buffer
+ (switch-to-buffer-other-window "*Org ASCII Export*")))
;;;###autoload
(defun org-replace-region-by-ascii (beg end)
@@ -458,12 +453,8 @@ publishing directory."
(goto-char beg)))
(or to-buffer (save-buffer))
(goto-char (point-min))
- (when org-export-ascii-copy-to-kill
- (kill-new (buffer-string))
- (when (fboundp 'x-set-selection)
- (x-set-selection 'PRIMARY (buffer-string))
- (x-set-selection 'CLIPBOARD (buffer-string)))
- (message "Exported ASCII pushed to kill ring and clipboard"))
+ (or (org-export-push-to-kill-ring "ASCII")
+ (message "Exporting... done"))
;; Return the buffer or a string, according to how this function was called
(if (eq to-buffer 'string)
(prog1 (buffer-substring (point-min) (point-max))
diff --git a/lisp/org-docbook.el b/lisp/org-docbook.el
index 11f65e3..4ccf9c7 100644
--- a/lisp/org-docbook.el
+++ b/lisp/org-docbook.el
@@ -263,7 +263,8 @@ $ emacs --batch
No file is created."
(interactive)
(org-export-as-docbook nil nil "*Org DocBook Export*")
- (switch-to-buffer-other-window "*Org DocBook Export*"))
+ (when org-export-show-temporary-export-buffer
+ (switch-to-buffer-other-window "*Org DocBook Export*")))
;;;###autoload
(defun org-replace-region-by-docbook (beg end)
@@ -1117,7 +1118,8 @@ publishing directory."
(insert "</article>"))
(or to-buffer (save-buffer))
(goto-char (point-min))
- (message "Exporting... done")
+ (or (org-export-push-to-kill-ring "DocBook")
+ (message "Exporting... done"))
(if (eq to-buffer 'string)
(prog1 (buffer-substring (point-min) (point-max))
(kill-buffer (current-buffer)))
diff --git a/lisp/org-exp.el b/lisp/org-exp.el
index e943192..5df5517 100644
--- a/lisp/org-exp.el
+++ b/lisp/org-exp.el
@@ -53,6 +53,20 @@
;; FIXME
(defvar org-export-publishing-directory nil)
+(defcustom org-export-show-temporary-export-buffer t
+ "Non-nil means, show buffer after exporting to temp buffer.
+When Org exports to a file, the buffer visiting that file is ever
+shown, but remains buried. However, when exporting to a temporary
+buffer, that buffer is popped up in a second window. When this variable
+is nil, the buffer remains buried also in these cases."
+ :group 'org-export-general
+ :type 'boolean)
+
+(defcustom org-export-copy-to-kill-ring t
+ "Non-nil means, exported stuff will also be pushed onto the kill ring."
+ :group 'org-export-general
+ :type 'boolean)
+
(defcustom org-export-run-in-background nil
"Non-nil means export and publishing commands will run in background.
This works by starting up a separate Emacs process visiting the same file
@@ -68,7 +82,6 @@ force an export command into the current process."
:group 'org-export-general
:type 'boolean)
-
(defcustom org-export-select-tags '("export")
"Tags that select a tree for export.
If any such tag is found in a buffer, all trees that do not carry one
@@ -2706,6 +2719,16 @@ stacked delimiters is N. Escaping delimiters is not possible."
(replace-match "%s" t t desc)
(or desc "%s"))))
+(defun org-export-push-to-kill-ring (format)
+ "Push buffer content to kill ring.
+The depends on the variable `org-export-copy-to-kill'."
+ (when org-export-copy-to-kill-ring
+ (kill-new (buffer-string))
+ (when (fboundp 'x-set-selection)
+ (x-set-selection 'PRIMARY (buffer-string))
+ (x-set-selection 'CLIPBOARD (buffer-string)))
+ (message "%s export done, pushed to kill ring and clipboard" format)))
+
(provide 'org-exp)
;; arch-tag: 65985fe9-095c-49c7-a7b6-cb4ee15c0a95
diff --git a/lisp/org-html.el b/lisp/org-html.el
index fe9a459..007ce5a 100644
--- a/lisp/org-html.el
+++ b/lisp/org-html.el
@@ -399,7 +399,8 @@ emacs --batch
No file is created. The prefix ARG is passed through to `org-export-as-html'."
(interactive "P")
(org-export-as-html arg nil nil "*Org HTML Export*")
- (switch-to-buffer-other-window "*Org HTML Export*"))
+ (when org-export-show-temporary-export-buffer
+ (switch-to-buffer-other-window "*Org HTML Export*")))
;;;###autoload
(defun org-replace-region-by-html (beg end)
@@ -1367,7 +1368,8 @@ lang=\"%s\" xml:lang=\"%s\">
(make-string n ?x)))))
(or to-buffer (save-buffer))
(goto-char (point-min))
- (message "Exporting... done")
+ (or (org-export-push-to-kill-ring "HTML")
+ (message "Exporting... done"))
(if (eq to-buffer 'string)
(prog1 (buffer-substring (point-min) (point-max))
(kill-buffer (current-buffer)))
diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index a69aa6d..5553858 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -363,7 +363,8 @@ emacs --batch
No file is created. The prefix ARG is passed through to `org-export-as-latex'."
(interactive "P")
(org-export-as-latex arg nil nil "*Org LaTeX Export*")
- (switch-to-buffer-other-window "*Org LaTeX Export*"))
+ (when org-export-show-temporary-export-buffer
+ (switch-to-buffer-other-window "*Org LaTeX Export*")))
;;;###autoload
(defun org-replace-region-by-latex (beg end)
@@ -585,7 +586,8 @@ when PUB-DIR is set, use this as the publishing directory."
(unless body-only (insert "\n\\end{document}"))
(or to-buffer (save-buffer))
(goto-char (point-min))
- (message "Exporting to LaTeX...done")
+ (or (org-export-push-to-kill-ring "LaTeX")
+ (message "Exporting to LaTeX...done"))
(prog1
(if (eq to-buffer 'string)
(prog1 (buffer-substring (point-min) (point-max))