Marcus Harnisch writes:
Hi all,
as I was trying to get rebox2.el to work, I noticed that a lot of
functions use `^' as code letter when calling #'interactive.
*sigh* I could see that ---- heading for the fan from a mile away.
Patches to 21.5 welcome. I don't know what implementation is
appropriate in XEmacs, though. Some thought about how to make this
forward-compatible to future GNU extensions might be a good idea
though.
You'd have to ask Vin if he thinks this is appropriate for 21.4.
going. I don't think it is possible to advice #'interactive,
though. A
macro doesn't seem to work either.
No. `interactive' is a declaration; the form is never executed.
Rather, the argument to interactive is stored with the function and
interpreted by the Lisp runtime rather than by the main Lisp
interpreter.
Any other clever idea other than advising all interactive functions
in rebox2 with new interactive statements?
It's not clever, but it's probably easier than writing advice or
rewriting the interactive statements: replace all rebox2 defuns with
rebox-defun, a macro which filters the interactive declaration (if
any).
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. The mapcar is used because it's certainly possible for
the interactive declaration to be the 3rd or 4th argument to #'defun,
but I don't know for sure about later (I think it never has any
effect, though). It will only work at top-level in the function for
sure, and when executed interactive simply returns nil, so editing the
form throughout expr-list won't affect what any function defined by
rebox-defun returns.
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta