[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 26/38: New macro ignore-errors-unless-debug and use it
From: |
Leo Liu |
Subject: |
[elpa] 26/38: New macro ignore-errors-unless-debug and use it |
Date: |
Mon, 24 Mar 2014 09:31:37 +0000 |
leoliu pushed a commit to branch master
in repository elpa.
commit 030251c21c0f0c76d0898bc83ae5d32ee17197ba
Author: Leo Liu <address@hidden>
Date: Thu Mar 20 11:03:03 2014 +0800
New macro ignore-errors-unless-debug and use it
---
ggtags.el | 39 ++++++++++++++++++++++-----------------
1 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/ggtags.el b/ggtags.el
index b3def18..1b1dc84 100644
--- a/ggtags.el
+++ b/ggtags.el
@@ -71,7 +71,12 @@
(defmacro defvar-local (var val &optional docstring)
(declare (debug defvar) (doc-string 3))
(list 'progn (list 'defvar var val docstring)
- (list 'make-variable-buffer-local (list 'quote var))))))
+ (list 'make-variable-buffer-local (list 'quote var)))))
+
+ (defmacro ignore-errors-unless-debug (&rest body)
+ "Ignore all errors while executing BODY unless debug is on."
+ (declare (debug t) (indent 0))
+ `(condition-case-unless-debug nil (progn ,@body) (error nil))))
(eval-and-compile
(or (fboundp 'user-error) ;24.3
@@ -400,10 +405,11 @@ Value is new modtime if updated."
(ggtags-find-project))
project)
(setq ggtags-project-root
- (or (ignore-errors (file-name-as-directory
- (concat (file-remote-p default-directory)
- ;; Resolves symbolic links
- (ggtags-process-string "global"
"-pr"))))
+ (or (ignore-errors-unless-debug
+ (file-name-as-directory
+ (concat (file-remote-p default-directory)
+ ;; Resolves symbolic links
+ (ggtags-process-string "global" "-pr"))))
;; 'global -pr' resolves symlinks before checking the
;; GTAGS file which could cause issues such as
;; https://github.com/leoliu/ggtags/issues/22, so
@@ -592,18 +598,17 @@ non-nil."
(unless (equal cache-key (car ggtags-completion-cache))
(setq ggtags-completion-cache
(cons cache-key
- (condition-case-unless-debug nil
- ;; 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))
- (error nil))))))
+ (ignore-errors-unless-debug
+ ;; 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)))))))
(cdr ggtags-completion-cache))))
(defun ggtags-completion-at-point ()
- [elpa] 22/38: New command ggtags-navigation-isearch-forward, (continued)
- [elpa] 22/38: New command ggtags-navigation-isearch-forward, Leo Liu, 2014/03/24
- [elpa] 17/38: Fix ggtags-with-current-project to include GTAGSCONF, Leo Liu, 2014/03/24
- [elpa] 19/38: Use read-only-mode in ggtags-toggle-project-read-only, Leo Liu, 2014/03/24
- [elpa] 18/38: Fix #36: Allow customising path to global's exectuables, Leo Liu, 2014/03/24
- [elpa] 20/38: Teach ggtags-find-tag-dwim to detect #include files, Leo Liu, 2014/03/24
- [elpa] 25/38: Fix ggtags-find-project to check on the GTAGS file, Leo Liu, 2014/03/24
- [elpa] 23/38: Simplify ggtags-save-to-register by always re-do the search, Leo Liu, 2014/03/24
- [elpa] 21/38: Add new command ggtags-save-to-register for #37, Leo Liu, 2014/03/24
- [elpa] 16/38: Fix ggtags-show-definition to run in current project, Leo Liu, 2014/03/24
- [elpa] 24/38: Fix thinko in "Don't display buffer if ggtags-navigation-mode is exited", Leo Liu, 2014/03/24
- [elpa] 26/38: New macro ignore-errors-unless-debug and use it,
Leo Liu <=
- [elpa] 15/38: Small fixes to last change, Leo Liu, 2014/03/24
- [elpa] 32/38: Bind ggtags-save-to-register in ggtags-global-rerun-search-map, Leo Liu, 2014/03/24
- [elpa] 28/38: New helper ggtags-forward-to-line and use it, Leo Liu, 2014/03/24
- [elpa] 27/38: Cosmetic change: Fix indentation, Leo Liu, 2014/03/24
- [elpa] 29/38: New feature ggtags-global-restore-search for #37, Leo Liu, 2014/03/24
- [elpa] 33/38: Disable ggtags-navigation-mode in ggtags-global-rerun-search, Leo Liu, 2014/03/24
- [elpa] 31/38: Also record ggtags-process-environment in search history, Leo Liu, 2014/03/24
- [elpa] 30/38: Polish last change, Leo Liu, 2014/03/24
- [elpa] 34/38: Support search bookmarks as requested in #39, Leo Liu, 2014/03/24
- [elpa] 38/38: Merge branch 'master' of github.com:leoliu/ggtags, Leo Liu, 2014/03/24