help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FW: [External] : window-other.el / ref-lines.el


From: Drew Adams
Subject: FW: [External] : window-other.el / ref-lines.el
Date: Wed, 18 Jan 2023 18:09:10 +0000

Forwarding to the list.  Apparently some msgs
I send to Emmanuel and the list don't end up
on the list.

-----Original Message-----
Sent: Tuesday, January 17, 2023 9:05 AM
To: Emanuel Berg <incal@dataswamp.org>; help-gnu-emacs@gnu.org
Subject: RE: [External] : window-other.el / ref-lines.el

> (defun next-window-buffer ()
>   (window-buffer (next-window)) )
> 
> (defmacro with-other-window (&rest body)
>   (declare (indent 1) (debug t))
>   `(let ((buf (next-window-buffer)))
>      (when (bufferp buf)
>        (with-current-buffer buf
>          ,@body) )))

Your macro _name_ is misleading (and so would
be `in-other-window').  You're doing BODY with
the next-window's _buffer current_.  But you're
not _selecting_ the next-window while doing it.
IOW, that window isn't selected when you do BODY.

`with-selected-window' does its BODY with
its WINDOW selected.  You could (if that were
what you wanted) define a `with-other-window'
which did the equivalent for the `next-window':

(defmacro with-other-window (&rest body)
  `(with-selected-window (next-window) ,@body))

<<attachment: winmail.dat>>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]