Mercurial > emacs
annotate lisp/textmodes/makeinfo.el @ 58389:dc700332c8ee
*** empty log message ***
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 21 Nov 2004 03:51:04 +0000 |
parents | 695cf19ef79e |
children | 2237b71ba613 375f2633d815 |
rev | line source |
---|---|
13337 | 1 ;;; makeinfo.el --- run makeinfo conveniently |
2 | |
48934
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
3 ;; Copyright (C) 1991, 1993, 2002 Free Software Foundation, Inc. |
3856 | 4 |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
5 ;; Author: Robert J. Chassell |
13337 | 6 ;; Maintainer: FSF |
38697
a19197c6442f
Keyword added and FSF specified as Maintainer.
Pavel Janík <Pavel@Janik.cz>
parents:
38412
diff
changeset
|
7 ;; Keywords: docs convenience |
3856 | 8 |
13337 | 9 ;; This file is part of GNU Emacs. |
3856 | 10 |
11 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
12 ;; it under the terms of the GNU General Public License as published by | |
13 ;; the Free Software Foundation; either version 2, or (at your option) | |
14 ;; any later version. | |
15 | |
16 ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 ;; GNU General Public License for more details. | |
20 | |
21 ;; You should have received a copy of the GNU General Public License | |
14169 | 22 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
24 ;; Boston, MA 02111-1307, USA. | |
3856 | 25 |
26 ;;; Commentary: | |
27 | |
28 ;;; The Texinfo mode `makeinfo' related commands are: | |
29 | |
30 ;; makeinfo-region to run makeinfo on the current region. | |
31 ;; makeinfo-buffer to run makeinfo on the current buffer, or | |
32 ;; with optional prefix arg, on current region | |
33 ;; kill-compilation to kill currently running makeinfo job | |
34 ;; makeinfo-recenter-makeinfo-buffer to redisplay *compilation* buffer | |
35 | |
36 ;;; Keybindings (defined in `texinfo.el') | |
37 | |
38 ;; makeinfo bindings | |
39 ; (define-key texinfo-mode-map "\C-c\C-m\C-r" 'makeinfo-region) | |
40 ; (define-key texinfo-mode-map "\C-c\C-m\C-b" 'makeinfo-buffer) | |
41 ; (define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation) | |
42 ; (define-key texinfo-mode-map "\C-c\C-m\C-l" | |
43 ; 'makeinfo-recenter-compilation-buffer) | |
44 | |
45 ;;; Code: | |
46 | |
47 ;;; Variables used by `makeinfo' | |
48 | |
49 (require 'compile) | |
48934
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
50 (require 'info) |
3856 | 51 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
52 (defgroup makeinfo nil |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
53 "Run makeinfo conveniently" |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
54 :group 'docs) |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
55 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
56 |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
57 (defcustom makeinfo-run-command "makeinfo" |
3856 | 58 "*Command used to run `makeinfo' subjob. |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
59 The name of the file is appended to this string, separated by a space." |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
60 :type 'string |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
61 :group 'makeinfo) |
3856 | 62 |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
63 (defcustom makeinfo-options "--fill-column=70" |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
64 "*String containing options for running `makeinfo'. |
3856 | 65 Do not include `--footnote-style' or `--paragraph-indent'; |
66 the proper way to specify those is with the Texinfo commands | |
17411
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
67 `@footnotestyle` and `@paragraphindent'." |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
68 :type 'string |
f0ff96a35eb8
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
69 :group 'makeinfo) |
3856 | 70 |
71 (require 'texinfo) | |
72 | |
73 (defvar makeinfo-compilation-process nil | |
74 "Process that runs `makeinfo'. Should start out nil.") | |
75 | |
76 (defvar makeinfo-temp-file nil | |
77 "Temporary file name used for text being sent as input to `makeinfo'.") | |
78 | |
79 (defvar makeinfo-output-file-name nil | |
80 "Info file name used for text output by `makeinfo'.") | |
81 | |
48934
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
82 (defvar makeinfo-output-node-name nil |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
83 "Node name to visit in output file, for `makeinfo-buffer'.") |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
84 |
3856 | 85 |
86 ;;; The `makeinfo' function definitions | |
87 | |
88 (defun makeinfo-region (region-beginning region-end) | |
89 "Make Info file from region of current Texinfo file, and switch to it. | |
90 | |
91 This command does not offer the `next-error' feature since it would | |
92 apply to a temporary file, not the original; use the `makeinfo-buffer' | |
93 command to gain use of `next-error'." | |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
94 |
3856 | 95 (interactive "r") |
96 (let (filename-or-header | |
97 filename-or-header-beginning | |
98 filename-or-header-end) | |
99 ;; Cannot use `let' for makeinfo-temp-file or | |
100 ;; makeinfo-output-file-name since `makeinfo-compilation-sentinel' | |
101 ;; needs them. | |
102 | |
103 (setq makeinfo-temp-file | |
104 (concat | |
26039
fb6b9c37cdc4
Use make-temp-file.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
17411
diff
changeset
|
105 (make-temp-file |
3856 | 106 (substring (buffer-file-name) |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
107 0 |
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
108 (or (string-match "\\.tex" (buffer-file-name)) |
3856 | 109 (length (buffer-file-name))))) |
110 ".texinfo")) | |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
111 |
3856 | 112 (save-excursion |
113 (save-restriction | |
114 (widen) | |
115 (goto-char (point-min)) | |
116 (let ((search-end (save-excursion (forward-line 100) (point)))) | |
117 ;; Find and record the Info filename, | |
118 ;; or else explain that a filename is needed. | |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
119 (if (re-search-forward |
3856 | 120 "^@setfilename[ \t]+\\([^ \t\n]+\\)[ \t]*" |
121 search-end t) | |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
122 (setq makeinfo-output-file-name |
3856 | 123 (buffer-substring (match-beginning 1) (match-end 1))) |
124 (error | |
125 "The texinfo file needs a line saying: @setfilename <name>")) | |
126 | |
127 ;; Find header and specify its beginning and end. | |
128 (goto-char (point-min)) | |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
129 (if (and |
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
130 (prog1 |
6828
cccf812ed4f2
(makeinfo-region): Fix name of tex-start/end-of-header.
Richard M. Stallman <rms@gnu.org>
parents:
4149
diff
changeset
|
131 (search-forward tex-start-of-header search-end t) |
3856 | 132 (beginning-of-line) |
133 ;; Mark beginning of header. | |
134 (setq filename-or-header-beginning (point))) | |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
135 (prog1 |
6828
cccf812ed4f2
(makeinfo-region): Fix name of tex-start/end-of-header.
Richard M. Stallman <rms@gnu.org>
parents:
4149
diff
changeset
|
136 (search-forward tex-end-of-header nil t) |
3856 | 137 (beginning-of-line) |
138 ;; Mark end of header | |
139 (setq filename-or-header-end (point)))) | |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
140 |
3856 | 141 ;; Insert the header into the temporary file. |
142 (write-region | |
143 (min filename-or-header-beginning region-beginning) | |
144 filename-or-header-end | |
145 makeinfo-temp-file nil nil) | |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
146 |
3856 | 147 ;; Else no header; insert @filename line into temporary file. |
148 (goto-char (point-min)) | |
149 (search-forward "@setfilename" search-end t) | |
150 (beginning-of-line) | |
151 (setq filename-or-header-beginning (point)) | |
152 (forward-line 1) | |
153 (setq filename-or-header-end (point)) | |
154 (write-region | |
155 (min filename-or-header-beginning region-beginning) | |
156 filename-or-header-end | |
157 makeinfo-temp-file nil nil)) | |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
158 |
3856 | 159 ;; Insert the region into the file. |
160 (write-region | |
161 (max region-beginning filename-or-header-end) | |
162 region-end | |
163 makeinfo-temp-file t nil) | |
164 | |
165 ;; Run the `makeinfo-compile' command in the *compilation* buffer | |
166 (save-excursion | |
167 (makeinfo-compile | |
168 (concat makeinfo-run-command | |
169 " " | |
170 makeinfo-options | |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
171 " " |
3856 | 172 makeinfo-temp-file) |
3857
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
173 "Use `makeinfo-buffer' to gain use of the `next-error' command" |
48934
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
174 nil |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
175 'makeinfo-compilation-sentinel-region))))))) |
3856 | 176 |
3857
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
177 ;;; Actually run makeinfo. COMMAND is the command to run. |
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
178 ;;; ERROR-MESSAGE is what to say when next-error can't find another error. |
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
179 ;;; If PARSE-ERRORS is non-nil, do try to parse error messages. |
48934
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
180 (defun makeinfo-compile (command error-message parse-errors sentinel) |
3857
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
181 (let ((buffer |
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
182 (compile-internal command error-message nil |
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
183 (and (not parse-errors) |
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
184 ;; If we do want to parse errors, pass nil. |
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
185 ;; Otherwise, use this function, which won't |
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
186 ;; ever find any errors. |
29591
b70f4500968f
(makeinfo-compile): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
26039
diff
changeset
|
187 (lambda (&rest ignore) |
b70f4500968f
(makeinfo-compile): Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
26039
diff
changeset
|
188 (setq compilation-error-list nil)))))) |
48934
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
189 (set-process-sentinel (get-buffer-process buffer) sentinel))) |
3856 | 190 |
3857
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
191 ;; Delete makeinfo-temp-file after processing is finished, |
3856 | 192 ;; and visit Info file. |
193 ;; This function is called when the compilation process changes state. | |
194 ;; Based on `compilation-sentinel' in compile.el | |
48934
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
195 (defun makeinfo-compilation-sentinel-region (proc msg) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
196 "Sentinel for `makeinfo-compile' run from `makeinfo-region'." |
3857
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
197 (compilation-sentinel proc msg) |
48934
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
198 (when (memq (process-status proc) '(signal exit)) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
199 (if (file-exists-p makeinfo-temp-file) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
200 (delete-file makeinfo-temp-file)) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
201 ;; Always use the version on disk. |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
202 (let ((buffer (get-file-buffer makeinfo-output-file-name))) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
203 (if buffer |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
204 (with-current-buffer buffer |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
205 (revert-buffer t t)) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
206 (setq buffer (find-file-noselect makeinfo-output-file-name))) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
207 (if (window-dedicated-p (selected-window)) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
208 (switch-to-buffer-other-window buffer) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
209 (switch-to-buffer buffer))) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
210 (goto-char (point-min)))) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
211 |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
212 (defun makeinfo-current-node () |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
213 "Return the name of the node containing point, in a texinfo file." |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
214 (save-excursion |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
215 (end-of-line) ; in case point is at the start of an @node line |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
216 (if (re-search-backward "^@node\\s-+\\([^,\n]+\\)" (point-min) t) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
217 (match-string 1) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
218 "Top"))) |
3856 | 219 |
3857
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
220 (defun makeinfo-buffer () |
3856 | 221 "Make Info file from current buffer. |
222 | |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
223 Use the \\[next-error] command to move to the next error |
3857
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
224 \(if there are errors\)." |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
225 |
3857
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
226 (interactive) |
3856 | 227 (cond ((null buffer-file-name) |
3857
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
228 (error "Buffer not visiting any file")) |
3856 | 229 ((buffer-modified-p) |
230 (if (y-or-n-p "Buffer modified; do you want to save it? ") | |
231 (save-buffer)))) | |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
232 |
3856 | 233 ;; Find and record the Info filename, |
234 ;; or else explain that a filename is needed. | |
235 (save-excursion | |
236 (goto-char (point-min)) | |
237 (let ((search-end (save-excursion (forward-line 100) (point)))) | |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
238 (if (re-search-forward |
3856 | 239 "^@setfilename[ \t]+\\([^ \t\n]+\\)[ \t]*" |
240 search-end t) | |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
241 (setq makeinfo-output-file-name |
48934
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
242 (expand-file-name |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
243 (buffer-substring (match-beginning 1) (match-end 1)))) |
3856 | 244 (error |
245 "The texinfo file needs a line saying: @setfilename <name>")))) | |
48934
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
246 (setq makeinfo-output-node-name (makeinfo-current-node)) |
49599
5ade352e8d1c
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
48934
diff
changeset
|
247 |
3856 | 248 (save-excursion |
249 (makeinfo-compile | |
3857
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
250 (concat makeinfo-run-command " " makeinfo-options |
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
251 " " buffer-file-name) |
ef8b4ed0de91
*** empty log message ***
Richard M. Stallman <rms@gnu.org>
parents:
3856
diff
changeset
|
252 "No more errors." |
48934
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
253 t |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
254 'makeinfo-compilation-sentinel-buffer))) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
255 |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
256 (defun makeinfo-compilation-sentinel-buffer (proc msg) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
257 "Sentinel for `makeinfo-compile' run from `makeinfo-buffer'." |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
258 (compilation-sentinel proc msg) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
259 (when (memq (process-status proc) '(signal exit)) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
260 (when (file-exists-p makeinfo-output-file-name) |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
261 (Info-revert-find-node |
48b3aae63381
(makeinfo-buffer): Display result using Info-mode.
Richard M. Stallman <rms@gnu.org>
parents:
42429
diff
changeset
|
262 makeinfo-output-file-name makeinfo-output-node-name)))) |
3856 | 263 |
264 (defun makeinfo-recenter-compilation-buffer (linenum) | |
265 "Redisplay `*compilation*' buffer so most recent output can be seen. | |
266 The last line of the buffer is displayed on | |
267 line LINE of the window, or centered if LINE is nil." | |
268 (interactive "P") | |
269 (let ((makeinfo-buffer (get-buffer "*compilation*")) | |
270 (old-buffer (current-buffer))) | |
271 (if (null makeinfo-buffer) | |
272 (message "No *compilation* buffer") | |
273 (pop-to-buffer makeinfo-buffer) | |
274 (bury-buffer makeinfo-buffer) | |
275 (goto-char (point-max)) | |
276 (recenter (if linenum | |
277 (prefix-numeric-value linenum) | |
278 (/ (window-height) 2))) | |
279 (pop-to-buffer old-buffer) | |
280 ))) | |
281 | |
282 ;;; Place `provide' at end of file. | |
283 (provide 'makeinfo) | |
284 | |
52401 | 285 ;;; arch-tag: 5f810713-3de2-4e20-8030-4bc3dd0d9604 |
3856 | 286 ;;; makeinfo.el ends here |