el/dot-emacs.el: Wrap `trap' defintiion in `eval-and-compile'.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 25 Mar 2023 12:00:43 +0000 (12:00 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 25 Mar 2023 12:00:43 +0000 (12:00 +0000)
Otherwise it's not available at top-level in older Emacsen, for some
reason.

el/dot-emacs.el

index fc219b2..3bed078 100644 (file)
@@ -87,15 +87,16 @@ This may be at the expense of cool features.")
 ;; If individual bits of this file go tits-up, we don't particularly want
 ;; the whole lot to stop right there and then, because it's bloody annoying.
 
-(defmacro trap (&rest forms)
-  "Execute FORMS without allowing errors to propagate outside."
-  (declare (indent 0)
-          (debug t))
-  `(condition-case err
-       ,(if (cdr forms) (cons 'progn forms) (car forms))
-     (error (message "Error (trapped): %s in %s"
-                    (error-message-string err)
-                    ',forms))))
+(eval-and-compile
+  (defmacro trap (&rest forms)
+    "Execute FORMS without allowing errors to propagate outside."
+    (declare (indent 0)
+            (debug t))
+    `(condition-case err
+        ,(if (cdr forms) (cons 'progn forms) (car forms))
+       (error (message "Error (trapped): %s in %s"
+                      (error-message-string err)
+                      ',forms)))))
 
 ;; Configuration reading.