aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-06-21 06:59:02 +0000
committerRichard M. Stallman1993-06-21 06:59:02 +0000
commit0f99112d119eccf54aa2f64ae2ed089c084bfba3 (patch)
treeef2708a4cdaa58d64801e6795163bfe79f0bc78f
parentbab8cd704a99f01ddd852213ac779717d137f894 (diff)
downloademacs-0f99112d119eccf54aa2f64ae2ed089c084bfba3.tar.gz
emacs-0f99112d119eccf54aa2f64ae2ed089c084bfba3.zip
*** empty log message ***
-rw-r--r--lisp/textmodes/makeinfo.el155
1 files changed, 39 insertions, 116 deletions
diff --git a/lisp/textmodes/makeinfo.el b/lisp/textmodes/makeinfo.el
index c41fdc820b5..44b360646b4 100644
--- a/lisp/textmodes/makeinfo.el
+++ b/lisp/textmodes/makeinfo.el
@@ -155,118 +155,48 @@ command to gain use of `next-error'."
155 makeinfo-options 155 makeinfo-options
156 " " 156 " "
157 makeinfo-temp-file) 157 makeinfo-temp-file)
158 "Use `makeinfo-buffer' to gain use of the `next-error' command."))))))) 158 "Use `makeinfo-buffer' to gain use of the `next-error' command"
159 159 nil)))))))
160;; Based on `compile1' in compile.el; changed so to make it possible 160
161;; to delete temporary file. 161;;; Actually run makeinfo. COMMAND is the command to run.
162(defun makeinfo-compile (command error-message &optional name-of-mode) 162;;; ERROR-MESSAGE is what to say when next-error can't find another error.
163 ;(save-some-buffers) ; Don't need to save other buffers. 163;;; If PARSE-ERRORS is non-nil, do try to parse error messages.
164 (if makeinfo-compilation-process 164(defun makeinfo-compile (command error-message parse-errors)
165 (if (or (not (eq (process-status makeinfo-compilation-process) 'run)) 165 (let ((buffer
166 (yes-or-no-p 166 (compile-internal command error-message nil
167 "A `makeinfo' compilation process is running; kill it? ")) 167 (and (not parse-errors)
168 (condition-case () 168 ;; If we do want to parse errors, pass nil.
169 (let ((comp-proc makeinfo-compilation-process)) 169 ;; Otherwise, use this function, which won't
170 (interrupt-process comp-proc) 170 ;; ever find any errors.
171 (sit-for 1) 171 '(lambda (&rest ignore)
172 (delete-process comp-proc)) 172 (setq compilation-error-list nil))))))
173 (error nil)) 173 (set-process-sentinel (get-buffer-process buffer)
174 (error "Cannot have two makeinfo processes"))) 174 'makeinfo-compilation-sentinel)))
175 (setq makeinfo-compilation-process nil) 175
176 (compilation-forget-errors) 176;; Delete makeinfo-temp-file after processing is finished,
177 (setq compilation-error-list t)
178 (setq compilation-error-message error-message)
179 (setq makeinfo-compilation-process
180 (start-process "makeinfo" "*compilation*"
181 shell-file-name
182 "-c" (concat "exec " command)))
183 (with-output-to-temp-buffer "*compilation*"
184 (princ "cd ")
185 (princ default-directory)
186 (terpri)
187 (princ command)
188 (terpri))
189 (let ((regexp compilation-error-regexp))
190 (save-excursion
191 (set-buffer "*compilation*")
192 (make-local-variable 'compilation-error-regexp)
193 (setq compilation-error-regexp regexp)))
194 (set-process-sentinel
195 makeinfo-compilation-process 'makeinfo-compilation-sentinel)
196 (let* ((thisdir default-directory)
197 (outbuf (process-buffer makeinfo-compilation-process))
198 (outwin (get-buffer-window outbuf)))
199 (if (eq outbuf (current-buffer))
200 (goto-char (point-max)))
201 (save-excursion
202 (set-buffer outbuf)
203 (buffer-flush-undo outbuf)
204 (let ((start (save-excursion (set-buffer outbuf) (point-min))))
205 (set-window-start outwin start)
206 (or (eq outwin (selected-window))
207 (set-window-point outwin start)))
208 (setq default-directory thisdir)
209 (fundamental-mode)
210 (setq mode-name (or name-of-mode "compilation"))
211 ;; Make log buffer's mode line show process state
212 (setq mode-line-process '(": %s")))))
213
214;; Delete makeinfo-temp-file after proccessing is finished,
215;; and visit Info file. 177;; and visit Info file.
216;; This function is called when the compilation process changes state. 178;; This function is called when the compilation process changes state.
217;; Based on `compilation-sentinel' in compile.el 179;; Based on `compilation-sentinel' in compile.el
218(defun makeinfo-compilation-sentinel (proc msg) 180(defun makeinfo-compilation-sentinel (proc msg)
219 (cond ((null (buffer-name (process-buffer proc))) 181 (compilation-sentinel proc msg)
220 ;; buffer killed 182 (if (and makeinfo-temp-file (file-exists-p makeinfo-temp-file))
221 (set-process-buffer proc nil)) 183 (delete-file makeinfo-temp-file))
222 ((memq (process-status proc) '(signal exit)) 184 ;; Always use the version on disk.
223 (let* ((obuf (current-buffer)) 185 (if (get-file-buffer makeinfo-output-file-name)
224 omax opoint) 186 (progn (set-buffer makeinfo-output-file-name)
225 ;; save-excursion isn't the right thing if 187 (revert-buffer t t))
226 ;; process-buffer is current-buffer 188 (find-file makeinfo-output-file-name))
227 (unwind-protect 189 (goto-char (point-min)))
228 (progn 190
229 ;; Write something in *compilation* and hack 191(defun makeinfo-buffer ()
230 ;; its mode line,
231 (set-buffer (process-buffer proc))
232 (setq omax (point-max) opoint (point))
233 (goto-char (point-max))
234 (insert ?\n mode-name " " msg)
235 (forward-char -1)
236 (insert " at "
237 (substring (current-time-string) 0 -5))
238 (forward-char 1)
239 (setq mode-line-process
240 (concat ": "
241 (symbol-name (process-status proc))))
242 ;; If buffer and mode line will show that the process
243 ;; is dead, we can delete it now. Otherwise it
244 ;; will stay around until M-x list-processes.
245 (delete-process proc))
246 (setq makeinfo-compilation-process nil)
247 ;; Force mode line redisplay soon
248 (set-buffer-modified-p (buffer-modified-p)))
249 (if (and opoint (< opoint omax))
250 (goto-char opoint))
251 (set-buffer obuf))
252 (if (and makeinfo-temp-file (file-exists-p makeinfo-temp-file))
253 (delete-file makeinfo-temp-file))
254 ;; Always use the version on disk.
255 (if (get-file-buffer makeinfo-output-file-name)
256 (progn (set-buffer makeinfo-output-file-name)
257 (revert-buffer t t)))
258 (find-file makeinfo-output-file-name)
259 (goto-char (point-min)))))
260
261(defun makeinfo-buffer (buffer)
262 "Make Info file from current buffer. 192 "Make Info file from current buffer.
263 193
264The \\[next-error] command can be used to move to the next error 194Use the \\[next-error] command to move to the next error
265\(if any are found\)." 195\(if there are errors\)."
266 196
267 (interactive "bRun `makeinfo' on: ") 197 (interactive)
268 (cond ((null buffer-file-name) 198 (cond ((null buffer-file-name)
269 (error "Buffer not visiting any file!")) 199 (error "Buffer not visiting any file"))
270 ((buffer-modified-p) 200 ((buffer-modified-p)
271 (if (y-or-n-p "Buffer modified; do you want to save it? ") 201 (if (y-or-n-p "Buffer modified; do you want to save it? ")
272 (save-buffer)))) 202 (save-buffer))))
@@ -286,16 +216,10 @@ The \\[next-error] command can be used to move to the next error
286 216
287 (save-excursion 217 (save-excursion
288 (makeinfo-compile 218 (makeinfo-compile
289 (concat makeinfo-run-command 219 (concat makeinfo-run-command " " makeinfo-options
290 " " 220 " " buffer-file-name)
291 makeinfo-options 221 "No more errors."
292 " " 222 t)))
293 "+footnote-style="
294 texinfo-footnote-style
295 " "
296 (buffer-file-name
297 (get-buffer buffer)))
298 "No more errors.")))
299 223
300(defun makeinfo-recenter-compilation-buffer (linenum) 224(defun makeinfo-recenter-compilation-buffer (linenum)
301 "Redisplay `*compilation*' buffer so most recent output can be seen. 225 "Redisplay `*compilation*' buffer so most recent output can be seen.
@@ -315,7 +239,6 @@ line LINE of the window, or centered if LINE is nil."
315 (pop-to-buffer old-buffer) 239 (pop-to-buffer old-buffer)
316 ))) 240 )))
317 241
318
319;;; Place `provide' at end of file. 242;;; Place `provide' at end of file.
320(provide 'makeinfo) 243(provide 'makeinfo)
321 244