Function: doc-file-to-man
doc-file-to-man is an autoloaded, interactive and byte-compiled
function defined in help-fns.el.gz.
Signature
(doc-file-to-man FILE)
Documentation
Produce an nroff buffer containing the doc-strings from the DOC file.
Probably introduced at or before Emacs version 24.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/help-fns.el.gz
;;; Replacements for old lib-src/ programs. Don't seem especially useful.
;; Replaces lib-src/digest-doc.c.
;;;###autoload
(defun doc-file-to-man (file)
"Produce an nroff buffer containing the doc-strings from the DOC file."
(interactive (list (read-file-name "Name of DOC file: " doc-directory
internal-doc-file-name t)))
(or (file-readable-p file)
(error "Cannot read file `%s'" file))
(pop-to-buffer (generate-new-buffer "*man-doc*"))
(setq buffer-undo-list t)
(insert ".TH \"Command Summary for GNU Emacs\"\n"
".AU Richard M. Stallman\n")
(insert-file-contents file)
(let (notfirst)
(while (search-forward "\^_" nil 'move)
(if (= (following-char) ?S)
(delete-region (1- (point)) (line-end-position))
(delete-char -1)
(if notfirst
(insert "\n.DE\n")
(setq notfirst t))
(insert "\n.SH ")
(insert (if (= (following-char) ?F) "Function " "Variable "))
(delete-char 1)
(forward-line 1)
(insert ".DS L\n"))))
(insert "\n.DE\n")
(setq buffer-undo-list nil)
(nroff-mode))