erc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Erc-commit] [commit][master] Remove erc-assert and use assert instead.


From: mwolson
Subject: [Erc-commit] [commit][master] Remove erc-assert and use assert instead.
Date: Sun, 20 Jan 2008 22:50:04 -0500

commit 478fb31a4249c4dccf30f7ce6f8b93e356e15dff
Author: Michael W. Olson <address@hidden>
Date:   Sun Jan 20 21:44:59 2008 -0500

    Remove erc-assert and use assert instead.

diff --git a/ChangeLog b/ChangeLog
index 3776213..a47117d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2008-01-21  Michael Olson  <address@hidden>
 
+       * erc-compat.el (erc-const-expr-p, erc-list*, erc-assert): Remove,
+       since we can use the default `assert' function without it causing
+       us any problems, even in Emacs 21.  Thanks to bojohan for the
+       suggestion.
+
        * erc-goodies.el (move-to-prompt): Use the "XEmacs" method
        instead, because the [remap ...] method interferes with
        delete-selection-mode.
diff --git a/erc-compat.el b/erc-compat.el
index 0d31e86..0367a33 100644
--- a/erc-compat.el
+++ b/erc-compat.el
@@ -366,53 +366,6 @@ ERC release version number."
       (make-obsolete-variable old-name new-name when)
     (wrong-number-of-arguments (make-obsolete-variable old-name new-name))))
 
-;; Provde an equivalent of `assert', based on the code from cl-macs.el
-(defun erc-const-expr-p (x)
-  (cond ((consp x)
-        (or (eq (car x) 'quote)
-            (and (memq (car x) '(function function*))
-                 (or (symbolp (nth 1 x))
-                     (and (eq (and (consp (nth 1 x))
-                                   (car (nth 1 x))) 'lambda) 'func)))))
-       ((symbolp x) (and (memq x '(nil t)) t))
-       (t t)))
-
-(put 'erc-assertion-failed 'error-conditions '(error))
-(put 'erc-assertion-failed 'error-message "Assertion failed")
-
-(defun erc-list* (arg &rest rest)
-  "Return a new list with specified args as elements, cons'd to last arg.
-Thus, `(list* A B C D)' is equivalent to `(nconc (list A B C) D)', or to
-`(cons A (cons B (cons C D)))'."
-  (cond ((not rest) arg)
-       ((not (cdr rest)) (cons arg (car rest)))
-       (t (let* ((n (length rest))
-                 (copy (copy-sequence rest))
-                 (last (nthcdr (- n 2) copy)))
-            (setcdr last (car (cdr last)))
-            (cons arg copy)))))
-
-(defmacro erc-assert (form &optional show-args string &rest args)
-  "Verify that FORM returns non-nil; signal an error if not.
-Second arg SHOW-ARGS means to include arguments of FORM in message.
-Other args STRING and ARGS... are arguments to be passed to `error'.
-They are not evaluated unless the assertion fails.  If STRING is
-omitted, a default message listing FORM itself is used."
-  (let ((sargs
-        (and show-args
-             (delq nil (mapcar
-                        (function
-                         (lambda (x)
-                           (and (not (erc-const-expr-p x)) x)))
-                        (cdr form))))))
-    (list 'progn
-         (list 'or form
-               (if string
-                   (erc-list* 'error string (append sargs args))
-                 (list 'signal '(quote erc-assertion-failed)
-                       (erc-list* 'list (list 'quote form) sargs))))
-         nil)))
-
 ;; Provide a simpler replacement for `member-if'
 (defun erc-member-if (predicate list)
   "Find the first item satisfying PREDICATE in LIST.
diff --git a/erc-track.el b/erc-track.el
index eade396..b486709 100644
--- a/erc-track.el
+++ b/erc-track.el
@@ -445,7 +445,7 @@ START is the minimum length of the name used."
 
 ;;; Test:
 
-(erc-assert
+(assert
  (and
   ;; verify examples from the doc strings
   (equal (let ((erc-track-shorten-aggressively nil))
@@ -917,7 +917,7 @@ is in `erc-mode'."
        (add-to-list 'faces cur)))
     faces))
 
-(erc-assert
+(assert
  (let ((str "is bold"))
    (put-text-property 3 (length str)
                      'face '(bold erc-current-nick-face)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]