Questions tagged [focus]
The focus tag has no usage guidance.
40
questions
0
votes
0
answers
19
views
How can I disable after-focus-change-function for specifc modes?
I have (setq after-focus-change-function 'xah-save-all-unsaved) in my init.el file
to run save if focus changes, Emacs: Real Automatic Save File. I want to disable this for some modes.
Is it possible ...
1
vote
0
answers
14
views
Transfer focus to started asynchronous process
I have the opposite issue from How to avoid losing focus after starting an asynchronous process?. I would like to call start-process and have the resulting window be focused.
Specifically, I am ...
0
votes
0
answers
22
views
Trigger term buffer moving point to the end after sending command
I'm using:
(display-buffer term 'display-buffer-use-some-window)
(term-simple-send (get-buffer-process term) cmd)
to send a command to a Term buffer and displaying the result in other window.
It is ...
0
votes
0
answers
32
views
Moving focus to external application (Chrome) and back to Emacs
I was wondering what is the most efficient way to move in and out of Emacs windows.
In my workflow I use Chrome and Emacs constantly, so I am curious as to how other users have managed to move amongst ...
1
vote
1
answer
191
views
Focus a buffer window if already visible; open a window with the buffer if not
I'd like to use a single function (and later keybind it to a single key) that would do the following:
if treemacs is visible in the frame, focus to its window;
if not, call treemacs.
I took a look ...
5
votes
1
answer
174
views
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 ...
1
vote
1
answer
189
views
Ignore spurious focus events for after-focus-change-function
I'm on Emacs 27.1, Fedora 33, GNOME 3.38.2.
In the latest NEWS it is reported that
The hooks focus-in-hook and focus-out-hook are now obsolete.
Instead, attach to after-focus-change-function using ...
2
votes
1
answer
89
views
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 ...
2
votes
1
answer
243
views
How to focus or change point on child frame
I am trying to use lsp-ui package to display some documentation for Rust. When I put the cursor on a type for example, a popup child frame is created but the focus is still on the main window. If I ...
1
vote
0
answers
29
views
Emacs blocked by interactive query in inaccessible frame
Recently I found my emacs, which I run as a daemon, in a blocked state.
It would not react to any command. Not C-g, not cursor movements, nothing that I could think of. Then I realized, that I had ...
4
votes
3
answers
1k
views
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 ...
1
vote
1
answer
117
views
How to keep keyboard focus on terminal after compiling tex?
My operation system is macOS Catalina. I am using iTerm2 in order to interact with emacs and my default pdf viewer is PDF Pro Reader Light. When a pdf file is updated, PDF Pro Reader Light ...
0
votes
1
answer
258
views
using display-frame-alist to force switch to buffer
Could someone please explain how to use default-frame-alist to make list-buffers switch to the resulting results buffer? list-buffers uses display-buffer so I am thinking that display-buffer-alist is ...
1
vote
2
answers
542
views
Show me where cursor is
At home, I use Emacs on a large monitor, and I often switch between it and the browser. Sometimes, when I come back to Emacs, I lose between 1 and 5 seconds finding where current point (the cursor) is....
1
vote
0
answers
133
views
How can I stop Emacs from grabbing focus at startup?
I typically start GUI Emacs on macOS, https://bitbucket.org/mituharu/emacs-mac/overview, installed via Nix package manager, as part of a larger startup script on the terminal (iterm). While Emacs is ...
2
votes
3
answers
1k
views
Can emacsclient focus an existing frame?
When emacsclient is invoked with the option -c it creates a new frame.
In both Windows and Linux, this frame is a window at the top of the Z-stack and has input focus.
With option -n (non-blocking) ...
0
votes
1
answer
172
views
move focus between sub-windows (or buffers?) with ctrl-tab?
Currently using GNU Emacs 23.1.1.
I've used xemacs since the late 90s and am only now switching to proper emacs.
If I had my xemacs window split into a top buffer and bottom buffer, I could move the ...
1
vote
2
answers
93
views
how to prevent debugger from taking focus when you evalute lisp expresison with errors
How to reproduce:
write some faulty elisp code
press C-x C-e for eval-last-sexp
the debugger will appear (*backtrace* window) and take the focus of the cursor.
I'd like the focus to remain with ...
2
votes
2
answers
296
views
Preventing `TeX-command-run-all` from shifting focus
It seems that TeX-command-run-all shifts focus to the pdf window, which is quite annoying. Is there a way to prevent that?
1
vote
0
answers
159
views
Don't focus on evince, when compiling pdf from org-mode
I'm using Evince as my Pdf-Viewer (In a split-screen-setup) whenever i write something in org-mode and compile it as a pdf. To achieve this, i've added
(add-to-list 'org-file-apps '("pdf" . "evince %...
3
votes
1
answer
2k
views
Set focus to minibuffer window
Some commands use Emacs' minibuffer to prompt for input.
I occasionally do something which moves the focus to another window and away from the minibuffer. In these cases I cycle windows with C-x o ...
1
vote
1
answer
328
views
How do I focus Emacs from elisp in macOS?
I want to focus emacs by running some elisp. I have tried using do-applescript and the following snippet to focus Emacs:
if application "Emacs" is running then
tell application "System Events" to ...
5
votes
2
answers
189
views
How can I prevent Magit-status command from grabbing the frame focus?
when executing magit-status and quickly focus out emacs, after the magit buffer pops up, emacs grabs the focus back. This is quite inconvenient. Is there a way to prevent that focus changing?
The ...
0
votes
1
answer
426
views
focus-in-hook and buffer-file-name
I have the following in my init file
(defun message-buffer-file-name-or-nothing ()
"Mode line proxy."
(if buffer-file-name
(message "[%s] %s"
(format-time-string "%H:%M:%S")
...
3
votes
1
answer
540
views
Raise the emacs application window when opening a file triggers a prompt?
In case it's relevant, I'm on a Mac, running OSX 10.12 and Carbon Emacs 24.3.1.
If I open a file using /Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n filepath the Emacs window comes to the ...
0
votes
0
answers
104
views
Retaining focus while displaying graphics windows
NB: The Emacs world uses the word frame to refer to what in most other contexts is called window, and uses the word window to describe something else. In this post, however, the word window always ...
2
votes
0
answers
73
views
mode-line-inactive after system window loses focus
When a system/X11 window (frame) with Emacs loses focus, how can I make its mode line become mode-line-inactive? It stays active, keeping the standard mode-line look/face…
Shouldn’t it be the default?...
6
votes
2
answers
444
views
Show the matching line in the center of the screen instead of the bottom when opening a grep result
When I grep something inside emacs and click to open one of the matching files. The matching line is always displayed at the bottom of the screen, and I have to scroll it up for a better view.
Is it ...
1
vote
1
answer
238
views
How to show process in another already opened frame?
I have two frames opened in emacs (one in each monitor, but this is irrelevant). I would like to have a lisp function to switch the buffer in the other frame (in the other monitor), whose focus is in ...
1
vote
0
answers
230
views
Prevent call-process from stealing focus
When Emacs executes call-process after the focus has moved to another window (this is after a compilation step which takes some time to finish) it grabs the focus and causes the pointer to move to the ...
3
votes
1
answer
332
views
Determine if any frame has input focus?
I have a function that gets called when idle, but I would like it to run only when a frame has input focus.
My current work around is to use focus-in-hook and focus-out-hook to change the behavior ...
9
votes
2
answers
2k
views
Automatically switch focus to new window
Is there a way to automatically switch focus to any new windows?
For example, if I C-h f some-function, that creates a new window. But the focus remains where I was, so when I'm done reading and hit ...
7
votes
1
answer
5k
views
Get a reference for the current frame
frame-list returns a list of references for live Emacs frames. How does one get a reference for the current Emacs frame? I have been unable to find an appropriate function. Current could be either (...
13
votes
2
answers
896
views
Change highlight color when window isn't in focus?
I'm using hl-mode as a minor mode for deft. How do I make the highlighted line change color (e.g. to gray) when the deft window isn't the current window, and then back to the default highlight color ...
5
votes
1
answer
664
views
Emacs Orgmode: hiding other items in the tree
I have an org file, that looks like:
* Item 1
** Subitem 1.1
* Item 2
** Subitem 2.1
This text from Subitem 2.1
** Subitem 2.2
I am editing text under Subitem 2.1. Is there a way to hide everything ...
5
votes
2
answers
492
views
Open new emacs frame that steals focus from other apps?
I have this notification system in emacs that opens a new buffer with a reminder and relevant info at specified times. However, if I am using my browser I can't see it.
Therefore I am wondering ...
7
votes
2
answers
1k
views
Change focus to *Help* buffer after running describe-mode
When I type C-h m for describe-mode the frame splits into two windows with the current buffer on top and the *Help* buffer below. But the focus stays in the current buffer, so I usually have to type C-...
19
votes
1
answer
3k
views
How to know my buffer's visible/focused status?
I'm writing an extension that talks to an outside process, so it is a given to lower the amount of 'hey whats up' requests when my buffer isn't focused.
So, what is the best way to recognize:
When ...
7
votes
3
answers
774
views
Focus-hook: attenuate colours when losing focus
How can I use the focus hooks to attenuate all colours in visible buffers when the Emacs frame loses focus?
I tried using the following code:
(set-frame-parameter (selected-frame) 'alpha '(100 80))
...
12
votes
2
answers
1k
views
Make Buffer List take focus?
How can I make it so that when I press C-xC-b to access the Buffer List that that buffer automatically takes focus instead of having to switch to it manually with C-xo? I can't find a variable that ...