[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master c97360a 1/4: Fix #79: Make ggtags-update-tags run in the b
From: |
Leo Liu |
Subject: |
[elpa] master c97360a 1/4: Fix #79: Make ggtags-update-tags run in the background |
Date: |
Wed, 03 Dec 2014 02:08:10 +0000 |
branch: master
commit c97360a96702a497d46037180c7dd25656686a1e
Author: Leo Liu <address@hidden>
Date: Thu Nov 13 14:31:09 2014 +0800
Fix #79: Make ggtags-update-tags run in the background
Invoking `ggtags-update-tags' interactively now runs `global -u' in
the background for large projects whose GTAGS size is +10M per
ggtags-oversize-limit.
---
README.rst | 8 +++++++-
ggtags.el | 31 +++++++++++++++++++++----------
2 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/README.rst b/README.rst
index ac8b756..4e69160 100644
--- a/README.rst
+++ b/README.rst
@@ -308,9 +308,15 @@ Integration with other packages
NEWS
~~~~
-(devel) 0.8.7
+(devel) 0.8.8
+++++++++++++
+#. Command ``ggtags-update-tags`` now runs in the background for large
+ projects (per ``ggtags-oversize-limit``) without blocking emacs.
+
+[2014-11-10 Mon] 0.8.7
+++++++++++++++++++++++
+
#. New navigation command ``ggtags-navigation-start-file``.
#. New variable ``ggtags-use-sqlite3`` to enable sqlite3 storage.
diff --git a/ggtags.el b/ggtags.el
index efbab00..6f22617 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -3,7 +3,7 @@
;; Copyright (C) 2013-2014 Free Software Foundation, Inc.
;; Author: Leo Liu <address@hidden>
-;; Version: 0.8.7
+;; Version: 0.8.8
;; Keywords: tools, convenience
;; Created: 2013-01-29
;; URL: https://github.com/leoliu/ggtags
@@ -719,15 +719,26 @@ Do nothing if GTAGS exceeds the oversize limit unless
FORCE."
(ggtags-check-project)
;; Mark project info expired.
(setf (ggtags-project-timestamp (ggtags-find-project)) -1)
- (list t)))
- (when (or force (and (ggtags-find-project)
- (not (ggtags-project-oversize-p))
- (ggtags-project-dirty-p (ggtags-find-project))))
- (ggtags-with-current-project
- (ggtags-with-temp-message "`global -u' in progress..."
- (ggtags-process-string "global" "-u")
- (setf (ggtags-project-dirty-p (ggtags-find-project)) nil)
- (setf (ggtags-project-mtime (ggtags-find-project)) (float-time))))))
+ (list 'interactive)))
+ (cond ((and (eq force 'interactive) (ggtags-project-oversize-p))
+ (ggtags-with-current-project
+ (with-display-buffer-no-window
+ (with-current-buffer (compilation-start "global -u")
+ (add-hook 'compilation-finish-functions
+ #'ggtags-update-tags-finish nil t)))))
+ ((or force (and (ggtags-find-project)
+ (not (ggtags-project-oversize-p))
+ (ggtags-project-dirty-p (ggtags-find-project))))
+ (ggtags-with-current-project
+ (ggtags-with-temp-message "`global -u' in progress..."
+ (ggtags-process-string "global" "-u")
+ (ggtags-update-tags-finish))))))
+
+(defun ggtags-update-tags-finish (&optional buf how)
+ (if (and how buf (string-prefix-p "exited abnormally" how))
+ (display-buffer buf)
+ (setf (ggtags-project-dirty-p (ggtags-find-project)) nil)
+ (setf (ggtags-project-mtime (ggtags-find-project)) (float-time))))
(defun ggtags-update-tags-single (file &optional nowait)
;; NOTE: NOWAIT is ignored if file is remote file; see