Function: rst-compile

rst-compile is an interactive and byte-compiled function defined in rst.el.gz.

Signature

(rst-compile &optional USE-ALT)

Documentation

Compile command to convert reST document into some output file.

Attempts to find configuration file, if it can, overrides the options. There are two commands to choose from; with USE-ALT, select the alternative tool-set.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/rst.el.gz
(defun rst-compile (&optional use-alt)
  "Compile command to convert reST document into some output file.
Attempts to find configuration file, if it can, overrides the
options.  There are two commands to choose from; with USE-ALT,
select the alternative tool-set."
  (interactive "P")
  ;; Note: maybe we want to check if there is a Makefile too and not do anything
  ;; if that is the case.  I dunno.
  (cl-destructuring-bind
      (command extension options
       &aux (conffile (rst-compile-find-conf))
       (bufname (file-name-nondirectory buffer-file-name)))
      (cdr (assq (if use-alt
		     rst-compile-secondary-toolset
		   rst-compile-primary-toolset)
		 rst-compile-toolsets))
    ;; Set compile-command before invocation of compile.
    (setq-local
     compile-command
     (mapconcat
      #'identity
      (list command
	    (or options "")
	    (if conffile
		(concat "--config=" (shell-quote-argument conffile))
	      "")
	    (shell-quote-argument bufname)
	    (shell-quote-argument (concat (file-name-sans-extension bufname)
					  extension)))
      " "))
    ;; Invoke the compile command.
    (if (or compilation-read-command use-alt)
        (call-interactively #'compile)
      (compile compile-command))))