[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ELPA-diffs] /srv/bzr/emacs/elpa r345: Do not abuse assert in what it is
From: |
Leo Liu |
Subject: |
[ELPA-diffs] /srv/bzr/emacs/elpa r345: Do not abuse assert in what it is designed for |
Date: |
Fri, 01 Feb 2013 02:00:09 +0800 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 345
committer: Leo Liu <address@hidden>
branch nick: elpa
timestamp: Fri 2013-02-01 02:00:09 +0800
message:
Do not abuse assert in what it is designed for
An `assert' should be used for something that should *never* be false.
modified:
packages/ggtags/ggtags.el
=== modified file 'packages/ggtags/ggtags.el'
--- a/packages/ggtags/ggtags.el 2013-01-31 17:02:57 +0000
+++ b/packages/ggtags/ggtags.el 2013-01-31 18:00:09 +0000
@@ -78,10 +78,10 @@
(defmacro ggtags-ensure-global-buffer (&rest body)
(declare (indent 0))
`(progn
- (assert (and (buffer-live-p compilation-last-buffer)
- (with-current-buffer compilation-last-buffer
- (derived-mode-p 'ggtags-global-mode)))
- nil "No global buffer found")
+ (or (and (buffer-live-p compilation-last-buffer)
+ (with-current-buffer compilation-last-buffer
+ (derived-mode-p 'ggtags-global-mode)))
+ (error "No global buffer found"))
(with-current-buffer compilation-last-buffer ,@body)))
(defun ggtags-cache-timestamp (root)
@@ -124,13 +124,13 @@
(comment-string-strip (buffer-string) t t))))))
(defun ggtags-check-root-directory ()
- (assert (ggtags-root-directory) nil "File GTAGS not found"))
+ (or (ggtags-root-directory) (error "File GTAGS not found")))
(defun ggtags-ensure-root-directory ()
(or (ggtags-root-directory)
(if (yes-or-no-p "File GTAGS not found; run gtags? ")
(let ((root (read-directory-name "Directory: " nil nil t)))
- (assert (not (zerop (length root))) nil "No directory chosen")
+ (and (= (length root) 0) (error "No directory chosen"))
(ggtags-ignore-file-error
(with-temp-buffer
(if (zerop (let ((default-directory
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [ELPA-diffs] /srv/bzr/emacs/elpa r345: Do not abuse assert in what it is designed for,
Leo Liu <=