[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 05/07: Doc and indentation fix
From: |
Leo Liu |
Subject: |
[elpa] 05/07: Doc and indentation fix |
Date: |
Tue, 06 May 2014 06:34:19 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit ae048d5dde75ccee315967f7b65f6942f864c1b7
Author: Leo Liu <address@hidden>
Date: Thu Apr 24 10:58:02 2014 +0800
Doc and indentation fix
Fix indentation for cl-labels and ggtags-with-current-project.
Fix FORMAT arg to with-demoted-errors.
---
README.rst | 2 +-
ggtags.el | 182 ++++++++++++++++++++++++++++++------------------------------
2 files changed, 93 insertions(+), 91 deletions(-)
diff --git a/README.rst b/README.rst
index c911254..22099eb 100644
--- a/README.rst
+++ b/README.rst
@@ -274,7 +274,7 @@ Integration with other packages
* company
``company`` can use ``ggtags`` as completion source via
- ``company-capf`` (enabled by default in emacs 24.4).
+ ``company-capf`` which is enabled by default.
* helm
diff --git a/ggtags.el b/ggtags.el
index 9218a98..6e005e4 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -398,19 +398,20 @@ properly update `ggtags-mode-map'."
(has-refs
(when rtags-size
(and (or (> rtags-size (* 32 1024))
- (with-demoted-errors
+ (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
- (with-demoted-errors ; in case `global' not found
+ (with-demoted-errors "ggtags-make-project: %S"
+ ;; in case `global' not found
(and (zerop (process-file (ggtags-program-path "global")
nil nil nil
"--path-style" "shorter" "--help"))
'has-path-style)))
;; http://thread.gmane.org/gmane.comp.gnu.global.bugs/1542
(has-color
- (with-demoted-errors
+ (with-demoted-errors "ggtags-make-project: %S"
(and (zerop (process-file (ggtags-program-path "global")
nil nil nil
"--color" "--help"))
@@ -612,8 +613,8 @@ Value is new modtime if updated."
(when (ggtags-find-project)
(with-temp-buffer
(ggtags-with-current-project
- (process-file (ggtags-program-path "global") nil t nil
- "-vP" (concat "^" (ggtags-project-relative-file file)
"$")))
+ (process-file (ggtags-program-path "global") nil t nil
+ "-vP" (concat "^" (ggtags-project-relative-file file)
"$")))
(goto-char (point-min))
(not (re-search-forward "^file not found" nil t)))))
@@ -632,28 +633,28 @@ source trees. See Info node `(global)gtags' for details."
(expand-file-name
(directory-file-name (file-name-as-directory
root)))))
(ggtags-with-current-project
- (let ((conf (and ggtags-use-project-gtagsconf
- (cl-loop for name in '(".globalrc" "gtags.conf")
- for full = (expand-file-name name root)
- thereis (and (file-exists-p full) full)))))
- (unless (or conf (getenv "GTAGSLABEL")
- (not (yes-or-no-p "Use `ctags' backend? ")))
- (setenv "GTAGSLABEL" "ctags"))
- (ggtags-with-temp-message "`gtags' in progress..."
- (let ((default-directory (file-name-as-directory root))
- (args (cl-remove-if #'null
- (list (and ggtags-use-idutils "--idutils")
- (and conf "--gtagsconf")
- (and conf (ggtags-ensure-localname
conf))))))
- (condition-case err
- (apply #'ggtags-process-string "gtags" args)
- (error (if (and ggtags-use-idutils
- (stringp (cadr err))
- (string-match-p "mkid not found" (cadr err)))
- ;; Retry without mkid
- (apply #'ggtags-process-string
- "gtags" (cl-remove "--idutils" args))
- (signal (car err) (cdr err)))))))))
+ (let ((conf (and ggtags-use-project-gtagsconf
+ (cl-loop for name in '(".globalrc" "gtags.conf")
+ for full = (expand-file-name name root)
+ thereis (and (file-exists-p full) full)))))
+ (unless (or conf (getenv "GTAGSLABEL")
+ (not (yes-or-no-p "Use `ctags' backend? ")))
+ (setenv "GTAGSLABEL" "ctags"))
+ (ggtags-with-temp-message "`gtags' in progress..."
+ (let ((default-directory (file-name-as-directory root))
+ (args (cl-remove-if #'null
+ (list (and ggtags-use-idutils "--idutils")
+ (and conf "--gtagsconf")
+ (and conf (ggtags-ensure-localname
conf))))))
+ (condition-case err
+ (apply #'ggtags-process-string "gtags" args)
+ (error (if (and ggtags-use-idutils
+ (stringp (cadr err))
+ (string-match-p "mkid not found" (cadr err)))
+ ;; Retry without mkid
+ (apply #'ggtags-process-string
+ "gtags" (cl-remove "--idutils" args))
+ (signal (car err) (cdr err)))))))))
(message "GTAGS generated in `%s'" root)
root))
@@ -669,16 +670,16 @@ Do nothing if GTAGS exceeds the oversize limit unless
FORCE."
(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))))))
+ (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))))))
(defun ggtags-update-tags-single (file &optional nowait)
(cl-check-type file string)
(ggtags-with-current-project
- (process-file (ggtags-program-path "global") nil (and nowait 0) nil
- "--single-update" (ggtags-project-relative-file file))))
+ (process-file (ggtags-program-path "global") nil (and nowait 0) nil
+ "--single-update" (ggtags-project-relative-file file))))
(defun ggtags-delete-tags ()
"Delete file GTAGS, GRTAGS, GPATH, ID etc. generated by gtags."
@@ -724,13 +725,13 @@ Do nothing if GTAGS exceeds the oversize limit unless
FORCE."
;; May throw global: only name char is allowed
;; with -c option.
(ggtags-with-current-project
- (split-string
- (apply #'ggtags-process-string
- "global"
- (append (and completion-ignore-case
'("--ignore-case"))
- ;; Note -c alone returns only
definitions
- (list (concat "-c"
ggtags-completion-flag) prefix)))
- "\n" t)))))))
+ (split-string
+ (apply #'ggtags-process-string
+ "global"
+ (append (and completion-ignore-case
'("--ignore-case"))
+ ;; Note -c alone returns only
definitions
+ (list (concat "-c"
ggtags-completion-flag) prefix)))
+ "\n" t)))))))
(cdr ggtags-completion-cache))))
(defun ggtags-completion-at-point ()
@@ -813,10 +814,10 @@ Do nothing if GTAGS exceeds the oversize limit unless
FORCE."
(ggtags-navigation-mode +1)
(ggtags-update-tags)
(ggtags-with-current-project
- (with-current-buffer (with-display-buffer-no-window
- (compilation-start command 'ggtags-global-mode))
- (setq-local ggtags-process-environment env)
- (setq ggtags-global-last-buffer (current-buffer))))))
+ (with-current-buffer (with-display-buffer-no-window
+ (compilation-start command 'ggtags-global-mode))
+ (setq-local ggtags-process-environment env)
+ (setq ggtags-global-last-buffer (current-buffer))))))
(defun ggtags-find-tag-continue ()
(interactive)
@@ -881,16 +882,16 @@ definition tags."
(pcase (ggtags-get-libpath)
((and libs (guard libs))
(cl-labels ((cont (buf how)
- (pcase ggtags-global-exit-info
- (`(0 0 ,_)
- (with-temp-buffer
- (setq default-directory
- (file-name-as-directory (pop libs)))
- (and libs (setq ggtags-global-continuation #'cont))
- (if (ggtags-find-project)
- (ggtags-find-tag type (shell-quote-argument
name))
- (cont buf how))))
- (_ (ggtags-global-handle-exit buf how)))))
+ (pcase ggtags-global-exit-info
+ (`(0 0 ,_)
+ (with-temp-buffer
+ (setq default-directory
+ (file-name-as-directory (pop libs)))
+ (and libs (setq ggtags-global-continuation #'cont))
+ (if (ggtags-find-project)
+ (ggtags-find-tag type (shell-quote-argument name))
+ (cont buf how))))
+ (_ (ggtags-global-handle-exit buf how)))))
(setq ggtags-global-continuation #'cont)))))
(defun ggtags-find-reference (name)
@@ -1014,26 +1015,26 @@ Global and Emacs."
(defvar ggtags-global-rerun-search-map
(cl-labels
((save ()
- (setq ggtags-global-rerun-search-last
- (ewoc-data (ewoc-locate ggtags-global-search-ewoc))))
+ (setq ggtags-global-rerun-search-last
+ (ewoc-data (ewoc-locate ggtags-global-search-ewoc))))
(next (arg)
- (interactive "p")
- (ewoc-goto-next ggtags-global-search-ewoc arg)
- (save))
+ (interactive "p")
+ (ewoc-goto-next ggtags-global-search-ewoc arg)
+ (save))
(prev (arg)
- (interactive "p")
- (ewoc-goto-prev ggtags-global-search-ewoc arg)
- (save))
+ (interactive "p")
+ (ewoc-goto-prev ggtags-global-search-ewoc arg)
+ (save))
(quit ()
- (interactive)
- (quit-windows-on (ewoc-buffer ggtags-global-search-ewoc) t))
+ (interactive)
+ (quit-windows-on (ewoc-buffer ggtags-global-search-ewoc) t))
(done ()
- (interactive)
- (let ((node (ewoc-locate ggtags-global-search-ewoc)))
- (when node
- (save)
- (quit)
- (ggtags-global-rerun-search-1 (cdr (ewoc-data node)))))))
+ (interactive)
+ (let ((node (ewoc-locate ggtags-global-search-ewoc)))
+ (when node
+ (save)
+ (quit)
+ (ggtags-global-rerun-search-1 (cdr (ewoc-data node)))))))
(let ((m (make-sparse-keymap)))
(set-keymap-parent m special-mode-map)
(define-key m "p" #'prev)
@@ -1062,15 +1063,16 @@ Global and Emacs."
(setq-local ggtags-enable-navigation-keys nil)
(setq-local bookmark-make-record-function #'ggtags-make-bookmark-record)
(setq truncate-lines t)
- (cl-labels ((prop (s) (propertize s 'face 'minibuffer-prompt))
+ (cl-labels ((prop (s)
+ (propertize s 'face 'minibuffer-prompt))
(pp (data)
- (pcase data
- (`(,_id ,cmd ,dir ,_env ,line ,text)
- (insert (prop " cmd: ") cmd "\n"
- (prop " dir: ") dir "\n"
- (prop "line: ") (number-to-string line) "\n"
- (prop "text: ") text "\n"
- (propertize (make-string 32 ?-) 'face
'shadow))))))
+ (pcase data
+ (`(,_id ,cmd ,dir ,_env ,line ,text)
+ (insert (prop " cmd: ") cmd "\n"
+ (prop " dir: ") dir "\n"
+ (prop "line: ") (number-to-string line) "\n"
+ (prop "text: ") text "\n"
+ (propertize (make-string 32 ?-) 'face
'shadow))))))
(setq ggtags-global-search-ewoc
(ewoc-create #'pp "Global search history keys: n:next p:prev
r:register RET:choose\n")))
(dolist (data ggtags-global-search-history)
@@ -1087,10 +1089,10 @@ Global and Emacs."
Use \\[jump-to-register] to restore the search session."
(interactive (list (register-read-with-preview "Save search to register: ")))
(cl-labels ((prn (data)
- (pcase data
- (`(,command ,root ,_env ,line ,_)
- (princ (format "a ggtags search session `%s' in
directory `%s' at line %d."
- command root line))))))
+ (pcase data
+ (`(,command ,root ,_env ,line ,_)
+ (princ (format "a ggtags search session `%s' in directory
`%s' at line %d."
+ command root line))))))
(set-register r (registerv-make
(if ggtags-global-search-ewoc
(cdr (ewoc-data (ewoc-locate
ggtags-global-search-ewoc)))
@@ -1784,11 +1786,11 @@ When finished invoke CALLBACK in BUFFER with process
exit status."
(with-current-buffer current
(funcall print-fn (funcall get-fn defs)))))))
(ggtags-with-current-project
- (ggtags-global-output
- buffer
- (list (ggtags-program-path "global")
- "--result=grep" "--path-style=absolute" name)
- show 100))))
+ (ggtags-global-output
+ buffer
+ (list (ggtags-program-path "global")
+ "--result=grep" "--path-style=absolute" name)
+ show 100))))
(defvar ggtags-mode-prefix-map
(let ((m (make-sparse-keymap)))
@@ -2025,10 +2027,10 @@ to nil disables displaying this information.")
"A function suitable for `imenu-create-index-function'."
(let ((file (and buffer-file-name (file-relative-name buffer-file-name))))
(and file (with-temp-buffer
- (when (with-demoted-errors
+ (when (with-demoted-errors "ggtags-build-imenu-index: %S"
(zerop (ggtags-with-current-project
- (process-file (ggtags-program-path "global")
- nil t nil "-x" "-f" file))))
+ (process-file (ggtags-program-path "global")
+ nil t nil "-x" "-f" file))))
(goto-char (point-min))
(cl-loop while (re-search-forward
"^\\([^ \t]+\\)[ \t]+\\([0-9]+\\)" nil t)
- [elpa] branch master updated (f53bd6e -> 2d2431c), Leo Liu, 2014/05/06
- [elpa] 03/07: For #34 and #48: Always update tags for current file on save, Leo Liu, 2014/05/06
- [elpa] 02/07: Remove redundant function ggtags-navigation-first-error, Leo Liu, 2014/05/06
- [elpa] 01/07: Fix #48: Enhance ggtags-find-tag-dwim to handle new files, Leo Liu, 2014/05/06
- [elpa] 04/07: Fix #52: Search references and symbols in GTAGSLIBPATH, Leo Liu, 2014/05/06
- [elpa] 06/07: For #52: new var ggtags-global-search-libpath-for-reference, Leo Liu, 2014/05/06
- [elpa] 07/07: Merge branch 'master' of github.com:leoliu/ggtags, Leo Liu, 2014/05/06
- [elpa] 05/07: Doc and indentation fix,
Leo Liu <=