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

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

Re: `other-window-prefix' command, running anything in the other window


From: Emanuel Berg
Subject: Re: `other-window-prefix' command, running anything in the other window
Date: Mon, 22 Jan 2024 09:29:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Psionic K wrote:

> One of my TODO's is to compress all of the `*-other-window`
> commands into a prefix command that will make `find-file` do
> what `find-file-other-window` does for example.

One of my favorite commands look like this, I have it bound to
M-o globally.

(defun other-window-or-split ()
  (interactive)
  (when (one-window-p)
    (split-window-below) )
  (other-window 1) )

Maybe it will be spared from your compression since it is in
fact a `other-window-*' command, not a `*-other-window' one?

https://dataswamp.org/~incal/emacs-init/window-incal.el

Some more fun code:

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

(defun apply-in-other-window (fn &rest args)
  (with-other-window
    (apply fn args) ))

https://dataswamp.org/~incal/emacs-init/window-other.el

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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