help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Redefining functions and variables


From: Andreas Politz
Subject: Re: Redefining functions and variables
Date: Wed, 08 Dec 2010 15:21:34 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Elena <egarrulo@gmail.com> writes:

> On Jul 28, 7:51 am, Elena <egarr...@gmail.com> wrote:
>> > Of course this leads to an endless recursive loop, expanding your macro
>> > again and again ...
>>
>> Then I should have tested the macro with `macroexpand-all' instead of
>> `macroexpand'. However, I've tried using the macro, and it seemed to
>> work, albeit it choked on the unquoted symbol passed to `fboundp'.
>
> I think it seemed to work because the macro was interpreted, therefore
> it was expanded only once before the failure.

Don't know, but defining `defun' as a macro usually deletes the original
subst (which is a special form, which is kind of like a macro).

(defvar defun-subst (symbol-function 'defun))

(defmacro defun (name args &rest body)
  `(defun ,name ,args ,@body))

(defun foo ())
;; Enters the debugger because of recursion limit reached.

;; Restore original defun
(fset 'defun defun-subst)

-ap


reply via email to

[Prev in Thread] Current Thread [Next in Thread]