emacs-devel
[Top][All Lists]
Advanced

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

Re: Multiple next-error sources


From: Daniel Colascione
Subject: Re: Multiple next-error sources
Date: Fri, 07 Nov 2014 16:08:39 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0

On 11/07/2014 03:55 PM, Stefan Monnier wrote:
>> I strongly dislike this approach.  It conflates customization points with
>> implementation details.  Hook variables clearly separate the two ideas.
> 
> foo-function *is* a customization point and not an implementation detail.
> 
> That's the difference between using add-function on a foo-function (a
> customization point) and using advice-add on some function (some
> implementation detail).

Even the name is unintuitive. Realizing that you can add your own
function to something called "foo-function" (singular) requires a
special kind of comprehension of function composition. "So you're
telling me that I add a function to a function and get a function?"

The many add-function composition modes are useful for advice, but
counterproductive for customization points: the great variety of options
makes it hard to reason about the effect any particular effect. With a
hook, you have a simple list of functions, possibly with a sentinel that
delegates to a global value.

I don't see any compelling reason to avoid conventional hooks. They've
worked for many years. Requiring add-function for some customization and
add-hook for others will only confuse users. It doesn't add any real
power and doesn't make Emacs any better AFAICT.

>> There's also no buffer-local add-function equivalent.
> 
> Of course there is:
> 
>    (add-function :before-until (local 'next-error-function) #'my-function)

Okay, that actually works, including in some corner cases I tested
involving before- and after-functions in both the buffer-local and
global values. My other points still apply.

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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