Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

"Generic" backends to return a list of markers for either etags or gt…

…ags (admittedly, the gtags backend hasn't been tested yet!). Two issues, apart from hackishness: I think it should use something like memq indexing rather than symbol interning, and secondly the gtags backend will pollute the visited buffers with markers that weren't there before, which I hadn't thought about. Might be better to rewrite things in terms of buffer/position rather than markers.
  • Loading branch information...
commit 80da4b7ab620b1da3e5fa25149ffee960aecdcef 1 parent acfeffb
Mark Hepburn authored September 14, 2009

Showing 1 changed file with 19 additions and 1 deletion. Show diff stats Hide diff stats

  1. 20  tags-view.el
20  tags-view.el
@@ -98,6 +98,24 @@ etc."
98 98
                (t (rec (file-name-directory (directory-file-name dir)))))))
99 99
       (catch 'exit (rec working-dir)))))
100 100
 
  101
+(defun tv-get-tags-marker-list ()
  102
+  (let* ((backend (tv-determine-backend))
  103
+         (backend-fn (intern (concat "tv-get-tags-marker-list-for-"
  104
+                                     (symbol-name backend)))))
  105
+    (if (or (eq backend 'none) (not (fboundp backend-fn)))
  106
+        (error "Can't find a usable backend")
  107
+      (funcall backend-fn))))
  108
+(defun tv-get-tags-marker-list-for-etags ()
  109
+  (copy-list (ring-elements tags-location-ring)))
  110
+(defun tv-get-tags-marker-list-for-gtags ()
  111
+  (let ((points-and-buffers (mapcar 'cons gtags-point-stack gtags-buffer-stack))
  112
+        (gtags-markers nil))
  113
+    (dolist (pb points-and-buffers gtags-markers)
  114
+      (with-current-buffer (cdr pb)
  115
+        (save-excursion
  116
+          (goto-char (car pb))
  117
+          (setq gtags-markers (cons (point-marker) gtags-markers)))))))
  118
+
101 119
 (defun tv-view-history ()
102 120
   "The main entry point; pops open a buffer with the list of
103 121
 locations on the tag stack that can then optionally be operated
@@ -112,7 +130,7 @@ etc).  The following options will be available:
112 130
     (let ((inhibit-read-only t))
113 131
       (erase-buffer))
114 132
     (tags-history-mode)
115  
-    (let ((tag-items (copy-list (ring-elements tags-location-ring))))
  133
+    (let ((tag-items (tv-get-tags-marker-list)))
116 134
       (tv-insert-items tag-items))
117 135
     (setq buffer-read-only t)
118 136
     (goto-char 0)))

0 notes on commit 80da4b7

Please sign in to comment.
Something went wrong with that request. Please try again.