[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 02/05: Rename ggtags-delete-tag-files to ggtags-delete-tags
From: |
Leo Liu |
Subject: |
[elpa] 02/05: Rename ggtags-delete-tag-files to ggtags-delete-tags |
Date: |
Sat, 12 Apr 2014 08:15:44 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit e587b5d571bb917b77a1caa7bea5f85b9e0579e5
Author: Leo Liu <address@hidden>
Date: Sun Apr 6 10:10:22 2014 +0800
Rename ggtags-delete-tag-files to ggtags-delete-tags
---
README.rst | 2 +-
ggtags.el | 72 ++++++++++++++++++++++++++++++-----------------------------
2 files changed, 38 insertions(+), 36 deletions(-)
diff --git a/README.rst b/README.rst
index 597929f..78bbe17 100644
--- a/README.rst
+++ b/README.rst
@@ -236,7 +236,7 @@ ggtags-visit-project-root
Open the project root directory in ``dired``.
-ggtags-delete-tag-files
+ggtags-delete-tags
Delete the GTAGS, GRTAGS, GPATH and ID files of current project.
diff --git a/ggtags.el b/ggtags.el
index e992acb..8bccea0 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -659,6 +659,33 @@ Do nothing if GTAGS exceeds the oversize limit unless
FORCE."
(setf (ggtags-project-dirty-p (ggtags-find-project)) nil)
(setf (ggtags-project-mtime (ggtags-find-project)) (float-time))))))
+(defun ggtags-delete-tags ()
+ "Delete file GTAGS, GRTAGS, GPATH, ID etc. generated by gtags."
+ (interactive (ignore (ggtags-check-project)))
+ (when (ggtags-current-project-root)
+ (let* ((re (concat "\\`" (regexp-opt '("GPATH" "GRTAGS" "GTAGS" "ID"))
"\\'"))
+ (files (cl-remove-if-not
+ (lambda (file)
+ ;; Don't trust `directory-files'.
+ (let ((case-fold-search nil))
+ (string-match-p re (file-name-nondirectory file))))
+ (directory-files (ggtags-current-project-root) t re)))
+ (buffer "*GTags File List*"))
+ (or files (user-error "No tag files found"))
+ (with-output-to-temp-buffer buffer
+ (princ (mapconcat #'identity files "\n")))
+ (let ((win (get-buffer-window buffer)))
+ (unwind-protect
+ (progn
+ (fit-window-to-buffer win)
+ (when (yes-or-no-p "Remove GNU Global tag files? ")
+ (with-demoted-errors (mapc #'delete-file files))
+ (remhash (ggtags-current-project-root) ggtags-projects)
+ (and (overlayp ggtags-highlight-tag-overlay)
+ (delete-overlay ggtags-highlight-tag-overlay))))
+ (when (window-live-p win)
+ (quit-window t win)))))))
+
(defvar-local ggtags-completion-cache nil)
;; See global/libutil/char.c
@@ -1049,33 +1076,6 @@ Use \\[jump-to-register] to restore the search session."
(defun ggtags-bookmark-jump (bmk)
(ggtags-global-rerun-search-1 (bookmark-prop-get bmk 'ggtags-search)))
-(defun ggtags-delete-tag-files ()
- "Delete the GTAGS, GRTAGS, GPATH etc. files generated by gtags."
- (interactive (ignore (ggtags-check-project)))
- (when (ggtags-current-project-root)
- (let* ((re (concat "\\`" (regexp-opt '("GPATH" "GRTAGS" "GTAGS" "ID"))
"\\'"))
- (files (cl-remove-if-not
- (lambda (file)
- ;; Don't trust `directory-files'.
- (let ((case-fold-search nil))
- (string-match-p re (file-name-nondirectory file))))
- (directory-files (ggtags-current-project-root) t re)))
- (buffer "*GTags File List*"))
- (or files (user-error "No tag files found"))
- (with-output-to-temp-buffer buffer
- (princ (mapconcat #'identity files "\n")))
- (let ((win (get-buffer-window buffer)))
- (unwind-protect
- (progn
- (fit-window-to-buffer win)
- (when (yes-or-no-p "Remove GNU Global tag files? ")
- (with-demoted-errors (mapc #'delete-file files))
- (remhash (ggtags-current-project-root) ggtags-projects)
- (and (overlayp ggtags-highlight-tag-overlay)
- (delete-overlay ggtags-highlight-tag-overlay))))
- (when (window-live-p win)
- (quit-window t win)))))))
-
(defun ggtags-browse-file-as-hypertext (file line)
"Browse FILE in hypertext (HTML) form."
(interactive (if (or current-prefix-arg (not buffer-file-name))
@@ -1749,7 +1749,7 @@ When finished invoke CALLBACK in BUFFER with process exit
status."
(let ((m (make-sparse-keymap)))
;; Globally bound to `M-g p'.
;; (define-key m "\M-'" 'previous-error)
- (define-key m (kbd "M-DEL") 'ggtags-delete-tag-files)
+ (define-key m (kbd "M-DEL") 'ggtags-delete-tags)
(define-key m "\M-p" 'ggtags-prev-mark)
(define-key m "\M-n" 'ggtags-next-mark)
(define-key m "\M-f" 'ggtags-find-file)
@@ -1799,8 +1799,9 @@ When finished invoke CALLBACK in BUFFER with process exit
status."
'(menu-item "Browse as hypertext" ggtags-browse-file-as-hypertext
:enable (ggtags-find-project)))
(define-key menu [delete-tags]
- '(menu-item "Delete tag files" ggtags-delete-tag-files
- :enable (ggtags-find-project)))
+ '(menu-item "Delete tags" ggtags-delete-tags
+ :enable (ggtags-find-project)
+ :help "Delete file GTAGS, GRTAGS, GPATH, ID etc."))
(define-key menu [kill-buffers]
'(menu-item "Kill project file buffers" ggtags-kill-file-buffers
:enable (ggtags-find-project)))
@@ -1814,14 +1815,14 @@ When finished invoke CALLBACK in BUFFER with process
exit status."
(define-key menu [prev-mark]
'(menu-item "Previous mark" ggtags-prev-mark))
(define-key menu [sep1] menu-bar-separator)
- (define-key menu [rerun-search]
- '(menu-item "Re-run past search" ggtags-global-rerun-search))
- (define-key menu [save-to-register]
- '(menu-item "Save search to register" ggtags-save-to-register))
(define-key menu [previous-error]
'(menu-item "Previous match" previous-error))
(define-key menu [next-error]
'(menu-item "Next match" next-error))
+ (define-key menu [rerun-search]
+ '(menu-item "Re-run past search" ggtags-global-rerun-search))
+ (define-key menu [save-to-register]
+ '(menu-item "Save search to register" ggtags-save-to-register))
(define-key menu [find-file]
'(menu-item "Find files" ggtags-find-file))
(define-key menu [query-replace]
@@ -1831,7 +1832,8 @@ When finished invoke CALLBACK in BUFFER with process exit
status."
(define-key menu [grep]
'(menu-item "Grep" ggtags-grep))
(define-key menu [find-symbol]
- '(menu-item "Find other symbol" ggtags-find-other-symbol))
+ '(menu-item "Find other symbol" ggtags-find-other-symbol
+ :help "Find references without definition"))
(define-key menu [find-tag-regexp]
'(menu-item "Find tag matching regexp" ggtags-find-tag-regexp))
(define-key menu [show-definition]