From 8c04fb72cbd3b84ad1f7e8d9dc30397bcc24f7cf Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 13 Dec 2012 00:38:46 +0100 Subject: [PATCH] org-exp.el (org-export-copy-to-kill-ring): Add a new choice 'if-interactive and use it as the default. * org-exp.el (org-export-copy-to-kill-ring): Add a new choice 'if-interactive and use it as the default. (org-export-push-to-kill-ring): Use the new choice. --- lisp/org-exp.el | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 6003595f3..f7155b038 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -88,10 +88,14 @@ 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." +(defcustom org-export-copy-to-kill-ring 'if-interactive + "Should we push exported content to the kill ring?" :group 'org-export-general - :type 'boolean) + :version "24.3" + :type '(choice + (const :tag "Always" t) + (const :tag "When export is done interactively" if-interactive) + (const :tag "Never" nil))) (defcustom org-export-kill-product-buffer-when-displayed nil "Non-nil means kill the product buffer if it is displayed immediately. @@ -3338,7 +3342,9 @@ If yes remove the column and the special lines." (defun org-export-push-to-kill-ring (format) "Push buffer content to kill ring. The depends on the variable `org-export-copy-to-kill-ring'." - (when org-export-copy-to-kill-ring + (when (or (and (eq org-export-copy-to-kill-ring 'if-interactive) + (not (or executing-kbd-macro noninteractive))) + (eq org-export-copy-to-kill-ring t)) (org-kill-new (buffer-string)) (when (fboundp 'x-set-selection) (ignore-errors (x-set-selection 'PRIMARY (buffer-string)))