From: jpw@gnu.org (John Paul Wallington)
Subject: Re: `assert' macro
Date: Sun, 29 Jan 2006 19:17:00 +0000 [thread overview]
Message-ID: <87r76q6dzn.fsf@thunk.shootybangbang.com> (raw)
In-Reply-To: <yoij3bj9jqwj.fsf@linus003.dd.chalmers.se> (Johan Bockgård's message of "Fri, 27 Jan 2006 22:35:08 +0100")
bojohan+news@dd.chalmers.se (Johan Bockgård) writes:
> The `assert' macro from cl-macs is used in several files in Emacs. It
> expands into the following code.
>
> (macroexpand '(assert x))
> =>
> (progn (or x (signal 'cl-assertion-failed (list 'x))) nil)
>
> Unless cl is loaded `cl-assertion-failed' is not a known error symbol
> though, so if the assertion fails it will produce a "peculiar error"
> that is impossible to catch. It should signal a known condition.
A minimal impact fix is to move the definition of that condition from
cl.el to subr.el. Any objections ?
Index: lisp/subr.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/subr.el,v
retrieving revision 1.494
diff -u -r1.494 subr.el
--- lisp/subr.el 26 Jan 2006 17:54:27 -0000 1.494
+++ lisp/subr.el 29 Jan 2006 19:09:26 -0000
@@ -1831,6 +1831,12 @@
This variable is meaningful on MS-DOG and Windows NT.
On those systems, it is automatically local in every buffer.
On other systems, this variable is normally always nil.")
+
+;; The `assert' macro from the cl package signals
+;; `cl-assertion-failed' at runtime so always define it.
+(put 'cl-assertion-failed 'error-conditions '(error))
+(put 'cl-assertion-failed 'error-message "Assertion failed")
+
\f
;;;; Misc. useful functions.
Index: lisp/emacs-lisp/cl.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/emacs-lisp/cl.el,v
retrieving revision 1.46
diff -u -r1.46 cl.el
--- lisp/emacs-lisp/cl.el 6 Aug 2005 17:08:59 -0000 1.46
+++ lisp/emacs-lisp/cl.el 29 Jan 2006 19:09:27 -0000
@@ -580,9 +580,6 @@
;;; Miscellaneous.
-(put 'cl-assertion-failed 'error-conditions '(error))
-(put 'cl-assertion-failed 'error-message "Assertion failed")
-
(defvar cl-fake-autoloads nil
"Non-nil means don't make CL functions autoload.")
next prev parent reply other threads:[~2006-01-29 19:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-27 21:35 `assert' macro Johan Bockgård
2006-01-29 19:17 ` John Paul Wallington [this message]
2006-01-30 18:45 ` Richard M. Stallman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87r76q6dzn.fsf@thunk.shootybangbang.com \
--to=jpw@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.