* Problem with cl-letf in winner.el
@ 2021-05-06 16:42 Alan Mackenzie
2021-05-06 17:35 ` Stefan Monnier
2021-05-06 17:36 ` Basil L. Contovounesios
0 siblings, 2 replies; 3+ messages in thread
From: Alan Mackenzie @ 2021-05-06 16:42 UTC (permalink / raw)
To: emacs-devel
Hello, Emacs.
In Emacs master branch:
In connection with bug #48249, I'm looking at winner.el. In function
winner-set-conf, there is the following macro call:
(cl-letf (((window-buffer miniwin))
((window-point miniwin)))
(set-window-configuration winconf))
.. I'm having trouble understanding it. When I expand and pretty print
it, I get this:
(let*
((v miniwin)
(v miniwin)
(old
(window-point v))
(old
(window-buffer v)))
(unwind-protect
(set-window-configuration winconf)
(set-window-point v old)
(let*
((v old))
(progn
(set-window-buffer v v)
v))))
This looks very strange indeed: under the let* there are two variables
called v and two variables called old. This looks like a bug to me, but
alternatively, is there something I'm not understanding here? (Just to
be specific, I expanded the macro with lexical-binding both nil and t,
and got the same results.)
Help, please!
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problem with cl-letf in winner.el
2021-05-06 16:42 Problem with cl-letf in winner.el Alan Mackenzie
@ 2021-05-06 17:35 ` Stefan Monnier
2021-05-06 17:36 ` Basil L. Contovounesios
1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2021-05-06 17:35 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
> This looks very strange indeed: under the let* there are two variables
> called v and two variables called old.
Try against with `print-gensym` and `print-circle` set to
a non-nil value: they're uninterned identifiers.
Stefan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Problem with cl-letf in winner.el
2021-05-06 16:42 Problem with cl-letf in winner.el Alan Mackenzie
2021-05-06 17:35 ` Stefan Monnier
@ 2021-05-06 17:36 ` Basil L. Contovounesios
1 sibling, 0 replies; 3+ messages in thread
From: Basil L. Contovounesios @ 2021-05-06 17:36 UTC (permalink / raw)
To: Alan Mackenzie; +Cc: emacs-devel
Alan Mackenzie <acm@muc.de> writes:
> In connection with bug #48249, I'm looking at winner.el. In function
> winner-set-conf, there is the following macro call:
>
> (cl-letf (((window-buffer miniwin))
> ((window-point miniwin)))
> (set-window-configuration winconf))
>
> .. I'm having trouble understanding it. When I expand and pretty print
> it, I get this:
>
> (let*
> ((v miniwin)
> (v miniwin)
> (old
> (window-point v))
> (old
> (window-buffer v)))
> (unwind-protect
> (set-window-configuration winconf)
> (set-window-point v old)
> (let*
> ((v old))
> (progn
> (set-window-buffer v v)
> v))))
>
> This looks very strange indeed: under the let* there are two variables
> called v and two variables called old. This looks like a bug to me, but
> alternatively, is there something I'm not understanding here? (Just to
> be specific, I expanded the macro with lexical-binding both nil and t,
> and got the same results.)
>
> Help, please!
Enabling print-gensym and print-circle should make it clearer that the
seemingly duplicate vars are actually different uninterned symbols.
So my reading of that macro call is that it restores miniwin's buffer
and point after changing window configuration.
HTH,
--
Basil
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-05-06 17:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-06 16:42 Problem with cl-letf in winner.el Alan Mackenzie
2021-05-06 17:35 ` Stefan Monnier
2021-05-06 17:36 ` Basil L. Contovounesios
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.