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