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.
This commit is contained in:
Nicolas Goaziou 2012-11-28 20:39:55 +01:00
parent 09cfdb8260
commit 07f4d867e5
1 changed files with 23 additions and 10 deletions

View File

@ -262,6 +262,11 @@ and CDR is a plist with the following properties:
This variable is set with `org-export-define-backend' and This variable is set with `org-export-define-backend' and
`org-export-define-derived-backend' functions.") `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 ;;; User-configurable Variables
@ -4835,22 +4840,30 @@ to `:default' encoding. If it fails, return S."
;; pressed to `org-export-dispatch-action'. ;; pressed to `org-export-dispatch-action'.
;;;###autoload ;;;###autoload
(defun org-export-dispatch () (defun org-export-dispatch (&optional arg)
"Export dispatcher for Org mode. "Export dispatcher for Org mode.
It provides an access to common export related tasks in a buffer. It provides an access to common export related tasks in a buffer.
Its interface comes in two flavours: standard and expert. While Its interface comes in two flavours: standard and expert. While
both share the same set of bindings, only the former displays the both share the same set of bindings, only the former displays the
valid keys associations. Set `org-export-dispatch-use-expert-ui' valid keys associations. Set `org-export-dispatch-use-expert-ui'
to switch to one or the other." to switch to one or the other.
(interactive)
(let* ((input (save-window-excursion When called with C-u prefix ARG, repeat the last export action,
(unwind-protect with the same set of options used back then, on the current
(org-export-dispatch-ui (list org-export-initial-scope) buffer."
nil (interactive "P")
org-export-dispatch-use-expert-ui) (let* ((input (or (and arg org-export-dispatch-last-action)
(and (get-buffer "*Org Export Dispatcher*") (save-window-excursion
(kill-buffer "*Org Export Dispatcher*"))))) (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)) (action (car input))
(optns (cdr input))) (optns (cdr input)))
(case action (case action