]> git.eshelyaron.com Git - emacs.git/commitdiff
(makeinfo-compile): Use `compilation-start'. Set `next-error-function'
authorRomain Francoise <romain@orebokech.com>
Sat, 27 Aug 2005 16:11:44 +0000 (16:11 +0000)
committerRomain Francoise <romain@orebokech.com>
Sat, 27 Aug 2005 16:11:44 +0000 (16:11 +0000)
according to `disable-errors'.
(makeinfo-next-error): New function.
(makeinfo-region): Adjust to new `makeinfo-compile' prototype.
(makeinfo-buffer): Likewise.

lisp/ChangeLog
lisp/textmodes/makeinfo.el

index 1b7eb7d93176fe2d146ca6b19e9fcfdd02ab2a78..65e22bf8d2c75bfd706d6bd235a18666d359c219 100644 (file)
@@ -1,5 +1,12 @@
 2005-08-27  Romain Francoise  <romain@orebokech.com>
 
+       * textmodes/makeinfo.el (makeinfo-compile): Use
+       `compilation-start'.  Set `next-error-function' according to
+       `disable-errors'.
+       (makeinfo-next-error): New function.
+       (makeinfo-region): Adjust to new `makeinfo-compile' prototype.
+       (makeinfo-buffer): Likewise.
+
        * progmodes/compile.el (compilation-start): Add autoload cookie.
 
        * progmodes/antlr-mode.el: Don't autoload `compilation-start'.
index f2c407975e2d371204ff2f29d8eaf051a7852d04..d8829a2d3dd6f15c745edcc5de0c3650bae27e08 100644 (file)
@@ -171,22 +171,27 @@ command to gain use of `next-error'."
                      makeinfo-options
                      " "
                      makeinfo-temp-file)
-             "Use `makeinfo-buffer' to gain use of the `next-error' command"
-            nil
+            t
              'makeinfo-compilation-sentinel-region)))))))
 
-;;; 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 sentinel)
-  (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))))))
+(defun makeinfo-next-error (arg reset)
+  "This function is used to disable `next-error' if the user has
+used `makeinfo-region'.  Since the compilation process is used on
+a temporary file in that case, calling `next-error' would give
+nonsensical results."
+  (error "Use `makeinfo-buffer' to gain use of the `next-error' command"))
+
+;; Actually run makeinfo.  COMMAND is the command to run.  If
+;; DISABLE-ERRORS is non-nil, disable `next-error' by setting
+;; `next-error-function' to `makeinfo-next-error' in the compilation
+;; buffer.
+(defun makeinfo-compile (command disable-errors sentinel)
+  (let ((buffer (compilation-start command)))
+    (with-current-buffer buffer
+      (setq next-error-function
+           (if disable-errors
+               'makeinfo-next-error
+             'compilation-next-error-function)))
     (set-process-sentinel (get-buffer-process buffer) sentinel)))
 
 ;; Delete makeinfo-temp-file after processing is finished,
@@ -249,9 +254,8 @@ Use the \\[next-error] command to move to the next error
   (save-excursion
     (makeinfo-compile
      (concat makeinfo-run-command " " makeinfo-options
-             " " buffer-file-name)
-     "No more errors."
-     t
+            " " buffer-file-name)
+     nil
      'makeinfo-compilation-sentinel-buffer)))
 
 (defun makeinfo-compilation-sentinel-buffer (proc msg)