Questions tagged [focus]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
1answer
215 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 ...
1
vote
1answer
70 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 ...
13
votes
2answers
743 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 ...
8
votes
2answers
1k 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 ...
3
votes
1answer
66 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 ...
0
votes
0answers
29 views

Closing magit's visit-file/blob window doesn't return focus back to magit

If Magit's log is open and you hit RET on any of the commits, it opens a visit file/blob window where you can see the diff with some details. There's a few ways to do it, but I believe in Doom Emacs ...
1
vote
1answer
81 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 ...
1
vote
1answer
34 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 ...
1
vote
0answers
82 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
0answers
22 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 ...
3
votes
1answer
378 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
2answers
208 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?
2
votes
3answers
442 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
1answer
151 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
2answers
256 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
0answers
79 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 ...
0
votes
1answer
97 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
2answers
59 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 ...
3
votes
1answer
1k 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
0answers
116 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 %...
11
votes
2answers
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 ...
1
vote
1answer
259 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
1answer
144 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
1answer
313 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
1answer
407 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 ...
5
votes
1answer
582 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 ...
4
votes
2answers
343 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 ...
0
votes
0answers
87 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
0answers
56 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?...
1
vote
1answer
195 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
0answers
180 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 ...
6
votes
1answer
4k 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 (...
6
votes
3answers
660 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)) ...
5
votes
2answers
423 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 ...
5
votes
2answers
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-...
17
votes
1answer
2k 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 ...