* `assert' macro
@ 2006-01-27 21:35 Johan Bockgård
2006-01-29 19:17 ` John Paul Wallington
0 siblings, 1 reply; 3+ messages in thread
From: Johan Bockgård @ 2006-01-27 21:35 UTC (permalink / raw)
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.
--
Johan Bockgård
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: `assert' macro
2006-01-27 21:35 `assert' macro Johan Bockgård
@ 2006-01-29 19:17 ` John Paul Wallington
2006-01-30 18:45 ` Richard M. Stallman
0 siblings, 1 reply; 3+ messages in thread
From: John Paul Wallington @ 2006-01-29 19:17 UTC (permalink / raw)
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.")
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-01-30 18:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-27 21:35 `assert' macro Johan Bockgård
2006-01-29 19:17 ` John Paul Wallington
2006-01-30 18:45 ` Richard M. Stallman
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.