Questions tagged [focus]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
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 ...
user avatar
1 vote
1 answer
66 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 ...
user avatar
4 votes
1 answer
124 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 ...
user avatar
  • 553
1 vote
1 answer
127 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 ...
user avatar
  • 1,392
2 votes
1 answer
66 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 ...
user avatar
  • 553
1 vote
1 answer
141 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 ...
user avatar
  • 123
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 ...
user avatar
  • 136
3 votes
2 answers
788 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 ...
user avatar
  • 33
1 vote
1 answer
104 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 ...
user avatar
  • 1,102
0 votes
1 answer
203 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 ...
user avatar
  • 738
1 vote
2 answers
376 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....
user avatar
  • 421
1 vote
0 answers
105 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 ...
user avatar
  • 481
2 votes
3 answers
752 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) ...
user avatar
0 votes
1 answer
132 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 ...
user avatar
1 vote
2 answers
73 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 ...
user avatar
1 vote
2 answers
262 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?
user avatar
  • 2,904
1 vote
0 answers
142 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 %...
user avatar
  • 277
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 ...
user avatar
1 vote
1 answer
292 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 ...
user avatar
  • 620
5 votes
1 answer
164 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 ...
user avatar
  • 416
0 votes
1 answer
370 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") ...
user avatar
  • 294
3 votes
1 answer
485 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 ...
user avatar
0 votes
0 answers
100 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 ...
user avatar
  • 2,889
2 votes
0 answers
65 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?...
user avatar
6 votes
2 answers
404 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 ...
user avatar
1 vote
1 answer
218 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 ...
user avatar
  • 268
1 vote
0 answers
201 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 ...
user avatar
  • 21
3 votes
1 answer
268 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 ...
user avatar
  • 306
8 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 ...
user avatar
  • 958
7 votes
1 answer
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 (...
user avatar
  • 6,794
13 votes
2 answers
808 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 ...
user avatar
  • 163
5 votes
1 answer
617 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 ...
user avatar
  • 251
5 votes
2 answers
450 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 ...
user avatar
6 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-...
user avatar
18 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 ...
user avatar
6 votes
3 answers
723 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)) ...
user avatar
  • 5,206
11 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 ...
user avatar
  • 669