*** empty log message ***
authorRichard M. Stallman <rms@gnu.org>
Mon, 21 Jun 1993 06:59:02 +0000 (06:59 +0000)
committerRichard M. Stallman <rms@gnu.org>
Mon, 21 Jun 1993 06:59:02 +0000 (06:59 +0000)
lisp/textmodes/makeinfo.el

index c41fdc8..44b3606 100644 (file)
@@ -155,118 +155,48 @@ command to gain use of `next-error'."
                      makeinfo-options
                      " " 
                      makeinfo-temp-file)
-             "Use `makeinfo-buffer' to gain use of the `next-error' command.")))))))
-
-;; Based on `compile1' in compile.el; changed so to make it possible
-;; to delete temporary file.
-(defun makeinfo-compile (command error-message &optional name-of-mode)
-  ;(save-some-buffers)                   ; Don't need to save other buffers.
-  (if makeinfo-compilation-process
-      (if (or (not (eq (process-status makeinfo-compilation-process) 'run))
-             (yes-or-no-p
-               "A `makeinfo' compilation process is running; kill it? "))
-         (condition-case ()
-             (let ((comp-proc makeinfo-compilation-process))
-               (interrupt-process comp-proc)
-               (sit-for 1)
-               (delete-process comp-proc))
-           (error nil))
-       (error "Cannot have two makeinfo processes")))
-  (setq makeinfo-compilation-process nil)
-  (compilation-forget-errors)
-  (setq compilation-error-list t)
-  (setq compilation-error-message error-message)
-  (setq makeinfo-compilation-process
-       (start-process "makeinfo" "*compilation*"         
-                      shell-file-name
-                      "-c" (concat "exec " command)))
-  (with-output-to-temp-buffer "*compilation*"             
-    (princ "cd ")
-    (princ default-directory)
-    (terpri)
-    (princ command)
-    (terpri))
-  (let ((regexp compilation-error-regexp))
-    (save-excursion
-      (set-buffer "*compilation*")                        
-      (make-local-variable 'compilation-error-regexp)
-      (setq compilation-error-regexp regexp)))
-  (set-process-sentinel
-   makeinfo-compilation-process 'makeinfo-compilation-sentinel)
-  (let* ((thisdir default-directory)
-        (outbuf (process-buffer makeinfo-compilation-process))
-        (outwin (get-buffer-window outbuf)))
-    (if (eq outbuf (current-buffer))
-       (goto-char (point-max)))
-    (save-excursion
-      (set-buffer outbuf)
-      (buffer-flush-undo outbuf)
-      (let ((start (save-excursion (set-buffer outbuf) (point-min))))
-       (set-window-start outwin start)
-       (or (eq outwin (selected-window))
-           (set-window-point outwin start)))
-      (setq default-directory thisdir)
-      (fundamental-mode)
-      (setq mode-name (or name-of-mode "compilation"))    
-      ;; Make log buffer's mode line show process state
-      (setq mode-line-process '(": %s")))))
-
-;; Delete makeinfo-temp-file after proccessing is finished,
+             "Use `makeinfo-buffer' to gain use of the `next-error' command"
+            nil)))))))
+
+;;; 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)
+  (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))))))
+    (set-process-sentinel (get-buffer-process buffer)
+                         'makeinfo-compilation-sentinel)))
+
+;; Delete makeinfo-temp-file after processing is finished,
 ;; and visit Info file.
 ;; This function is called when the compilation process changes state.
 ;; Based on `compilation-sentinel' in compile.el
 (defun makeinfo-compilation-sentinel (proc msg)
-  (cond ((null (buffer-name (process-buffer proc)))
-        ;; buffer killed
-        (set-process-buffer proc nil))
-       ((memq (process-status proc) '(signal exit))
-        (let* ((obuf (current-buffer))
-               omax opoint)
-          ;; save-excursion isn't the right thing if
-          ;;  process-buffer is current-buffer
-          (unwind-protect
-              (progn
-                ;; Write something in *compilation* and hack
-                ;; its mode line,
-                (set-buffer (process-buffer proc))
-                (setq omax (point-max) opoint (point))
-                (goto-char (point-max))
-                (insert ?\n mode-name " " msg)
-                (forward-char -1)
-                (insert " at "
-                        (substring (current-time-string) 0 -5))
-                (forward-char 1)
-                (setq mode-line-process
-                      (concat ": "
-                              (symbol-name (process-status proc))))
-                ;; If buffer and mode line will show that the process
-                ;; is dead, we can delete it now.  Otherwise it
-                ;; will stay around until M-x list-processes.
-                (delete-process proc))
-            (setq makeinfo-compilation-process nil)
-            ;; Force mode line redisplay soon
-            (set-buffer-modified-p (buffer-modified-p)))
-          (if (and opoint (< opoint omax))
-              (goto-char opoint))
-          (set-buffer obuf))
-         (if (and makeinfo-temp-file (file-exists-p makeinfo-temp-file))
-             (delete-file makeinfo-temp-file))
-         ;; Always use the version on disk.
-         (if (get-file-buffer makeinfo-output-file-name)
-             (progn (set-buffer makeinfo-output-file-name)
-                    (revert-buffer t t)))
-         (find-file makeinfo-output-file-name)
-         (goto-char (point-min)))))
-
-(defun makeinfo-buffer (buffer)
+  (compilation-sentinel proc msg)
+  (if (and makeinfo-temp-file (file-exists-p makeinfo-temp-file))
+      (delete-file makeinfo-temp-file))
+  ;; Always use the version on disk.
+  (if (get-file-buffer makeinfo-output-file-name)
+      (progn (set-buffer makeinfo-output-file-name)
+            (revert-buffer t t))
+    (find-file makeinfo-output-file-name))
+  (goto-char (point-min)))
+
+(defun makeinfo-buffer ()
   "Make Info file from current buffer.
 
-The \\[next-error] command can be used to move to the next error 
-\(if any are found\)."
-  
-  (interactive "bRun `makeinfo' on: ")
+Use the \\[next-error] command to move to the next error 
+\(if there are errors\)."
+  (interactive)
   (cond ((null buffer-file-name)
-         (error "Buffer not visiting any file!"))
+         (error "Buffer not visiting any file"))
         ((buffer-modified-p)
          (if (y-or-n-p "Buffer modified; do you want to save it? ")
              (save-buffer))))
@@ -286,16 +216,10 @@ The \\[next-error] command can be used to move to the next error
   
   (save-excursion
     (makeinfo-compile
-     (concat makeinfo-run-command
-             " " 
-             makeinfo-options
-             " " 
-             "+footnote-style="
-             texinfo-footnote-style
-             " "
-             (buffer-file-name
-              (get-buffer buffer)))
-     "No more errors.")))
+     (concat makeinfo-run-command " " makeinfo-options
+             " " buffer-file-name)
+     "No more errors."
+     t)))
 
 (defun makeinfo-recenter-compilation-buffer (linenum)
   "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."
       (pop-to-buffer old-buffer)
       )))
 
-\f
 ;;; Place `provide' at end of file.
 (provide 'makeinfo)