[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: |
Stefan Monnier |
Subject: |
Re: [Emacs-diffs] master b75fb81 1/4: Extend button.el to take callback data |
Date: |
Thu, 01 Aug 2019 16:44:19 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
> (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. In your above case, you could just use
(make-text-button start (point)
'face 'rcirc-url
'follow-link t
'action (lambda () (browse-url url)))
>> Alternatively, action functions can also be closures.
> They can be, in lexical packages.
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.
Stefan