emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master cf17576 4/7: Fix #89: Make sure compilation-auto-jump run


From: Leo Liu
Subject: [elpa] master cf17576 4/7: Fix #89: Make sure compilation-auto-jump run before cleanup
Date: Sun, 2 Oct 2016 01:47:27 +0000 (UTC)

branch: master
commit cf17576ef095af77e17e959b8289be3d0a878a5e
Author: Leo Liu <address@hidden>
Commit: Leo Liu <address@hidden>

    Fix #89: Make sure compilation-auto-jump run before cleanup
---
 ggtags.el |   21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/ggtags.el b/ggtags.el
index 98addc2..c16f99d 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -1687,11 +1687,18 @@ ggtags: history match invalid, jump to first match 
instead")
             'compilation-message)))
         ;; There are multiple matches so pop up the buffer.
         (and ggtags-navigation-mode (ggtags-global--display-buffer))
-      ;; For the `compilation-auto-jump' in idle timer to run.
-      ;; See also: http://debbugs.gnu.org/13829
-      (sit-for 0)
+      ;; Manually run the `compilation-auto-jump' timer. Hackish but
+      ;; everything else seems unreliable. See:
+      ;;
+      ;; - http://debbugs.gnu.org/13829
+      ;; - http://debbugs.gnu.org/23987
+      ;; - https://github.com/leoliu/ggtags/issues/89
+      ;;
+      (pcase (cl-find 'compilation-auto-jump timer-list :key #'timer--function)
+        (`nil )
+        (timer (timer-event-handler timer)))
       (ggtags-navigation-mode -1)
-      (ggtags-navigation-mode-cleanup buf 0)))))
+      (ggtags-navigation-mode-cleanup buf t)))))
 
 (defvar ggtags-global-mode-font-lock-keywords
   '(("^Global \\(exited 
abnormally\\|interrupt\\|killed\\|terminated\\)\\(?:.*with code 
\\([0-9]+\\)\\)?.*"
@@ -1815,7 +1822,7 @@ ggtags: history match invalid, jump to first match 
instead")
             (goto-char (match-beginning 0))
           (goto-char orig))))))
 
-(defun ggtags-navigation-mode-cleanup (&optional buf time)
+(defun ggtags-navigation-mode-cleanup (&optional buf kill)
   (let ((buf (or buf ggtags-global-last-buffer)))
     (and (buffer-live-p buf)
          (with-current-buffer buf
@@ -1824,7 +1831,7 @@ ggtags: history match invalid, jump to first match 
instead")
            (when (and (derived-mode-p 'ggtags-global-mode)
                       (get-buffer-window))
              (quit-windows-on (current-buffer)))
-           (and time (run-with-idle-timer time nil #'kill-buffer buf))))))
+           (and kill (kill-buffer buf))))))
 
 (defun ggtags-navigation-mode-done ()
   (interactive)
@@ -1837,7 +1844,7 @@ ggtags: history match invalid, jump to first match 
instead")
   "Abort navigation and return to where the search was started."
   (interactive)
   (ggtags-navigation-mode -1)
-  (ggtags-navigation-mode-cleanup nil 0)
+  (ggtags-navigation-mode-cleanup nil t)
   ;; Run after (ggtags-navigation-mode -1) or
   ;; ggtags-global-start-marker might not have been saved.
   (when (and ggtags-global-start-marker



reply via email to

[Prev in Thread] Current Thread [Next in Thread]