Function: org-export-dispatch

org-export-dispatch is an autoloaded, interactive and byte-compiled function defined in ox.el.gz.

Signature

(org-export-dispatch &optional ARG)

Documentation

Export dispatcher for Org mode.

It provides an access to common export related tasks in a buffer. Its interface comes in two flavors: standard and expert.

While both share the same set of bindings, only the former displays the valid keys associations in a dedicated buffer. Scrolling (resp. line-wise motion) in this buffer is done with SPC and DEL (resp. C-n and C-p) keys.

Set variable org-export-dispatch-use-expert-ui to switch to one flavor or the other.

When ARG is C-u (universal-argument), repeat the last export action, with the same set of options used back then, on the current buffer.

When ARG is C-u (universal-argument) C-u (universal-argument), display the asynchronous export stack.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox.el.gz
;;; The Dispatcher
;;
;; `org-export-dispatch' is the standard interactive way to start an
;; export process.  It uses `org-export--dispatch-ui' as a subroutine
;; for its interface, which, in turn, delegates response to key
;; pressed to `org-export--dispatch-action'.

;;;###autoload
(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 flavors: standard and expert.

While both share the same set of bindings, only the former
displays the valid keys associations in a dedicated buffer.
Scrolling (resp. line-wise motion) in this buffer is done with
SPC and DEL (resp. C-n and C-p) keys.

Set variable `org-export-dispatch-use-expert-ui' to switch to one
flavor or the other.

When ARG is `\\[universal-argument]', repeat the last export action, with the\
 same
set of options used back then, on the current buffer.

When ARG is `\\[universal-argument] \\[universal-argument]', display the \
asynchronous export stack."
  (interactive "P")
  (let* ((input
	  (cond ((equal arg '(16)) '(stack))
		((and arg org-export-dispatch-last-action))
		(t (unwind-protect
		       (progn
                         ;; Remember where we are
                         (move-marker org-export-dispatch-last-position
				      (point)
				      (org-base-buffer (current-buffer)))
                         ;; Get and store an export command
                         (setq org-export-dispatch-last-action
			       (org-export--dispatch-ui
                                (list org-export-initial-scope
				      (and org-export-body-only 'body)
				      (and org-export-visible-only 'visible)
				      (and org-export-force-publishing 'force)
				      (and org-export-in-background 'async))
                                nil
                                org-export-dispatch-use-expert-ui)))
                     (and (get-buffer-window "*Org Export Dispatcher*" t)
                          (quit-window 'kill (get-buffer-window "*Org Export Dispatcher*" t)))
		     (and (get-buffer "*Org Export Dispatcher*")
			  (kill-buffer "*Org Export Dispatcher*"))))))
	 (action (car input))
	 (optns (cdr input)))
    (unless (memq 'subtree optns)
      (move-marker org-export-dispatch-last-position nil))
    (cl-case action
      ;; First handle special hard-coded actions.
      (template (org-export-insert-default-template nil optns))
      (stack (org-export-stack))
      (publish-current-file
       (org-publish-current-file (memq 'force optns) (memq 'async optns)))
      (publish-current-project
       (org-publish-current-project (memq 'force optns) (memq 'async optns)))
      (publish-choose-project
       (org-publish (assoc (completing-read
			    "Publish project: "
			    org-publish-project-alist nil t)
			   org-publish-project-alist)
		    (memq 'force optns)
		    (memq 'async optns)))
      (publish-all (org-publish-all (memq 'force optns) (memq 'async optns)))
      (otherwise
       (save-excursion
	 (when arg
	   ;; Repeating command, maybe move cursor to restore subtree
	   ;; context.
	   (if (eq (marker-buffer org-export-dispatch-last-position)
		   (org-base-buffer (current-buffer)))
	       (goto-char org-export-dispatch-last-position)
	     ;; We are in a different buffer, forget position.
	     (move-marker org-export-dispatch-last-position nil)))
	 (funcall action
		  ;; Return a symbol instead of a list to ease
		  ;; asynchronous export macro use.
		  (and (memq 'async optns) t)
		  (and (memq 'subtree optns) t)
		  (and (memq 'visible optns) t)
		  (and (memq 'body optns) t)))))))