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

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

[elpa] master 378f13a 7/7: Merge branch 'master' of github.com:leoliu/gg


From: Leo Liu
Subject: [elpa] master 378f13a 7/7: Merge branch 'master' of github.com:leoliu/ggtags
Date: Sun, 2 Oct 2016 01:47:28 +0000 (UTC)

branch: master
commit 378f13a8c9e02f10a68f32466893da3b01a4c5ec
Merge: 3d0eb58 7a7ee76
Author: Leo Liu <address@hidden>
Commit: Leo Liu <address@hidden>

    Merge branch 'master' of github.com:leoliu/ggtags
---
 packages/ggtags/README.rst |   36 +++++++----
 packages/ggtags/ggtags.el  |  145 ++++++++++++++++++++++++++------------------
 2 files changed, 111 insertions(+), 70 deletions(-)

diff --git a/packages/ggtags/README.rst b/packages/ggtags/README.rst
index eda0427..2f5d982 100644
--- a/packages/ggtags/README.rst
+++ b/packages/ggtags/README.rst
@@ -8,9 +8,8 @@ list-packages``) and is also available on `MELPA
 
 The goal is to make working with GNU Global in Emacs as effortlessly
 and intuitively as possible and to integrate tightly with standard
-emacs packages. ``ggtags.el`` is tested in emacs 24.1, 24.2, 24.3,
-24.4 and trunk. Patches, feature requests and bug reports are welcome.
-Thanks.
+emacs packages. ``ggtags.el`` is tested in Emacs 24 and 25. Patches,
+feature requests and bug reports are welcome. Thanks.
 
 Features
 ~~~~~~~~
@@ -30,7 +29,8 @@ Features
 #. Highlight (definition) tag at point.
 #. Abbreviated display of file names.
 #. Support all Global search backends: ``grep``, ``idutils`` etc.
-#. Support `exuberant ctags <http://ctags.sourceforge.net/>`_ backend.
+#. Support `exuberant ctags <http://ctags.sourceforge.net/>`_ and
+   ``pygments`` backend.
 #. Support all Global's output formats: ``grep``, ``ctags-x``,
    ``cscope`` etc.
 #. Support projects on remote hosts (e.g. via ``tramp``).
@@ -114,8 +114,8 @@ directory. The mode line will display the directory name 
next to the
 buffer name. If point is at a valid definition tag, it is underlined.
 
 ``ggtags`` is similar to the standard ``etags`` package. For example
-these keys ``M-.``, ``M-,``, ``M-*`` and ``C-M-.`` should work as
-expected in ``ggtags-mode``.
+these keys ``M-.``, ``M-,`` and ``C-M-.`` should work as expected in
+``ggtags-mode``.
 
 The following search commands are available:
 
@@ -213,10 +213,10 @@ turned on to facilitate locating the right match.
 
 ``RET``
 
-   Found the right match so exit navigation mode. Resumable by ``M-,``
-   (``tags-loop-continue``).
+   Found the right match so exit navigation mode. Resumable by
+   ``M-x tags-loop-continue``.
 
-``M-*``
+``M-,`` (``M-*`` if Emacs < 25)
 
    Abort and go back to the location where the search was started.
 
@@ -227,8 +227,9 @@ Commands are available from the ``Ggtags`` menu in 
``ggtags-mode``.
 
 ggtags-prev-mark
 
-   Move to the previously (older) visited location. Unlike ``M-*``
-   this doesn't delete the location from the tag ring.
+   Move to the previously (older) visited location. Unlike ``M-,``
+   (``M-*`` if Emacs < 25) this doesn't delete the location from the
+   tag ring.
 
 ggtags-next-mark
 
@@ -313,6 +314,17 @@ Integration with other packages
 NEWS
 ~~~~
 
+[2016-10-02 Sun] 0.8.12
++++++++++++++++++++++++
+
+#. Work with Emacs 25.
+#. ``ggtags-navigation-mode`` is more discreet in displaying lighter
+   when ``ggtags-enable-navigation-keys`` is set to nil.
+#. ``ggtags-make-project`` tries harder to find TAG files respecting
+   ``GTAGSDBPATH``.
+#. Fix error "Selecting deleted buffer"
+   (`#89 <https://github.com/leoliu/ggtags/issues/89>`_).
+   
 [2015-12-15 Tue] 0.8.11
 +++++++++++++++++++++++
 
@@ -378,7 +390,7 @@ NEWS
 [2014-04-12 Sat] 0.8.3
 ++++++++++++++++++++++
 
-#. Tweak mode-line ligter in ``ggtags-navigation-mode``.
+#. Tweak mode-line lighter in ``ggtags-navigation-mode``.
 
 [2014-04-05 Sat] 0.8.2
 ++++++++++++++++++++++
diff --git a/packages/ggtags/ggtags.el b/packages/ggtags/ggtags.el
index aefe3af..b3172fb 100644
--- a/packages/ggtags/ggtags.el
+++ b/packages/ggtags/ggtags.el
@@ -1,9 +1,9 @@
 ;;; ggtags.el --- emacs frontend to GNU Global source code tagging system  -*- 
lexical-binding: t; -*-
 
-;; Copyright (C) 2013-2015  Free Software Foundation, Inc.
+;; Copyright (C) 2013-2016  Free Software Foundation, Inc.
 
 ;; Author: Leo Liu <address@hidden>
-;; Version: 0.8.11
+;; Version: 0.8.12
 ;; Keywords: tools, convenience
 ;; Created: 2013-01-29
 ;; URL: https://github.com/leoliu/ggtags
@@ -30,17 +30,21 @@
 ;; Usage:
 ;;
 ;; `ggtags' is similar to the standard `etags' package. These keys
-;; `M-.', `M-,', `M-*' and `C-M-.' should work as expected in
-;; `ggtags-mode'. See the README in https://github.com/leoliu/ggtags
-;; for more details.
+;; `M-.', `M-,' and `C-M-.' should work as expected in `ggtags-mode'.
+;; See the README in https://github.com/leoliu/ggtags for more
+;; details.
 ;;
 ;; All commands are available from the `Ggtags' menu in `ggtags-mode'.
 
-;;; NEWS 0.8.11 (2015-12-15):
+;;; NEWS 0.8.12 (2016-10-02):
 
-;; - `ggtags-highlight-tag-delay' is renamed to `ggtags-highlight-tag'
-;; - Tag highlighting can be disabled by setting
-;;   `ggtags-highlight-tag' to nil.
+;; - Work with Emacs 25
+;; - `ggtags-navigation-mode' is more discreet in displaying lighter
+;;   when `ggtags-enable-navigation-keys' is set to nil
+;; - `ggtags-make-project' tries harder to find TAG files respecting
+;;   `GTAGSDBPATH'
+;; - Fix error "Selecting deleted buffer"
+;;   https://github.com/leoliu/ggtags/issues/89
 ;;
 ;; See full NEWS on https://github.com/leoliu/ggtags#news
 
@@ -91,7 +95,14 @@
   (or (fboundp 'read-only-mode)         ;24.3
       (defalias 'read-only-mode 'toggle-read-only))
   (or (fboundp 'register-read-with-preview) ;24.4
-      (defalias 'register-read-with-preview 'read-char)))
+      (defalias 'register-read-with-preview 'read-char))
+  (or (boundp 'xref--marker-ring)       ;25.1
+      (defvaralias 'xref--marker-ring 'find-tag-marker-ring))
+  (or (fboundp 'xref-push-marker-stack) ;25.1
+      (defun xref-push-marker-stack (&optional m)
+        (ring-insert xref--marker-ring (or m (point-marker)))))
+  (or (fboundp 'xref-pop-marker-stack)
+      (defalias 'xref-pop-marker-stack 'pop-tag-mark)))
 
 (defgroup ggtags nil
   "GNU Global source code tagging system."
@@ -465,32 +476,36 @@ Set to nil to disable tag highlighting."
 
 (defun ggtags-make-project (root)
   (cl-check-type root string)
-  (pcase (nthcdr 5 (file-attributes (expand-file-name "GTAGS" root)))
-    (`(,mtime ,_ ,tag-size . ,_)
-     (let* ((default-directory (file-name-as-directory root))
-            (rtags-size (nth 7 (file-attributes "GRTAGS")))
-            (has-refs
-             (when rtags-size
-               (and (or (> rtags-size (* 32 1024))
-                        (with-demoted-errors "ggtags-make-project: %S"
-                          (not (equal "" (ggtags-process-string "global" 
"-crs")))))
-                    'has-refs)))
-            ;; http://thread.gmane.org/gmane.comp.gnu.global.bugs/1518
-            (has-path-style
-             (and (ggtags-process-succeed-p "global" "--path-style" "shorter" 
"--help")
-                  'has-path-style))
-            ;; http://thread.gmane.org/gmane.comp.gnu.global.bugs/1542
-            (has-color (and (ggtags-process-succeed-p "global" "--color" 
"--help")
-                            'has-color)))
-       (puthash default-directory
-                (ggtags-project--make :root default-directory
-                                      :tag-size tag-size
-                                      :has-refs has-refs
-                                      :has-path-style has-path-style
-                                      :has-color has-color
-                                      :mtime (float-time mtime)
-                                      :timestamp (float-time))
-                ggtags-projects)))))
+  (let* ((default-directory (file-name-as-directory root))
+         ;; NOTE: use of GTAGSDBPATH is not recommended. -- GLOBAL(1)
+         ;; ROOT and DB can be different directories due to GTAGSDBPATH.
+         (dbdir (concat (file-remote-p root)
+                        (ggtags-process-string "global" "-p"))))
+    (pcase (nthcdr 5 (file-attributes (expand-file-name "GTAGS" dbdir)))
+      (`(,mtime ,_ ,tag-size . ,_)
+       (let* ((rtags-size (nth 7 (file-attributes (expand-file-name "GRTAGS" 
dbdir))))
+              (has-refs
+               (when rtags-size
+                 (and (or (> rtags-size (* 32 1024))
+                          (with-demoted-errors "ggtags-make-project: %S"
+                            (not (equal "" (ggtags-process-string "global" 
"-crs")))))
+                      'has-refs)))
+              ;; http://thread.gmane.org/gmane.comp.gnu.global.bugs/1518
+              (has-path-style
+               (and (ggtags-process-succeed-p "global" "--path-style" 
"shorter" "--help")
+                    'has-path-style))
+              ;; http://thread.gmane.org/gmane.comp.gnu.global.bugs/1542
+              (has-color (and (ggtags-process-succeed-p "global" "--color" 
"--help")
+                              'has-color)))
+         (puthash default-directory
+                  (ggtags-project--make :root default-directory
+                                        :tag-size tag-size
+                                        :has-refs has-refs
+                                        :has-path-style has-path-style
+                                        :has-color has-color
+                                        :mtime (float-time mtime)
+                                        :timestamp (float-time))
+                  ggtags-projects))))))
 
 (defun ggtags-project-expired-p (project)
   (or (< (ggtags-project-timestamp project) 0)
@@ -924,7 +939,7 @@ blocking emacs."
 (defun ggtags-global-save-start-marker ()
   (when (markerp ggtags-global-start-marker)
     (setq ggtags-tag-ring-index nil)
-    (ring-insert find-tag-marker-ring ggtags-global-start-marker)
+    (xref-push-marker-stack ggtags-global-start-marker)
     (setq ggtags-global-start-marker t)))
 
 (defun ggtags-global-start (command &optional directory)
@@ -1362,17 +1377,16 @@ Use \\[jump-to-register] to restore the search session."
 (defun ggtags-next-mark (&optional arg)
   "Move to the next (newer) mark in the tag marker ring."
   (interactive)
-  (and (ring-empty-p find-tag-marker-ring) (user-error "Tag ring empty"))
+  (and (ring-empty-p xref--marker-ring) (user-error "Tag ring empty"))
   (setq ggtags-tag-ring-index
         ;; Note `ring-minus1' gets newer item.
         (funcall (if arg #'ring-plus1 #'ring-minus1)
                  (or ggtags-tag-ring-index
-                     (progn
-                       (ring-insert find-tag-marker-ring (point-marker))
-                       0))
-                 (ring-length find-tag-marker-ring)))
-  (let ((m (ring-ref find-tag-marker-ring ggtags-tag-ring-index))
-        (i (- (ring-length find-tag-marker-ring) ggtags-tag-ring-index)))
+                     (progn (xref-push-marker-stack)
+                            0))
+                 (ring-length xref--marker-ring)))
+  (let ((m (ring-ref xref--marker-ring ggtags-tag-ring-index))
+        (i (- (ring-length xref--marker-ring) ggtags-tag-ring-index)))
     (ggtags-echo "%d%s marker%s" i (pcase (mod i 10)
                                      ;; ` required for 24.1 and 24.2
                                      (`1 "st")
@@ -1407,7 +1421,7 @@ commands `next-error' and `previous-error'.
 
 \\{ggtags-view-tag-history-mode-map}"
   (interactive)
-  (and (ring-empty-p find-tag-marker-ring)
+  (and (ring-empty-p xref--marker-ring)
        (user-error "Tag ring empty"))
   (let ((split-window-preferred-function ggtags-split-window-function)
         (inhibit-read-only t))
@@ -1419,8 +1433,8 @@ commands `next-error' and `previous-error'.
     (setq tabulated-list-entries
           ;; Use a function so that revert can work properly.
           (lambda ()
-            (let ((counter (ring-length find-tag-marker-ring))
-                  (elements (or (ring-elements find-tag-marker-ring)
+            (let ((counter (ring-length xref--marker-ring))
+                  (elements (or (ring-elements xref--marker-ring)
                                 (user-error "Tag ring empty")))
                   (action (lambda (_button) (next-error 0)))
                   (get-line (lambda (m)
@@ -1677,11 +1691,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]+\\)\\)?.*"
@@ -1749,7 +1770,8 @@ ggtags: history match invalid, jump to first match 
instead")
     (define-key map "\M-o" 'ggtags-navigation-visible-mode)
     (define-key map [return] 'ggtags-navigation-mode-done)
     (define-key map "\r" 'ggtags-navigation-mode-done)
-    (define-key map [remap pop-tag-mark] 'ggtags-navigation-mode-abort)
+    (define-key map [remap pop-tag-mark] 'ggtags-navigation-mode-abort) ;Emacs 
24
+    (define-key map [remap xref-pop-marker-stack] 
'ggtags-navigation-mode-abort)
     map))
 
 (defvar ggtags-mode-map-alist
@@ -1804,7 +1826,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
@@ -1813,7 +1835,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)
@@ -1826,13 +1848,13 @@ 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
              (not (markerp ggtags-global-start-marker)))
     (setq ggtags-global-start-marker nil)
-    (pop-tag-mark)))
+    (xref-pop-marker-stack)))
 
 (defun ggtags-navigation-next-file (n)
   (interactive "p")
@@ -1941,7 +1963,12 @@ ggtags: history match invalid, jump to first match 
instead")
   "Ligher for `ggtags-navigation-mode'; set to nil to disable it.")
 
 (define-minor-mode ggtags-navigation-mode nil
-  :lighter ggtags-navigation-mode-lighter
+  ;; If `ggtags-enable-navigation-keys' is set to nil only display the
+  ;; lighter in `ggtags-mode' buffers.
+  ;; See https://github.com/leoliu/ggtags/issues/124
+  :lighter (:eval (and (or ggtags-enable-navigation-keys
+                           ggtags-mode)
+                       ggtags-navigation-mode-lighter))
   :global t
   (if ggtags-navigation-mode
       (progn
@@ -2136,7 +2163,7 @@ When finished invoke CALLBACK in BUFFER with process exit 
status."
     (define-key menu [view-tag]
       '(menu-item "View tag history" ggtags-view-tag-history))
     (define-key menu [pop-mark]
-      '(menu-item "Pop mark" pop-tag-mark
+      '(menu-item "Pop mark" xref-pop-marker-stack
                   :help "Pop to previous mark and destroy it"))
     (define-key menu [next-mark]
       '(menu-item "Next mark" ggtags-next-mark))
@@ -2168,6 +2195,8 @@ When finished invoke CALLBACK in BUFFER with process exit 
status."
       '(menu-item "Show definition" ggtags-show-definition))
     (define-key menu [find-reference]
       '(menu-item "Find reference" ggtags-find-reference))
+    ;; TODO: bind `find-tag-continue' to `M-*' after dropping support
+    ;; for emacs < 25.
     (define-key menu [find-tag-continue]
       '(menu-item "Continue find tag" tags-loop-continue))
     (define-key menu [find-tag]



reply via email to

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