;;; makeinfo.el --- run makeinfo conveniently
-;; Copyright (C) 1991, 1993, 2002 Free Software Foundation, Inc.
+;; Copyright (C) 1991, 1993, 2001-2016 Free Software Foundation, Inc.
;; Author: Robert J. Chassell
-;; Maintainer: FSF
+;; Maintainer: emacs-devel@gnu.org
;; Keywords: docs convenience
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
(require 'compile)
(require 'info)
+(defvar tex-end-of-header)
+(defvar tex-start-of-header)
+
+
(defgroup makeinfo nil
"Run makeinfo conveniently."
:group 'docs)
(defcustom makeinfo-run-command "makeinfo"
- "*Command used to run `makeinfo' subjob.
+ "Command used to run `makeinfo' subjob.
The name of the file is appended to this string, separated by a space."
:type 'string
:group 'makeinfo)
(defcustom makeinfo-options "--fill-column=70"
- "*String containing options for running `makeinfo'.
+ "String containing options for running `makeinfo'.
Do not include `--footnote-style' or `--paragraph-indent';
the proper way to specify those is with the Texinfo commands
-`@footnotestyle` and `@paragraphindent'."
+`@footnotestyle' and `@paragraphindent'."
:type 'string
:group 'makeinfo)
makeinfo-options
" "
makeinfo-temp-file)
- "Use `makeinfo-buffer' to gain use of the `next-error' command"
- nil
+ t
'makeinfo-compilation-sentinel-region)))))))
-;;; Actually run makeinfo. COMMAND is the command to run.
-;;; ERROR-MESSAGE is what to say when next-error can't find another error.
-;;; If PARSE-ERRORS is non-nil, do try to parse error messages.
-(defun makeinfo-compile (command error-message parse-errors sentinel)
- (let ((buffer
- (compile-internal command error-message nil
- (and (not parse-errors)
- ;; If we do want to parse errors, pass nil.
- ;; Otherwise, use this function, which won't
- ;; ever find any errors.
- (lambda (&rest ignore)
- (setq compilation-error-list nil))))))
+(defun makeinfo-next-error (arg reset)
+ "This function is used to disable `next-error' if the user has
+used `makeinfo-region'. Since the compilation process is used on
+a temporary file in that case, calling `next-error' would give
+nonsensical results."
+ (error "Use `makeinfo-buffer' to gain use of the `next-error' command"))
+
+;; Actually run makeinfo. COMMAND is the command to run. If
+;; DISABLE-ERRORS is non-nil, disable `next-error' by setting
+;; `next-error-function' to `makeinfo-next-error' in the compilation
+;; buffer.
+(defun makeinfo-compile (command disable-errors sentinel)
+ (let ((buffer (compilation-start command)))
+ (with-current-buffer buffer
+ (setq next-error-function
+ (if disable-errors
+ 'makeinfo-next-error
+ 'compilation-next-error-function)))
(set-process-sentinel (get-buffer-process buffer) sentinel)))
;; Delete makeinfo-temp-file after processing is finished,
(with-current-buffer buffer
(revert-buffer t t))
(setq buffer (find-file-noselect makeinfo-output-file-name)))
- (if (window-dedicated-p (selected-window))
+ (if (window-dedicated-p)
(switch-to-buffer-other-window buffer)
(switch-to-buffer buffer)))
(goto-char (point-min))))
"Make Info file from current buffer.
Use the \\[next-error] command to move to the next error
-\(if there are errors\)."
+\(if there are errors)."
(interactive)
(cond ((null buffer-file-name)
(setq makeinfo-output-node-name (makeinfo-current-node))
(save-excursion
- (makeinfo-compile
- (concat makeinfo-run-command " " makeinfo-options
- " " buffer-file-name)
- "No more errors."
- t
- 'makeinfo-compilation-sentinel-buffer)))
+ (let ((default-directory (file-name-directory buffer-file-name)))
+ (makeinfo-compile
+ (concat makeinfo-run-command " " makeinfo-options
+ " " (file-name-nondirectory buffer-file-name))
+ nil
+ 'makeinfo-compilation-sentinel-buffer))))
(defun makeinfo-compilation-sentinel-buffer (proc msg)
"Sentinel for `makeinfo-compile' run from `makeinfo-buffer'."
;;; Place `provide' at end of file.
(provide 'makeinfo)
-;;; arch-tag: 5f810713-3de2-4e20-8030-4bc3dd0d9604
;;; makeinfo.el ends here