ox-texinfo: Tiny refactoring

* lisp/ox-texinfo.el (org-texinfo-info-process): Fix docstring.
(org-texinfo-compile): Do not check for impossible cases (e.g., if the
previous variable contains a function).
This commit is contained in:
Nicolas Goaziou 2014-08-11 13:44:13 +02:00
parent d17cd9962f
commit dcf5510053
1 changed files with 17 additions and 26 deletions

View File

@ -357,12 +357,11 @@ in order to mimic default behavior:
;;;; Compilation ;;;; Compilation
(defcustom org-texinfo-info-process (defcustom org-texinfo-info-process '("makeinfo %f")
'("makeinfo %f")
"Commands to process a Texinfo file to an INFO file. "Commands to process a Texinfo file to an INFO file.
This is list of strings, each of them will be given to the shell This is list of strings, each of them will be given to the shell
as a command. %f in the command will be replaced by the full as a command. %f in the command will be replaced by the full
file name, %b by the file base name \(i.e without extension) and file name, %b by the file base name (i.e without extension) and
%o by the base directory of the file." %o by the base directory of the file."
:group 'org-export-texinfo :group 'org-export-texinfo
:type '(repeat :tag "Shell command sequence" :type '(repeat :tag "Shell command sequence"
@ -1557,17 +1556,11 @@ Return INFO file name or an error if it couldn't be produced."
errors) errors)
(message (format "Processing Texinfo file %s..." file)) (message (format "Processing Texinfo file %s..." file))
(save-window-excursion (save-window-excursion
(cond ;; Replace %b, %f and %o with appropriate values in each command
;; A function is provided: Apply it. ;; before applying it. Output is redirected to "*Org INFO
((functionp org-texinfo-info-process) ;; Texinfo Output*" buffer.
(funcall org-texinfo-info-process (shell-quote-argument file)))
;; A list is provided: Replace %b, %f and %o with appropriate
;; values in each command before applying it. Output is
;; redirected to "*Org INFO Texinfo Output*" buffer.
((consp org-texinfo-info-process)
(let ((outbuf (get-buffer-create "*Org INFO Texinfo Output*"))) (let ((outbuf (get-buffer-create "*Org INFO Texinfo Output*")))
(mapc (dolist (command org-texinfo-info-process)
(lambda (command)
(shell-command (shell-command
(replace-regexp-in-string (replace-regexp-in-string
"%b" (shell-quote-argument base-name) "%b" (shell-quote-argument base-name)
@ -1576,10 +1569,8 @@ Return INFO file name or an error if it couldn't be produced."
(replace-regexp-in-string (replace-regexp-in-string
"%o" (shell-quote-argument out-dir) command t t) t t) t t) "%o" (shell-quote-argument out-dir) command t t) t t) t t)
outbuf)) outbuf))
org-texinfo-info-process)
;; Collect standard errors from output buffer. ;; Collect standard errors from output buffer.
(setq errors (org-texinfo-collect-errors outbuf)))) (setq errors (org-texinfo-collect-errors outbuf)))
(t (error "No valid command to process to Info")))
(let ((infofile (concat out-dir base-name ".info"))) (let ((infofile (concat out-dir base-name ".info")))
;; Check for process failure. Provide collected errors if ;; Check for process failure. Provide collected errors if
;; possible. ;; possible.