From 754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 7 Apr 2024 13:41:34 -0500 Subject: new repository --- devdocs/elisp/wrong-time.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 devdocs/elisp/wrong-time.html (limited to 'devdocs/elisp/wrong-time.html') diff --git a/devdocs/elisp/wrong-time.html b/devdocs/elisp/wrong-time.html new file mode 100644 index 00000000..af78f3a1 --- /dev/null +++ b/devdocs/elisp/wrong-time.html @@ -0,0 +1,14 @@ +

Wrong Time

The most common problem in writing macros is doing some of the real work prematurely—while expanding the macro, rather than in the expansion itself. For instance, one real package had this macro definition:

(defmacro my-set-buffer-multibyte (arg)
+  (if (fboundp 'set-buffer-multibyte)
+      (set-buffer-multibyte arg)))
+
+

With this erroneous macro definition, the program worked fine when interpreted but failed when compiled. This macro definition called set-buffer-multibyte during compilation, which was wrong, and then did nothing when the compiled package was run. The definition that the programmer really wanted was this:

(defmacro my-set-buffer-multibyte (arg)
+  (if (fboundp 'set-buffer-multibyte)
+      `(set-buffer-multibyte ,arg)))
+
+

This macro expands, if appropriate, into a call to set-buffer-multibyte that will be executed when the compiled program is actually run.

+

+ Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc.
Licensed under the GNU GPL license.
+ https://www.gnu.org/software/emacs/manual/html_node/elisp/Wrong-Time.html +

+
-- cgit v1.2.3