3

Prelude

Let me start by mentioning the scenario where the problem arises.

I see that 2-3 variables are always used together in a system. I need to add yet another one that will be used along with them.

I decide it would be wise to refactor, extract them together into a class, before introducing the new variable.

But I need to choose the member functions for that class. I mark the set of files and search for the variable names to identify what operations might be needed.

And so I run recursive directory insert in Dired, call M-x dired-mark-files-regexp (% m) to mark the source files, and then call M-x dired-do-find-regexp (A). I flip through the xref buffer with xref-next-line (n) and look in-context at how the variables are used.

But I can barely see the cursor. The salient lines are not in the selected frame, and so the cursor appears as a hollow rectangle, and setting (global-hl-line-mode 1) does not help.

emacs invisible cursor

Question

How can I highlight the cursor or the line in unselected frames?

I'll gladly settle for a solution that makes the cursors in all unselected frames visible, not just those adjacent to *xref* buffers.

I'll even settle for an (eshell-based?) method that will let me see the few lines around each occurence, but in a recursive tree of source files, not just in one directory.

The question continues with a sequel here.

1 Answer 1

2

global-hl-line-mode, from standard library hl-line.el highlights the current line. If option global-hl-line-sticky-flag is non-nil then it does this in all windows.


Library crosshairs.el (see Crosshair Highlighting) highlights also the current column, but it does so only in the selected window. You can have crosshairs shown in any buffers or modes, either on demand or continually. Try turning on crosshairs-mode, with non-nil global-hl-line-sticky-flag.

2
  • Pretty nice. Two issues though. 1- The stickiness doesn't seem to apply to the vline, only to the horizontal one, and 2- what before/after hooks would I need to modify to automate enabling/disabling global-hl mode when one is in an xref buffer? (the global-hl-line mode/vline are truly unpleasant to keep).
    – Calaf
    Nov 3, 2017 at 0:05
  • 1
    1. Yes, there is currently no such "stickiness" (i.e., support of non-selected windows) for vline / col-highlight. 2. No idea - check with xref for info about what hooks are appropriate for xref.
    – Drew
    Nov 3, 2017 at 1:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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