[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Emacs-diffs] master b75fb81 1/4: Extend button.el to take callback
From: |
Lars Ingebrigtsen |
Subject: |
Re: [Emacs-diffs] master b75fb81 1/4: Extend button.el to take callback data |
Date: |
Fri, 02 Aug 2019 20:41:51 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
>> (make-text-button start (point)
>> 'face 'rcirc-url
>> 'follow-link t
>> 'burron-data url
>> 'action #'browse-url)
>
> Odd. I thought the benefit was for
>
> (define-button-type 'my-type 'action #'browse-url)
>
> [...]
>
> (make-text-button start (point)
> 'type 'my-type
> 'burron-data url)
>
> where a closure is not an option.
Ah, yes, that seems useful.
> In this for the purpose of designing new APIs, we can take it for
> granted that lexical-scoping is available. It's easy enough to convert
> an old package to use lexical-scoping.
In this case, I just wanted to rewrite some stuff to avoid using
widgets, which can be rather convoluted to reason about. But it does
have callback values like this, so this brings button a feature to make
conversion easier.
But, yes, everything should be converted to lexical binding, and then
my example use case is much less of a thing.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no