Questions tagged [selected-window]
17 questions
5
votes
1 answer
How do I focus the Man mode window when it is displayed?
When I open a man page (e.g. M-x man cat) I would like to automatically move my cursor onto the man page. I already know how to achieve this behavior for *Help* and *Apropos*, and I want to get the same behavior for Man mode too. I have tried…

Flux
- 583
- 2
- 16
4
votes
1 answer
How to get a window in a corner of the frame
Is there a built-in function to return a window in a particular corner of a frame (e.g., lower-left, upper-left, upper-right, lower-right).
The following is a first draft to locate the lower-left corner, which returns a list (for debugging purposes)…

lawlist
- 18,826
- 5
- 37
- 118
4
votes
5 answers
How to close help buffer without moving to it?
I often use Emacs' help buffers, via e.g. C-h k.
Buffer *Help* is displayed in another window, and that window is not selected. In order to close the *Help* buffer, I need to switch windows via C-x o and then press q to close the *Help* buffer.
The…

Parker
- 43
- 3
4
votes
1 answer
Stop ERT results frame from stealing focus
I've set up ert test results to display in a separate frame, if one exists, and in a bottom side-window otherwise:
(add-to-list 'display-buffer-alist
'("\\`\\*ert\\*\\'"
(display-buffer-reuse-window
…

ivan
- 1,928
- 10
- 20
3
votes
1 answer
How to be notified when a buffer/window becomes selected - no hook available?
I'm trying to run a piece of code when a buffer/window becomes selected. For an example use case, suppose I'm editing a buffer, save it, and kill it.
Suppose also the buffer "below" (that appears and becomes selected after my kill operation) has a…

Kevin
- 1,308
- 8
- 20
2
votes
1 answer
Save excursion not working for dired-find-file-other-window
I wrote this function to basically bring my cursor back to the dired buffer, after opening the file in another window. This is so that I can scroll down the buffer, pressing o to keep previewing the files in the directory. However, after the…

Tian
- 288
- 1
- 8
2
votes
1 answer
How to switch windows to specific visible buffer?
Is there a command that allows me to have my cursor switch windows to a specified buffer? Something that looks like
(switch-to-specific-window-command "buffer-name")

Tian
- 288
- 1
- 8
2
votes
1 answer
How to automatically select apropos buffer when it is displayed
It is possible to automatically select *Help* buffers when they are displayed by doing (setq help-window-select t) (relevant question: How to close help buffer without moving to it?).
Is there a similar setting for *Apropos* buffers? When I use…

Flux
- 583
- 2
- 16
2
votes
2 answers
How to make the mouse only change point only when clicked in the same window?
I want to change the mouse behaviour in Emacs:
When I click between windows (i.e. from one window into another)), I only want to select the new window and not change point. This is the behaviour globally enabled through:
(progn
(global-set-key…

halloleo
- 1,215
- 9
- 23
2
votes
0 answers
Sensible stack-like quit-restore behavior in side-window?
How can I get sensible stack-like behavior from a bottom side-window? I've configured both Ag and Help to display their buffers using display-buffer-in-side-window. I like to maintain a window configuration like
+-----------+ +-----------+
| …

ivan
- 1,928
- 10
- 20
1
vote
2 answers
Split window and move cursor to new window with predefined Emacs command/function
I can split windows with C-x 2 (split-window-below) or C-x 3 (split-window-right). But the cursor does not move to the new window.
When I split I need to have the cursor in the new window. Is there a predefined Emacs command that does this?
I am…

buhtz
- 679
- 4
- 22
1
vote
1 answer
How can Elisp code determine the previously selected window?
I would like to implement an interactive function that, in the "canonical" case, selects the window that was selected before the currently selected one1.
But my plan founders immediately on this question: how can my future function find out, to…

kjo
- 3,145
- 14
- 42
1
vote
1 answer
Identify buffer by part of its name
Is there a way to select a buffer by part of its name using elisp?
For instance, the ag package may create a buffer called
*ag search text:MyPtyhonClass dir:c:/projects/my_module/*
or the realgud package may create a buffer called
*ipdb…

Lorem Ipsum
- 4,327
- 2
- 14
- 35
0
votes
0 answers
Changing/removing the background color for the active window in spacemacs
I use spacemacs on Emacs 28.1. The problem I am having is that in the modeline of the
emacs window, the unique window number is displayed. But the color being used to highlight the active window is yellow, and it is impossible to see a white digit…

krishnab
- 519
- 5
- 17
0
votes
0 answers
Forcing interactive task on a given window
I saved a buffer name in a variable WORKING_BUFFER.
I want to perform, interactively, some operation on that WORKING_BUFFER even if it isn't visible/selected.
I tried:
(with-selected-window (get-buffer-window WORKING_BUFFER))
but I get
Wrong type…

Gabriele Nicolardi
- 1,199
- 8
- 17