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: Tim X
Subject: Re: Redefining functions and variables
Date: Wed, 08 Dec 2010 15:21:48 -0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> (defmacro defun (name args &rest body)
>
> Just as is the case for `defun', redefining macros with `defmacro'
> is problematic.  I really recommend not to do that and use defadvice
> instead, which was designed specifically for this purpose.
>
>
>         Stefan

If anyone wants a good example of what can be achieved just using
defadvice, I would strongly recommend looking at emacspeak. 

The emacspeak package transforms emacs into a powerful text-to-speech
system. Most of this is achieved by wrapping standard emacs functions in
defadvice, which in turn sends the relevant bit of text to a
text-to-speech synthesizer. 

Another similar package, which attempts to have minimal impact on how
emacs works is speechd.el. It also uses defadvice. 

I frequently use defadvice to customize how functions work, resolve bugs
while waiting for an update in some package or simply replace one
function with one I have written. It is a very useful and powerful tool. 

Tim

-- 
tcross (at) rapttech dot com dot au


reply via email to

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