Ar an cúigiú lá de mí na Nollaig, scríobh Stephen J. Turnbull:
Something like (untested)
(defmacro rebox-defun (func args &rest expr-list)
(flet ((fix-interactive (expr)
(if (and (eq (car expr) 'interactive)
(stringp (cadr expr)))
(list 'interactive
(replace-in-string (cadr expr) "\\^" "")
(cddr expr))
expr)))
`(defun ,func ,args ,@(mapcar #'fix-interactive expr-list))))
There are probably more concise/efficient/Common-Lisp-ly-correct ways
to write that.
Sort of relatedly; everyone, don’t use #'flet, use #'labels. It’s far
cheaper at run time in byte-compiled code--no need to unwind-protect, no
need to store and retrieve the old function binding, and it’s equivalent to
#'flet, except that the function binding is lexical, not dynamic, which is
usually what you want anyway. Mutually- and simply-recursive functions are
supported in XEmacs and endorsed by Common Lisp, which is not the case for
#'flet.
--
‘Iodine deficiency was endemic in parts of the UK until, through what has been
described as “an unplanned and accidental public health triumph”, iodine was
added to cattle feed to improve milk production in the 1930s.’
(EN Pearce, Lancet, June 2011)
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta