summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-11-28 20:39:55 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2012-11-28 20:39:55 +0100
commit07f4d867e547736bb823812414022096676e9993 (patch)
tree37e1f179a8d25525673aff007b4fb45f9a18e0ac
parent09cfdb8260af824a1ab85fa2fae2745441f1aa37 (diff)
downloadorg-mode-07f4d867e547736bb823812414022096676e9993.tar.gz
org-export: Dispatcher repeats last export action when called with C-u
* contrib/lisp/org-export.el (org-export-dispatch-last-action): New variable. (org-export-dispatch): Repeat last export action when called with C-u.
-rw-r--r--contrib/lisp/org-export.el33
1 files changed, 23 insertions, 10 deletions
diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el
index 2597109..00a5ef5 100644
--- a/contrib/lisp/org-export.el
+++ b/contrib/lisp/org-export.el
@@ -262,6 +262,11 @@ and CDR is a plist with the following properties:
This variable is set with `org-export-define-backend' and
`org-export-define-derived-backend' functions.")
+(defvar org-export-dispatch-last-action nil
+ "Last command called from the dispatcher.
+The value should be a list. Its CAR is the action, as a symbol,
+and its CDR is a list of export options.")
+
;;; User-configurable Variables
@@ -4835,22 +4840,30 @@ to `:default' encoding. If it fails, return S."
;; pressed to `org-export-dispatch-action'.
;;;###autoload
-(defun org-export-dispatch ()
+(defun org-export-dispatch (&optional arg)
"Export dispatcher for Org mode.
It provides an access to common export related tasks in a buffer.
Its interface comes in two flavours: standard and expert. While
both share the same set of bindings, only the former displays the
valid keys associations. Set `org-export-dispatch-use-expert-ui'
-to switch to one or the other."
- (interactive)
- (let* ((input (save-window-excursion
- (unwind-protect
- (org-export-dispatch-ui (list org-export-initial-scope)
- nil
- org-export-dispatch-use-expert-ui)
- (and (get-buffer "*Org Export Dispatcher*")
- (kill-buffer "*Org Export Dispatcher*")))))
+to switch to one or the other.
+
+When called with C-u prefix ARG, repeat the last export action,
+with the same set of options used back then, on the current
+buffer."
+ (interactive "P")
+ (let* ((input (or (and arg org-export-dispatch-last-action)
+ (save-window-excursion
+ (unwind-protect
+ ;; Store this export command.
+ (setq org-export-dispatch-last-action
+ (org-export-dispatch-ui
+ (list org-export-initial-scope)
+ nil
+ org-export-dispatch-use-expert-ui))
+ (and (get-buffer "*Org Export Dispatcher*")
+ (kill-buffer "*Org Export Dispatcher*"))))))
(action (car input))
(optns (cdr input)))
(case action