annotate lisp/packages/makeinfo.el @ 169:15872534500d r20-3b11

Import from CVS: tag r20-3b11
author cvs
date Mon, 13 Aug 2007 09:46:53 +0200
parents cca96a509cfe
children 489f57a838ef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
1 ;;; makeinfo.el --- run makeinfo conveniently
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
3 ;; Copyright (C) 1991, 1993 Free Software Foundation, Inc.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
5 ;; Author: Robert J. Chassell
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
6 ;; Maintainer: FSF
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
8 ;; This file is part of XEmacs.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
11 ;; under the terms of the GNU General Public License as published by
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ;; any later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
18 ;; General Public License for more details.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
23 ;; Boston, MA 02111-1307, USA.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
2
ac2d302a0011 Import from CVS: tag r19-15b2
cvs
parents: 0
diff changeset
25 ;;; Synched up with: FSF 19.34.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 ;;; Commentary:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 ;;; The Texinfo mode `makeinfo' related commands are:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 ;; makeinfo-region to run makeinfo on the current region.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 ;; makeinfo-buffer to run makeinfo on the current buffer, or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 ;; with optional prefix arg, on current region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 ;; kill-compilation to kill currently running makeinfo job
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 ;; makeinfo-recenter-makeinfo-buffer to redisplay *compilation* buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 ;;; Keybindings (defined in `texinfo.el')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 ;; makeinfo bindings
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 ; (define-key texinfo-mode-map "\C-c\C-m\C-r" 'makeinfo-region)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 ; (define-key texinfo-mode-map "\C-c\C-m\C-b" 'makeinfo-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 ; (define-key texinfo-mode-map "\C-c\C-m\C-k" 'kill-compilation)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 ; (define-key texinfo-mode-map "\C-c\C-m\C-l"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 ; 'makeinfo-recenter-compilation-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 ;;; Code:
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 ;;; Variables used by `makeinfo'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 (require 'compile)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 2
diff changeset
52 (defgroup makeinfo nil
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 2
diff changeset
53 "Run makeinfo conveniently"
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 2
diff changeset
54 :group 'docs)
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 2
diff changeset
55
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 2
diff changeset
56
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 2
diff changeset
57 (defcustom makeinfo-run-command "makeinfo"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 "*Command used to run `makeinfo' subjob.
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 2
diff changeset
59 The name of the file is appended to this string, separated by a space."
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 2
diff changeset
60 :type 'string
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 2
diff changeset
61 :group 'makeinfo)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 2
diff changeset
63 (defcustom makeinfo-options "--fill-column=70"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 "*String containing options for running `makeinfo'.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 Do not include `--footnote-style' or `--paragraph-indent';
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 the proper way to specify those is with the Texinfo commands
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 2
diff changeset
67 `@footnotestyle` and `@paragraphindent'."
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 2
diff changeset
68 :type 'string
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 2
diff changeset
69 :group 'makeinfo)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 (require 'texinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 (defvar makeinfo-compilation-process nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 "Process that runs `makeinfo'. Should start out nil.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 (defvar makeinfo-temp-file nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 "Temporary file name used for text being sent as input to `makeinfo'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 (defvar makeinfo-output-file-name nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 "Info file name used for text output by `makeinfo'.")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 ;;; The `makeinfo' function definitions
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 (defun makeinfo-region (region-beginning region-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 "Make Info file from region of current Texinfo file, and switch to it.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 This command does not offer the `next-error' feature since it would
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 apply to a temporary file, not the original; use the `makeinfo-buffer'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 command to gain use of `next-error'."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 (interactive "r")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 (let (filename-or-header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 filename-or-header-beginning
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 filename-or-header-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 ;; Cannot use `let' for makeinfo-temp-file or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 ;; makeinfo-output-file-name since `makeinfo-compilation-sentinel'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 ;; needs them.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 (setq makeinfo-temp-file
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 (concat
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 (make-temp-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 (substring (buffer-file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 (or (string-match "\\.tex" (buffer-file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 (length (buffer-file-name)))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 ".texinfo"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 (save-restriction
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 (widen)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 (let ((search-end (save-excursion (forward-line 100) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 ;; Find and record the Info filename,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 ;; or else explain that a filename is needed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 (if (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 "^@setfilename[ \t]+\\([^ \t\n]+\\)[ \t]*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 search-end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 (setq makeinfo-output-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 (buffer-substring (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 "The texinfo file needs a line saying: @setfilename <name>"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 ;; Find header and specify its beginning and end.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 (if (and
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 (search-forward tex-start-of-header search-end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 ;; Mark beginning of header.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 (setq filename-or-header-beginning (point)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 (prog1
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 (search-forward tex-end-of-header nil t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 ;; Mark end of header
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 (setq filename-or-header-end (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 ;; Insert the header into the temporary file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 (write-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 (min filename-or-header-beginning region-beginning)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 filename-or-header-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 makeinfo-temp-file nil nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 ;; Else no header; insert @filename line into temporary file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 (search-forward "@setfilename" search-end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 (beginning-of-line)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 (setq filename-or-header-beginning (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 (forward-line 1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 (setq filename-or-header-end (point))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 (write-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 (min filename-or-header-beginning region-beginning)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 filename-or-header-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 makeinfo-temp-file nil nil))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 ;; Insert the region into the file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 (write-region
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 (max region-beginning filename-or-header-end)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 region-end
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 makeinfo-temp-file t nil)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 ;; Run the `makeinfo-compile' command in the *compilation* buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 (makeinfo-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 (concat makeinfo-run-command
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 makeinfo-options
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 " "
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 makeinfo-temp-file)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 "Use `makeinfo-buffer' to gain use of the `next-error' command"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 nil)))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 ;;; Actually run makeinfo. COMMAND is the command to run.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 ;;; ERROR-MESSAGE is what to say when next-error can't find another error.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 ;;; If PARSE-ERRORS is non-nil, do try to parse error messages.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 (defun makeinfo-compile (command error-message parse-errors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 (let ((buffer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 (compile-internal command error-message nil
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 (and (not parse-errors)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 ;; If we do want to parse errors, pass nil.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 ;; Otherwise, use this function, which won't
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 ;; ever find any errors.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 '(lambda (&rest ignore)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 (setq compilation-error-list nil))))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 (set-process-sentinel (get-buffer-process buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 'makeinfo-compilation-sentinel)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 ;; Delete makeinfo-temp-file after processing is finished,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 ;; and visit Info file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 ;; This function is called when the compilation process changes state.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 ;; Based on `compilation-sentinel' in compile.el
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 (defun makeinfo-compilation-sentinel (proc msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 (compilation-sentinel proc msg)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 (if (and makeinfo-temp-file (file-exists-p makeinfo-temp-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 (delete-file makeinfo-temp-file))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 ;; Always use the version on disk.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 (if (get-file-buffer makeinfo-output-file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 (progn (set-buffer makeinfo-output-file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 (revert-buffer t t))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 (find-file makeinfo-output-file-name))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 (goto-char (point-min)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 (defun makeinfo-buffer ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 "Make Info file from current buffer.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 Use the \\[next-error] command to move to the next error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 \(if there are errors\)."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 (interactive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 (cond ((null buffer-file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 (error "Buffer not visiting any file"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 ((buffer-modified-p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 (if (y-or-n-p "Buffer modified; do you want to save it? ")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 (save-buffer))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 ;; Find and record the Info filename,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 ;; or else explain that a filename is needed.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (goto-char (point-min))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 (let ((search-end (save-excursion (forward-line 100) (point))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 (if (re-search-forward
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 "^@setfilename[ \t]+\\([^ \t\n]+\\)[ \t]*"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 search-end t)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 (setq makeinfo-output-file-name
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 (buffer-substring (match-beginning 1) (match-end 1)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 (error
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 "The texinfo file needs a line saying: @setfilename <name>"))))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 (save-excursion
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 (makeinfo-compile
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 (concat makeinfo-run-command " " makeinfo-options
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 " " buffer-file-name)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 "No more errors."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 t)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 (defun makeinfo-recenter-compilation-buffer (linenum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 "Redisplay `*compilation*' buffer so most recent output can be seen.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 The last line of the buffer is displayed on
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 line LINE of the window, or centered if LINE is nil."
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 (interactive "P")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 (let ((makeinfo-buffer (get-buffer "*compilation*"))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 (old-buffer (current-buffer)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 (if (null makeinfo-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 (message "No *compilation* buffer")
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 (pop-to-buffer makeinfo-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 (bury-buffer makeinfo-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 (goto-char (point-max))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 (recenter (if linenum
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 (prefix-numeric-value linenum)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 (/ (window-height) 2)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 (pop-to-buffer old-buffer)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 )))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 ;;; Place `provide' at end of file.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 (provide 'makeinfo)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 ;;; makeinfo.el ends here
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258