3

I have (setq global-hl-line-sticky-flag t) to enable hl-line in all windows. However, the highlighted line isn't updated when I change the cursor position in inactive window (e.g., by calling next-error to go to next error in the compilation buffer).

  • I have some custom functions that I run at the tail end of compilation-goto-locus. It was several years ago that I added them, but I would imagine that I looked for hooks and thought that my solution was better. You may wish to take a look at where compilation-goto-locus is called in the chain of events and decide whether that would be an appropriate place for you to force the update of highlighting that particular line. Since it would be tail end of compilation-goto-locus that I am suggesting, an advice would be doable. – lawlist Nov 30 '17 at 2:35
  • If you have not already done so, it would be helpful to read the doc-string for the variables next-error-highlight and next-error-highlight-no-select. You may wish to disable hl-line-mode when jumping to next-error and use the built-in methods of the compile library to highlight or create a fringe arrow indicator in the source buffer. – lawlist Nov 30 '17 at 3:05
  • I am having the same issue when using GUD for debugging. I want the current line in the disassembler window to be highlighted when I "step instruction." Right now the cursor moves automatically, but hl-line does not highlight the line where the cursor moved. – nispio Oct 16 '18 at 16:01
  • 1
    I arrived at the following solution for the GUD disassembly window: emacs.stackexchange.com/a/45412/93. It involves advising one of the gdb functions and explicitly invoking hl-line-highlight. Not sure whether this is viable in your case or not. – nispio Oct 16 '18 at 22:53

Your Answer

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

Browse other questions tagged or ask your own question.