Browse Source

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.
Bastien Guerry 12 years ago
parent
commit
8c04fb72cb
1 changed files with 10 additions and 4 deletions
  1. 10 4
      lisp/org-exp.el

+ 10 - 4
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)))