* add-variable-watcher usage in lisp/frame.el
@ 2018-06-01 9:18 Robert Pluim
2018-06-01 9:55 ` Noam Postavsky
0 siblings, 1 reply; 3+ messages in thread
From: Robert Pluim @ 2018-06-01 9:18 UTC (permalink / raw)
To: emacs-devel
lisp/frame.el has:
(mapc (lambda (var)
(add-variable-watcher var (symbol-function 'set-buffer-redisplay)))
which causes (describe-variable 'truncate-lines) to produce output like
Automatically becomes permanently buffer-local when set.
Calls these functions when changed: (#<subr set-buffer-redisplay>)
Note the "#<subr... there.
Not using symbol-function makes this output (set-buffer-redisplay)
instead, which I think looks better, Iʼm wondering why symbol-function
was used?
Thanks
Robert
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: add-variable-watcher usage in lisp/frame.el
2018-06-01 9:18 add-variable-watcher usage in lisp/frame.el Robert Pluim
@ 2018-06-01 9:55 ` Noam Postavsky
2018-06-01 10:31 ` Robert Pluim
0 siblings, 1 reply; 3+ messages in thread
From: Noam Postavsky @ 2018-06-01 9:55 UTC (permalink / raw)
To: Emacs developers
On 1 June 2018 at 05:18, Robert Pluim <rpluim@gmail.com> wrote:
> lisp/frame.el has:
>
> (mapc (lambda (var)
> (add-variable-watcher var (symbol-function 'set-buffer-redisplay)))
> Not using symbol-function makes this output (set-buffer-redisplay)
> instead, which I think looks better, Iʼm wondering why symbol-function
> was used?
Passing a subr object tells the variable watcher mechanism to call the
C function directly (without a possible GC call), which is closer to
what happened in Emacs 25 (see diff of [1: d3faef9bae]). I don't know
that it's really needed in this case though.
[1: d3faef9bae]: 2016-12-02 20:25:15 -0500
Ensure redisplay using variable watcher
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=d3faef9baedadc9eaec46814ba9bbe5168048328
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: add-variable-watcher usage in lisp/frame.el
2018-06-01 9:55 ` Noam Postavsky
@ 2018-06-01 10:31 ` Robert Pluim
0 siblings, 0 replies; 3+ messages in thread
From: Robert Pluim @ 2018-06-01 10:31 UTC (permalink / raw)
To: Noam Postavsky; +Cc: Emacs developers
Noam Postavsky <npostavs@gmail.com> writes:
> On 1 June 2018 at 05:18, Robert Pluim <rpluim@gmail.com> wrote:
>> lisp/frame.el has:
>>
>> (mapc (lambda (var)
>> (add-variable-watcher var (symbol-function 'set-buffer-redisplay)))
>
>> Not using symbol-function makes this output (set-buffer-redisplay)
>> instead, which I think looks better, Iʼm wondering why symbol-function
>> was used?
>
> Passing a subr object tells the variable watcher mechanism to call the
> C function directly (without a possible GC call), which is closer to
> what happened in Emacs 25 (see diff of [1: d3faef9bae]). I don't know
> that it's really needed in this case though.
Thanks for the explanation. By all means lets avoid adding potential GC to code
thatʼs not expecting it.
Robert
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-01 10:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-01 9:18 add-variable-watcher usage in lisp/frame.el Robert Pluim
2018-06-01 9:55 ` Noam Postavsky
2018-06-01 10:31 ` Robert Pluim
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.