diff options
Diffstat (limited to 'lisp/ox-man.el')
-rw-r--r-- | lisp/ox-man.el | 381 |
1 files changed, 130 insertions, 251 deletions
diff --git a/lisp/ox-man.el b/lisp/ox-man.el index df744e8..4e2bfc7 100644 --- a/lisp/ox-man.el +++ b/lisp/ox-man.el @@ -1,4 +1,4 @@ -;; ox-man.el --- Man Back-End for Org Export Engine +;; ox-man.el --- Man Back-End for Org Export Engine -*- lexical-binding: t; -*- ;; Copyright (C) 2011-2016 Free Software Foundation, Inc. @@ -29,18 +29,17 @@ ;; ;; M-: (org-export-to-buffer 'man "*Test Man*") RET ;; -;; in an org-mode buffer then switch to the buffer to see the Man -;; export. See ox.el for more details on how this exporter works. +;; in an Org buffer then switch to the buffer to see the Man export. +;; See ox.el for more details on how this exporter works. ;; ;; It introduces one new buffer keywords: ;; "MAN_CLASS_OPTIONS". ;;; Code: +(require 'cl-lib) (require 'ox) -(eval-when-compile (require 'cl)) - (defvar org-export-man-default-packages-alist) (defvar org-export-man-packages-alist) (defvar orgtbl-exp-regexp) @@ -53,7 +52,6 @@ '((babel-call . org-man-babel-call) (bold . org-man-bold) (center-block . org-man-center-block) - (clock . org-man-clock) (code . org-man-code) (drawer . org-man-drawer) (dynamic-block . org-man-dynamic-block) @@ -98,7 +96,6 @@ (underline . org-man-underline) (verbatim . org-man-verbatim) (verse-block . org-man-verse-block)) - :export-block "MAN" :menu-entry '(?M "Export to MAN" ((?m "As MAN file" org-man-export-to-man) @@ -203,21 +200,6 @@ in this list - but it does not hurt if it is present." (string :tag "Listings language")))) - -(defvar org-man-custom-lang-environments nil - "Alist mapping languages to language-specific Man environments. - -It is used during export of src blocks by the listings and -man packages. For example, - - (setq org-man-custom-lang-environments - '((python \"pythoncode\"))) - -would have the effect that if org encounters begin_src python -during man export." -) - - ;;; Compilation (defcustom org-man-pdf-process @@ -343,7 +325,7 @@ holding export options." ;;; Bold -(defun org-man-bold (bold contents info) +(defun org-man-bold (_bold contents _info) "Transcode BOLD from Org to Man. CONTENTS is the text with bold markup. INFO is a plist holding contextual information." @@ -352,7 +334,7 @@ contextual information." ;;; Center Block -(defun org-man-center-block (center-block contents info) +(defun org-man-center-block (center-block contents _info) "Transcode a CENTER-BLOCK element from Org to Man. CONTENTS holds the contents of the center block. INFO is a plist holding contextual information." @@ -363,37 +345,18 @@ holding contextual information." contents))) -;;; Clock - -(defun org-man-clock (clock contents info) - "Transcode a CLOCK element from Org to Man. -CONTENTS is nil. INFO is a plist holding contextual -information." - "" ) - - ;;; Code -(defun org-man-code (code contents info) +(defun org-man-code (code _contents _info) "Transcode a CODE object from Org to Man. CONTENTS is nil. INFO is a plist used as a communication channel." (format "\\fC%s\\fP" code)) -;;; Comment -;; -;; Comments are ignored. - - -;;; Comment Block -;; -;; Comment Blocks are ignored. - - ;;; Drawer -(defun org-man-drawer (drawer contents info) +(defun org-man-drawer (_drawer contents _info) "Transcode a DRAWER element from Org to Man. DRAWER holds the drawer information CONTENTS holds the contents of the block. @@ -403,7 +366,7 @@ channel." ;;; Dynamic Block -(defun org-man-dynamic-block (dynamic-block contents info) +(defun org-man-dynamic-block (dynamic-block contents _info) "Transcode a DYNAMIC-BLOCK element from Org to Man. CONTENTS holds the contents of the block. INFO is a plist holding contextual information. See `org-export-data'." @@ -412,7 +375,7 @@ holding contextual information. See `org-export-data'." ;;; Entity -(defun org-man-entity (entity contents info) +(defun org-man-entity (entity _contents _info) "Transcode an ENTITY object from Org to Man. CONTENTS are the definition itself. INFO is a plist holding contextual information." @@ -421,7 +384,7 @@ contextual information." ;;; Example Block -(defun org-man-example-block (example-block contents info) +(defun org-man-example-block (example-block _contents info) "Transcode an EXAMPLE-BLOCK element from Org to Man. CONTENTS is nil. INFO is a plist holding contextual information." @@ -433,7 +396,7 @@ information." ;;; Export Block -(defun org-man-export-block (export-block contents info) +(defun org-man-export-block (export-block _contents _info) "Transcode a EXPORT-BLOCK element from Org to Man. CONTENTS is nil. INFO is a plist holding contextual information." (when (string= (org-element-property :type export-block) "MAN") @@ -442,7 +405,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." ;;; Export Snippet -(defun org-man-export-snippet (export-snippet contents info) +(defun org-man-export-snippet (export-snippet _contents _info) "Transcode a EXPORT-SNIPPET object from Org to Man. CONTENTS is nil. INFO is a plist holding contextual information." (when (eq (org-export-snippet-backend export-snippet) 'man) @@ -451,7 +414,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." ;;; Fixed Width -(defun org-man-fixed-width (fixed-width contents info) +(defun org-man-fixed-width (fixed-width _contents _info) "Transcode a FIXED-WIDTH element from Org to Man. CONTENTS is nil. INFO is a plist holding contextual information." (org-man--wrap-label @@ -477,16 +440,15 @@ CONTENTS is nil. INFO is a plist holding contextual information." CONTENTS holds the contents of the headline. INFO is a plist holding contextual information." (let* ((level (org-export-get-relative-level headline info)) - (numberedp (org-export-numbered-headline-p headline info)) - ;; Section formatting will set two placeholders: one for the - ;; title and the other for the contents. - (section-fmt - (case level - (1 ".SH \"%s\"\n%s") - (2 ".SS \"%s\"\n%s") - (3 ".SS \"%s\"\n%s") - (t nil))) - (text (org-export-data (org-element-property :title headline) info))) + ;; Section formatting will set two placeholders: one for the + ;; title and the other for the contents. + (section-fmt + (pcase level + (1 ".SH \"%s\"\n%s") + (2 ".SS \"%s\"\n%s") + (3 ".SS \"%s\"\n%s") + (_ nil))) + (text (org-export-data (org-element-property :title headline) info))) (cond ;; Case 1: This is a footnote section: ignore it. @@ -498,20 +460,20 @@ holding contextual information." ((or (not section-fmt) (org-export-low-level-p headline info)) ;; Build the real contents of the sub-tree. (let ((low-level-body - (concat - ;; If the headline is the first sibling, start a list. - (when (org-export-first-sibling-p headline info) - (format "%s\n" ".RS")) - ;; Itemize headline - ".TP\n.ft I\n" text "\n.ft\n" - contents ".RE"))) - ;; If headline is not the last sibling simply return - ;; LOW-LEVEL-BODY. Otherwise, also close the list, before any - ;; blank line. - (if (not (org-export-last-sibling-p headline info)) low-level-body - (replace-regexp-in-string - "[ \t\n]*\\'" "" - low-level-body)))) + (concat + ;; If the headline is the first sibling, start a list. + (when (org-export-first-sibling-p headline info) + (format "%s\n" ".RS")) + ;; Itemize headline + ".TP\n.ft I\n" text "\n.ft\n" + contents ".RE"))) + ;; If headline is not the last sibling simply return + ;; LOW-LEVEL-BODY. Otherwise, also close the list, before any + ;; blank line. + (if (not (org-export-last-sibling-p headline info)) low-level-body + (replace-regexp-in-string + "[ \t\n]*\\'" "" + low-level-body)))) ;; Case 3. Standard headline. Export it as a section. (t (format section-fmt text contents ))))) @@ -525,16 +487,14 @@ holding contextual information." ;;; Inline Src Block -(defun org-man-inline-src-block (inline-src-block contents info) +(defun org-man-inline-src-block (inline-src-block _contents info) "Transcode an INLINE-SRC-BLOCK element from Org to Man. CONTENTS holds the contents of the item. INFO is a plist holding contextual information." (let* ((code (org-element-property :value inline-src-block))) (cond ((plist-get info :man-source-highlight) - (let* ((tmpdir (if (featurep 'xemacs) - temp-directory - temporary-file-directory )) + (let* ((tmpdir temporary-file-directory) (in-file (make-temp-name (expand-file-name "srchilite" tmpdir))) (out-file (make-temp-name @@ -570,7 +530,7 @@ contextual information." ;;; Inlinetask ;;; Italic -(defun org-man-italic (italic contents info) +(defun org-man-italic (_italic contents _info) "Transcode ITALIC from Org to Man. CONTENTS is the text with italic markup. INFO is a plist holding contextual information." @@ -581,17 +541,15 @@ contextual information." (defun org-man-item (item contents info) - "Transcode an ITEM element from Org to Man. CONTENTS holds the contents of the item. INFO is a plist holding contextual information." - (let* ((bullet (org-element-property :bullet item)) (type (org-element-property :type (org-element-property :parent item))) - (checkbox (case (org-element-property :checkbox item) - (on "\\o'\\(sq\\(mu'") ;; - (off "\\(sq ") ;; - (trans "\\o'\\(sq\\(mi'" ))) ;; + (checkbox (pcase (org-element-property :checkbox item) + (`on "\\o'\\(sq\\(mu'") + (`off "\\(sq ") + (`trans "\\o'\\(sq\\(mi'"))) (tag (let ((tag (org-element-property :tag item))) ;; Check-boxes must belong to the tag. @@ -599,24 +557,22 @@ contextual information." (concat checkbox (org-export-data tag info))))))) - (if (and (null tag ) - (null checkbox)) - (let* ((bullet (org-trim bullet)) - (marker (cond ((string= "-" bullet) "\\(em") - ((string= "*" bullet) "\\(bu") - ((eq type 'ordered) - (format "%s " (org-trim bullet))) - (t "\\(dg")))) - (concat ".IP " marker " 4\n" - (org-trim (or contents " " )))) - ; else + (if (and (null tag) (null checkbox)) + (let* ((bullet (org-trim bullet)) + (marker (cond ((string= "-" bullet) "\\(em") + ((string= "*" bullet) "\\(bu") + ((eq type 'ordered) + (format "%s " (org-trim bullet))) + (t "\\(dg")))) + (concat ".IP " marker " 4\n" + (org-trim (or contents " " )))) (concat ".TP\n" (or tag (concat " " checkbox)) "\n" (org-trim (or contents " " )))))) ;;; Keyword -(defun org-man-keyword (keyword contents info) +(defun org-man-keyword (keyword _contents _info) "Transcode a KEYWORD element from Org to Man. CONTENTS is nil. INFO is a plist holding contextual information." (let ((key (org-element-property :key keyword)) @@ -629,7 +585,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." ;;; Line Break -(defun org-man-line-break (line-break contents info) +(defun org-man-line-break (_line-break _contents _info) "Transcode a LINE-BREAK object from Org to Man. CONTENTS is nil. INFO is a plist holding contextual information." ".br\n") @@ -638,7 +594,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." ;;; Link -(defun org-man-link (link desc info) +(defun org-man-link (link desc _info) "Transcode a LINK object from Org to Man. DESC is the description part of the link, or the empty string. @@ -652,8 +608,7 @@ INFO is a plist holding contextual information. See ((member type '("http" "https" "ftp" "mailto")) (concat type ":" raw-path)) ((string= type "file") (org-export-file-uri raw-path)) - (t raw-path))) - protocol) + (t raw-path)))) (cond ;; Link type is handled by a special function. ((org-export-custom-protocol-maybe link desc 'man)) @@ -666,7 +621,7 @@ INFO is a plist holding contextual information. See ;;;; Node Property -(defun org-man-node-property (node-property contents info) +(defun org-man-node-property (node-property _contents _info) "Transcode a NODE-PROPERTY element from Org to Man. CONTENTS is nil. INFO is a plist holding contextual information." @@ -677,7 +632,7 @@ information." ;;; Paragraph -(defun org-man-paragraph (paragraph contents info) +(defun org-man-paragraph (paragraph contents _info) "Transcode a PARAGRAPH element from Org to Man. CONTENTS is the contents of the paragraph, as a string. INFO is the plist used as a communication channel." @@ -698,7 +653,7 @@ the plist used as a communication channel." ;;; Plain List -(defun org-man-plain-list (plain-list contents info) +(defun org-man-plain-list (_plain-list contents _info) "Transcode a PLAIN-LIST element from Org to Man. CONTENTS is the contents of the list. INFO is a plist holding contextual information." @@ -733,7 +688,7 @@ contextual information." ;;; Property Drawer -(defun org-man-property-drawer (property-drawer contents info) +(defun org-man-property-drawer (_property-drawer contents _info) "Transcode a PROPERTY-DRAWER element from Org to Man. CONTENTS holds the contents of the drawer. INFO is a plist holding contextual information." @@ -742,7 +697,7 @@ holding contextual information." ;;; Quote Block -(defun org-man-quote-block (quote-block contents info) +(defun org-man-quote-block (quote-block contents _info) "Transcode a QUOTE-BLOCK element from Org to Man. CONTENTS holds the contents of the block. INFO is a plist holding contextual information." @@ -753,16 +708,16 @@ holding contextual information." ;;; Radio Target -(defun org-man-radio-target (radio-target text info) +(defun org-man-radio-target (_radio-target text _info) "Transcode a RADIO-TARGET object from Org to Man. TEXT is the text of the target. INFO is a plist holding contextual information." - text ) + text) ;;; Section -(defun org-man-section (section contents info) +(defun org-man-section (_section contents _info) "Transcode a SECTION element from Org to Man. CONTENTS holds the contents of the section. INFO is a plist holding contextual information." @@ -771,61 +726,49 @@ holding contextual information." ;;; Special Block -(defun org-man-special-block (special-block contents info) +(defun org-man-special-block (special-block contents _info) "Transcode a SPECIAL-BLOCK element from Org to Man. CONTENTS holds the contents of the block. INFO is a plist holding contextual information." - (let ((type (org-element-property :type special-block))) - (org-man--wrap-label - special-block - (format "%s\n" contents)))) + (org-man--wrap-label special-block (format "%s\n" contents))) ;;; Src Block -(defun org-man-src-block (src-block contents info) +(defun org-man-src-block (src-block _contents info) "Transcode a SRC-BLOCK element from Org to Man. CONTENTS holds the contents of the item. INFO is a plist holding contextual information." - (let* ((lang (org-element-property :language src-block)) - (code (org-element-property :value src-block)) - (custom-env (and lang - (cadr (assq (intern lang) - org-man-custom-lang-environments)))) - (num-start (case (org-element-property :number-lines src-block) - (continued (org-export-get-loc src-block info)) - (new 0))) - (retain-labels (org-element-property :retain-labels src-block))) - (if (not (plist-get info :man-source-highlight)) - (format ".RS\n.nf\n\\fC%s\\fP\n.fi\n.RE\n\n" - (org-export-format-code-default src-block info)) - (let* ((tmpdir (if (featurep 'xemacs) temp-directory - temporary-file-directory)) - (in-file (make-temp-name (expand-file-name "srchilite" tmpdir))) - (out-file (make-temp-name (expand-file-name "reshilite" tmpdir))) - (org-lang (org-element-property :language src-block)) - (lst-lang - (cadr (assq (intern org-lang) - (plist-get info :man-source-highlight-langs)))) - (cmd (concat "source-highlight" - " -s " lst-lang - " -f groff_man " - " -i " in-file - " -o " out-file))) - (if lst-lang - (let ((code-block "")) - (with-temp-file in-file (insert code)) - (shell-command cmd) - (setq code-block (org-file-contents out-file)) - (delete-file in-file) - (delete-file out-file) - code-block) - (format ".RS\n.nf\n\\fC\\m[black]%s\\m[]\\fP\n.fi\n.RE" code)))))) + (if (not (plist-get info :man-source-highlight)) + (format ".RS\n.nf\n\\fC%s\\fP\n.fi\n.RE\n\n" + (org-export-format-code-default src-block info)) + (let* ((tmpdir temporary-file-directory) + (in-file (make-temp-name (expand-file-name "srchilite" tmpdir))) + (out-file (make-temp-name (expand-file-name "reshilite" tmpdir))) + (code (org-element-property :value src-block)) + (org-lang (org-element-property :language src-block)) + (lst-lang + (cadr (assq (intern org-lang) + (plist-get info :man-source-highlight-langs)))) + (cmd (concat "source-highlight" + " -s " lst-lang + " -f groff_man " + " -i " in-file + " -o " out-file))) + (if lst-lang + (let ((code-block "")) + (with-temp-file in-file (insert code)) + (shell-command cmd) + (setq code-block (org-file-contents out-file)) + (delete-file in-file) + (delete-file out-file) + code-block) + (format ".RS\n.nf\n\\fC\\m[black]%s\\m[]\\fP\n.fi\n.RE" code))))) ;;; Statistics Cookie -(defun org-man-statistics-cookie (statistics-cookie contents info) +(defun org-man-statistics-cookie (statistics-cookie _contents _info) "Transcode a STATISTICS-COOKIE object from Org to Man. CONTENTS is nil. INFO is a plist holding contextual information." (org-element-property :value statistics-cookie)) @@ -833,7 +776,7 @@ CONTENTS is nil. INFO is a plist holding contextual information." ;;; Strike-Through -(defun org-man-strike-through (strike-through contents info) +(defun org-man-strike-through (_strike-through contents _info) "Transcode STRIKE-THROUGH from Org to Man. CONTENTS is the text with strike-through markup. INFO is a plist holding contextual information." @@ -841,7 +784,7 @@ holding contextual information." ;;; Subscript -(defun org-man-subscript (subscript contents info) +(defun org-man-subscript (_subscript contents _info) "Transcode a SUBSCRIPT object from Org to Man. CONTENTS is the contents of the object. INFO is a plist holding contextual information." @@ -849,7 +792,7 @@ contextual information." ;;; Superscript "^_%s$ -(defun org-man-superscript (superscript contents info) +(defun org-man-superscript (_superscript contents _info) "Transcode a SUPERSCRIPT object from Org to Man. CONTENTS is the contents of the object. INFO is a plist holding contextual information." @@ -912,14 +855,14 @@ a communication channel." (when (and (memq 'left borders) (not alignment)) (push "|" alignment)) (push - (case (org-export-table-cell-alignment cell info) - (left (concat "l" width divider)) - (right (concat "r" width divider)) - (center (concat "c" width divider))) + (concat (pcase (org-export-table-cell-alignment cell info) + (`left "l") (`right "r") (`center "c")) + width + divider) alignment) (when (memq 'right borders) (push "|" alignment)))) info) - (apply 'concat (reverse alignment)))) + (apply #'concat (reverse alignment)))) (defun org-man-table--org-table (table contents info) "Return appropriate Man code for an Org table. @@ -930,7 +873,6 @@ channel. This function assumes TABLE has `org' as its `:type' attribute." (let* ((attr (org-export-read-attribute :attr_man table)) - (label (org-element-property :name table)) (caption (and (not (plist-get attr :disable-caption)) (org-man--caption/label-string table info))) (divider (if (plist-get attr :divider) "|" " ")) @@ -976,14 +918,14 @@ This function assumes TABLE has `org' as its `:type' attribute." (format "%s.\n" (let ((final-line "")) (when title-line - (dotimes (i (length first-line)) + (dotimes (_ (length first-line)) (setq final-line (concat final-line "cb" divider)))) (setq final-line (concat final-line "\n")) (if alignment (setq final-line (concat final-line alignment)) - (dotimes (i (length first-line)) + (dotimes (_ (length first-line)) (setq final-line (concat final-line "c" divider)))) final-line )) @@ -1040,35 +982,26 @@ a communication channel." ;;; Table Row (defun org-man-table-row (table-row contents info) - "Transcode a TABLE-ROW element from Org to Man + "Transcode a TABLE-ROW element from Org to Man. CONTENTS is the contents of the row. INFO is a plist used as a communication channel." - ;; Rules are ignored since table separators are deduced from - ;; borders of the current row. + ;; Rules are ignored since table separators are deduced from borders + ;; of the current row. (when (eq (org-element-property :type table-row) 'standard) - (let* ((attr (mapconcat 'identity - (org-element-property - :attr_man (org-export-get-parent table-row)) - " ")) - ;; TABLE-ROW's borders are extracted from its first cell. - (borders - (org-export-table-cell-borders - (car (org-element-contents table-row)) info))) + (let ((borders + ;; TABLE-ROW's borders are extracted from its first cell. + (org-export-table-cell-borders + (car (org-element-contents table-row)) info))) (concat - ;; Mark horizontal lines - (cond ((and (memq 'top borders) (memq 'above borders)) "_\n")) + (cond ((and (memq 'top borders) (memq 'above borders)) "_\n")) contents - - (cond - ;; When BOOKTABS are activated enforce bottom rule even when - ;; no hline was specifically marked. - ((and (memq 'bottom borders) (memq 'below borders)) "\n_") - ((memq 'below borders) "\n_")))))) + (cond ((and (memq 'bottom borders) (memq 'below borders)) "\n_") + ((memq 'below borders) "\n_")))))) ;;; Target -(defun org-man-target (target contents info) +(defun org-man-target (target _contents info) "Transcode a TARGET object from Org to Man. CONTENTS is nil. INFO is a plist holding contextual information." @@ -1077,16 +1010,15 @@ information." ;;; Timestamp -(defun org-man-timestamp (timestamp contents info) +(defun org-man-timestamp (_timestamp _contents _info) "Transcode a TIMESTAMP object from Org to Man. - CONTENTS is nil. INFO is a plist holding contextual - information." - "" ) +ONTENTS is nil. INFO is a plist holding contextual information." + "") ;;; Underline -(defun org-man-underline (underline contents info) +(defun org-man-underline (_underline contents _info) "Transcode UNDERLINE from Org to Man. CONTENTS is the text with underline markup. INFO is a plist holding contextual information." @@ -1095,7 +1027,7 @@ holding contextual information." ;;; Verbatim -(defun org-man-verbatim (verbatim contents info) +(defun org-man-verbatim (_verbatim contents _info) "Transcode a VERBATIM object from Org to Man. CONTENTS is nil. INFO is a plist used as a communication channel." @@ -1104,7 +1036,7 @@ channel." ;;; Verse Block -(defun org-man-verse-block (verse-block contents info) +(defun org-man-verse-block (_verse-block contents _info) "Transcode a VERSE-BLOCK element from Org to Man. CONTENTS is verse block contents. INFO is a plist holding contextual information." @@ -1188,68 +1120,15 @@ FILE is the name of the file being compiled. Processing is done through the command specified in `org-man-pdf-process'. Return PDF file name or an error if it couldn't be produced." - (let* ((base-name (file-name-sans-extension (file-name-nondirectory file))) - (full-name (file-truename file)) - (out-dir (file-name-directory file)) - ;; Properly set working directory for compilation. - (default-directory (if (file-name-absolute-p file) - (file-name-directory full-name) - default-directory)) - errors) - (message "Processing Groff file %s..." file) - (save-window-excursion - (cond - ;; A function is provided: Apply it. - ((functionp org-man-pdf-process) - (funcall org-man-pdf-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 PDF Groff Output*" buffer. - ((consp org-man-pdf-process) - (let ((outbuf (get-buffer-create "*Org PDF Groff Output*"))) - (mapc - (lambda (command) - (shell-command - (replace-regexp-in-string - "%b" (shell-quote-argument base-name) - (replace-regexp-in-string - "%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-man-pdf-process) - ;; Collect standard errors from output buffer. - (setq errors (org-man-collect-errors outbuf)))) - (t (error "No valid command to process to PDF"))) - (let ((pdffile (concat out-dir base-name ".pdf"))) - ;; Check for process failure. Provide collected errors if - ;; possible. - (if (not (file-exists-p pdffile)) - (error "PDF file %s wasn't produced%s" pdffile - (if errors (concat ": " errors) "")) - ;; Else remove log files, when specified, and signal end of - ;; process to user, along with any error encountered. - (when org-man-remove-logfiles - (dolist (ext org-man-logfiles-extensions) - (let ((file (concat out-dir base-name "." ext))) - (when (file-exists-p file) (delete-file file))))) - (message (concat "Process completed" - (if (not errors) "." - (concat " with errors: " errors))))) - ;; Return output file name. - pdffile)))) - -(defun org-man-collect-errors (buffer) - "Collect some kind of errors from \"groff\" output -BUFFER is the buffer containing output. -Return collected error types as a string, or nil if there was -none." - (with-current-buffer buffer - (save-excursion - (goto-char (point-max)) - ;; Find final run - nil ))) - + (message "Processing Groff file %s..." file) + (let ((output (org-compile-file file org-man-pdf-process "pdf"))) + (when org-man-remove-logfiles + (let ((base (file-name-sans-extension output))) + (dolist (ext org-man-logfiles-extensions) + (let ((file (concat base "." ext))) + (when (file-exists-p file) (delete-file file)))))) + (message "Process completed.") + output)) (provide 'ox-man) |