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

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

Re: replacing a function with another one


From: lee
Subject: Re: replacing a function with another one
Date: Wed, 12 Mar 2014 18:33:28 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

Michael Heerdegen <address@hidden> writes:

> 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
> definition.

Why would you say it´s a definition?

When you consider "food is edible" as a definition, it doesn´t tell you
anything.

The function is defined in the source.  The documentation of it should
tell you what it does and how to make it do that.  Besides that the
documentation of advice-add doesn´t do that, advice-add is complicated,
convoluted and cryptic.

>> 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.

Then what´s the purpose of modes, or the concept behind them?  As it is
now, I can enable a mode, like hi-lock-mode, no matter what kind of file
I´m editing.  The mode provides me with some particular functionality
which I can use.  It doesn´t matter to me how many lines of code it took
to create this mode.

Now I have some particular functionality I may want to use with many
different kinds of files.  So why not just enable a mode that gives me
this functionality?

What does it matter how the mode provides the functionality and how many
lines of code it´s made of?


-- 
Knowledge is volatile and fluid.  Software is power.



reply via email to

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