[Top][All Lists]

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

Re: replacing a function with another one

From: Michael Heerdegen
Subject: Re: replacing a function with another one
Date: Wed, 12 Mar 2014 00:21:49 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

lee <address@hidden> writes:

> Maybe the problem is that add-advice is too complicated and convoluted.
> I learned about defadvice in like no time, it´s clear and simple ---
> while advice-add is anything but.

On the contrary.  nadvice is as simple as it could be.  To understand
how an :around advice works, it takes one line

  (lambda (&rest r) (apply FUNCTION OLDFUN r))

That's a non-ambiguous specification from which you can clearly derive
how the advice FUNCTION will be used.  It can't be simpler.  The problem
is that many people are not so used to lambda expressions and parameter
substitution and so they don't understand it.  If you take a pencil and
a sheet of paper and evaluate an example for yourself by hand, step by
step, you'll understand how it works.  And no, this is not missing in
the documentation.  The Emacs documentation is not an introduction into
lambda calculus and writing LISP code.  Once you have really understood
how evaluation of expressions in LISP works, you'll understand the above

> Considering all that, wouldn´t it be much better to create my own
> mode?

I don't think this is appropriate, because what you want can be done in
few lines without making much assumptions about the original package.


reply via email to

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