unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Basil L. Contovounesios" <contovob@tcd.ie>
To: Alan Mackenzie <acm@muc.de>
Cc: emacs-devel@gnu.org
Subject: Re: Problem with cl-letf in winner.el
Date: Thu, 06 May 2021 18:36:44 +0100	[thread overview]
Message-ID: <87sg2zepcj.fsf@tcd.ie> (raw)
In-Reply-To: <YJQcgxfZ/vHvPunt@ACM> (Alan Mackenzie's message of "Thu, 6 May 2021 16:42:43 +0000")

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



      parent reply	other threads:[~2021-05-06 17:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sg2zepcj.fsf@tcd.ie \
    --to=contovob@tcd.ie \
    --cc=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).