GNU bug report logs - #24585
25.1; avoid hack in ggtags.el to run compilation-auto-jump timer

Previous Next

Package: emacs;

Reported by: Leo Liu <sdl.web <at> gmail.com>

Date: Sun, 2 Oct 2016 04:58:02 UTC

Severity: normal

Tags: moreinfo

Found in version 25.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Leo Liu <sdl.web <at> gmail.com>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: 24585 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: bug#24585: 25.1; avoid hack in ggtags.el to run compilation-auto-jump timer
Date: Fri, 07 Oct 2016 02:31:39 +0800
On 2016-10-06 14:10 -0400, Stefan Monnier wrote:
> I thought that's what I had proposed, so yes, I think that's
> a good solution.

By exposing the position I can change ggtags not to depend on the order
of auto-jump and clean up.

The patch could look like this. Any objection to installing it in
emacs-25?


diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index f2e397a4..a7804fd7 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -1052,13 +1052,16 @@ POS and RES.")
 	      l2
 	    (setcdr l1 (cons (list ,key) l2)))))))
 
+(defvar-local compilation-auto-jump-pos nil)
+
 (defun compilation-auto-jump (buffer pos)
-  (with-current-buffer buffer
-    (goto-char pos)
-    (let ((win (get-buffer-window buffer 0)))
-      (if win (set-window-point win pos)))
-    (if compilation-auto-jump-to-first-error
-	(compile-goto-error))))
+  (when (buffer-live-p buffer)
+    (with-current-buffer buffer
+      (goto-char pos)
+      (let ((win (get-buffer-window buffer 0)))
+        (if win (set-window-point win pos)))
+      (if compilation-auto-jump-to-first-error
+          (compile-goto-error)))))
 
 ;; This function is the central driver, called when font-locking to gather
 ;; all information needed to later jump to corresponding source code.
@@ -1126,8 +1129,9 @@ POS and RES.")
     (when (and compilation-auto-jump-to-next
                (>= type compilation-skip-threshold))
       (kill-local-variable 'compilation-auto-jump-to-next)
+      (setq compilation-auto-jump-pos (match-beginning 0))
       (run-with-timer 0 nil 'compilation-auto-jump
-                      (current-buffer) (match-beginning 0)))
+                      (current-buffer) compilation-auto-jump-pos))
 
     (compilation-internal-error-properties
      file line end-line col end-col type fmt)))




This bug report was last modified 4 years and 227 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.