[Top][All Lists]

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

Re: call function in other window ?

From: Emanuel Berg
Subject: Re: call function in other window ?
Date: Sun, 21 May 2017 03:58:25 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Drew Adams wrote:

> I don't know whether others will find such
> a function useful. I haven't needed it.

Look, I used it! Previously I had
`other-window' in both kill functions.
This is neater.

    (defun apply-in-other-window (fn &rest args)
      (let*((window (next-window))
            (buffer (and window (window-buffer window)) ))
        (when buffer
          (with-current-buffer buffer
            (apply fn args) ))))

    (defun kill-path-other-window ()
      (apply-in-other-window #'kill-path) )

    (defun kill-name-other-window ()
      (apply-in-other-window #'kill-name) )

> I imagine that most people who are going to
> write Lisp code to act on a buffer will know
> to use `with-current-buffer', and to get to
> the buffer of another window they will use
> `window-buffer'. Those are commonly used.

Well, what should determine if something should
be included or not is its usefulness. As for
the difficulty implementing this particular
function, I'd put it somewhere in the
mid range. But again, that shouldn't influence.

underground experts united

reply via email to

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