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:
parent
d17cd9962f
commit
dcf5510053
|
@ -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,29 +1556,21 @@ 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)))
|
(let ((outbuf (get-buffer-create "*Org INFO Texinfo Output*")))
|
||||||
;; A list is provided: Replace %b, %f and %o with appropriate
|
(dolist (command org-texinfo-info-process)
|
||||||
;; values in each command before applying it. Output is
|
(shell-command
|
||||||
;; redirected to "*Org INFO Texinfo Output*" buffer.
|
(replace-regexp-in-string
|
||||||
((consp org-texinfo-info-process)
|
"%b" (shell-quote-argument base-name)
|
||||||
(let ((outbuf (get-buffer-create "*Org INFO Texinfo Output*")))
|
(replace-regexp-in-string
|
||||||
(mapc
|
"%f" (shell-quote-argument full-name)
|
||||||
(lambda (command)
|
(replace-regexp-in-string
|
||||||
(shell-command
|
"%o" (shell-quote-argument out-dir) command t t) t t) t t)
|
||||||
(replace-regexp-in-string
|
outbuf))
|
||||||
"%b" (shell-quote-argument base-name)
|
;; Collect standard errors from output buffer.
|
||||||
(replace-regexp-in-string
|
(setq errors (org-texinfo-collect-errors outbuf)))
|
||||||
"%f" (shell-quote-argument full-name)
|
|
||||||
(replace-regexp-in-string
|
|
||||||
"%o" (shell-quote-argument out-dir) command t t) t t) t t)
|
|
||||||
outbuf))
|
|
||||||
org-texinfo-info-process)
|
|
||||||
;; Collect standard errors from output buffer.
|
|
||||||
(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.
|
||||||
|
|
Loading…
Reference in New Issue