summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2013-03-15 13:39:45 +0100
committerBastien Guerry <bzg@altern.org>2013-03-15 13:39:45 +0100
commitce0473532d005b259489447ddaccea9b9c3abc57 (patch)
tree4aa4e4ba4b7cf00b2425e0d472ac3b8c0ea9c073
parent791ebc6e7b6025d78332f64788081af7329e2f4f (diff)
downloadorg-mode-ce0473532d005b259489447ddaccea9b9c3abc57.tar.gz
ox.el (org-export-copy-to-kill-ring): Default back to 'if-interactive
* ox.el (org-export--copy-to-kill-ring-p): New function. (org-export-copy-to-kill-ring): Use 'if-interactive as the default. (org-export-to-buffer, org-export-to-file): Use `org-export--copy-to-kill-ring-p' and fix docstrings. * ox-odt.el (org-odt-export-as-odf): Use `org-export--copy-to-kill-ring-p'.
-rw-r--r--lisp/ox-odt.el6
-rw-r--r--lisp/ox.el26
2 files changed, 21 insertions, 11 deletions
diff --git a/lisp/ox-odt.el b/lisp/ox-odt.el
index e700600..cf008e8 100644
--- a/lisp/ox-odt.el
+++ b/lisp/ox-odt.el
@@ -4146,8 +4146,8 @@ Use `org-create-math-formula' to convert LATEX-FRAG first to
MathML. When invoked as an interactive command, use
`org-latex-regexps' to infer LATEX-FRAG from currently active
region. If no LaTeX fragments are found, prompt for it. Push
-MathML source to kill ring, if `org-export-copy-to-kill-ring' is
-non-nil."
+MathML source to kill ring depending on the value of
+`org-export-copy-to-kill-ring'."
(interactive
`(,(let (frag)
(setq frag (and (setq frag (and (region-active-p)
@@ -4187,7 +4187,7 @@ non-nil."
(unless mathml (error "No Math formula created"))
(insert mathml)
;; Add MathML to kill ring, if needed.
- (when org-export-copy-to-kill-ring
+ (when (org-export--copy-to-kill-ring-p)
(org-kill-new (buffer-string))))))))
;;;###autoload
diff --git a/lisp/ox.el b/lisp/ox.el
index c5b6d7c..60f61e0 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -748,10 +748,14 @@ HTML code while every other back-end will ignore it."
:package-version '(Org . "8.0")
:type 'coding-system)
-(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-initial-scope 'buffer
"The initial scope when exporting with `org-export-dispatch'.
@@ -1989,7 +1993,6 @@ a tree with a select tag."
(not (memq (org-element-property :type blob)
'(inactive inactive-range))))))))
-
;;; The Transcoder
;;
@@ -2956,7 +2959,7 @@ Optional arguments SUBTREEP, VISIBLE-ONLY, BODY-ONLY and
EXT-PLIST are similar to those used in `org-export-as', which
see.
-If `org-export-copy-to-kill-ring' is non-nil, add buffer contents
+Depending on `org-export-copy-to-kill-ring', add buffer contents
to kill ring. Return buffer."
(let ((out (org-export-as backend subtreep visible-only body-only ext-plist))
(buffer (get-buffer-create buffer)))
@@ -2965,7 +2968,7 @@ to kill ring. Return buffer."
(insert out)
(goto-char (point-min)))
;; Maybe add buffer contents to kill ring.
- (when (and org-export-copy-to-kill-ring (org-string-nw-p out))
+ (when (and (org-export--copy-to-kill-ring-p) (org-string-nw-p out))
(org-kill-new out))
;; Return buffer.
buffer))
@@ -2982,7 +2985,7 @@ Optional arguments SUBTREEP, VISIBLE-ONLY, BODY-ONLY and
EXT-PLIST are similar to those used in `org-export-as', which
see.
-If `org-export-copy-to-kill-ring' is non-nil, add file contents
+Depending on `org-export-copy-to-kill-ring', add file contents
to kill ring. Return output file's name."
;; Checks for FILE permissions. `write-file' would do the same, but
;; we'd rather avoid needless transcoding of parse tree.
@@ -2994,7 +2997,7 @@ to kill ring. Return output file's name."
(let ((coding-system-for-write org-export-coding-system))
(write-file file)))
;; Maybe add file contents to kill ring.
- (when (and org-export-copy-to-kill-ring (org-string-nw-p out))
+ (when (and (org-export--copy-to-kill-ring-p) (org-string-nw-p out))
(org-kill-new out)))
;; Return full path.
file)
@@ -5700,7 +5703,14 @@ options as CDR."
;; Otherwise, enter sub-menu.
(t (org-export--dispatch-ui options key expertp)))))
+;;; Miscellaneous
+(defun org-export--copy-to-kill-ring-p ()
+ "Should we copy the export buffer to the kill ring?
+See also `org-export-copy-to-kill-ring'."
+ (if (eq org-export-copy-to-kill-ring 'if-interactive)
+ (not (or executing-kbd-macro noninteractive))
+ (eq org-export-copy-to-kill-ring t)))
(provide 'ox)