1

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. Here's a screenshot of what happens (can you guess where point is?):

Capture of Emacs on a large screen with many windows, and point lost (Note how the active windows is not that easy to find)

Is there a macro that I could launch with a key combination, that would show me very visibly and instantaneously where point is? I imagine like a big red circle appearing for half of a second over the point, or something like that.

1
  • 1
    I guess C-x C-x will often clarify the situation, but I just wanted to note that I never have this problem because rather than look for the selected window and the cursor inside it, I just decide where I want cursor to be and left-click on it with the mouse.
    – Stefan
    Dec 7 '19 at 18:33
1

I personally use beacon mode.

Whenever the window or frame gets focus, or the point changes position, the point is momentarily highlighted with a color gradient background of your choice.

1
  • Beautiful solution. With (setq beacon-blink-when-focused t), it does exactly what I was looking for.
    – kotchwane
    Dec 8 '19 at 8:29
2

You can use Crosshairs Highlighting (crosshairs.el) to highlight point using crosshairs.

Command crosshairs does this (there are other, related commands).

But if you want to have crosshairs show up automatically when you switch window-manager focus from another application to an Emacs frame then you might have to jump through some hoops.

To have crosshairs show up when you switch among Emacs frames using Emacs (e.g. C-x 5 o), you can bind the special event focus-in to `crosshairs:

(define-key special-event-map (kbd "<focus-in>") 'crosshairs)

There might be another special event that will take care of focusing an Emacs frame when you switch to Emacs from another app, but I don't know of one.

2
  • Although this is an excellent answer, it seems a little like overkill to me : install manually 3 different packages: crosshairs.el, hl-line+.el, vline.el (which BTW are not on Melpa, which is a strong deterrent), just to have the cursor visible for half a second... Is there no way to do that in 3 lines of code ?
    – kotchwane
    Dec 8 '19 at 8:20
  • @ギョーム: Perhaps there is - feel free to offer it. Multiple "packages" (really just simple Lisp libraries) are involved because hl-line+.el and vline+.el are usable alone, without crosshairs.el. The latter just combines horizontal indication with vertical indication. If you want only horizontal or only vertical, just use hl-line+.el or vline+.el.
    – Drew
    Dec 8 '19 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.