emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Highlight current line when using gud


From: Zhiwei Chen
Subject: Re: Highlight current line when using gud
Date: Wed, 30 Jun 2021 14:26:33 +0000


On Jun 30, 2021, at 9:17 PM, Eli Zaretskii <eliz@gnu.org> wrote:


From: Zhiwei Chen <chenzhiwei03@kuaishou.com>
Date: Wed, 30 Jun 2021 12:53:08 +0000
Cc: Condy Chen <condy0919@gmail.com>, emacs-devel <emacs-devel@gnu.org>

Case 1: Users don't use hl-line-mode.
There will be no line highlighted in the source buffer.

Case 2: Users use `hl-line-mode' but set `hl-line-sticky-flag' to nil.
In that case, current line will be highlighted if and only if the point is in the source buffer. But if people type “n”, “bt”, “c” ... in the gud buffer, the line in the source buffer will not be highlighted due to the nil `hl-line-sticky-flag’.

Case 3: Users use `hl-line-mode’ and set `hl-line-sticky-flag’ to t.
It works well except that users should make sure `hl-line-face’ is distinguishable. For me (using doom-one theme), it’s hard to see the highlighted line.

But these are all user preferences, aren't they?  You have your
preferences, others have theirs.  No one said everyone needs to have
the current line highlighted in non-selected windows, even when
debugging.  It's up to the users whether they want it or not.

Maybe I’m the victim of vscode. 

I’m making gud more like that, the yellow line is more like the overlay this patch adds.


The question most important to me is: can you, with your preferences,
use hl-line-mode to produce the same effect as the patch you propose
would?  If yes, why do we need yet another user option?  And if you
cannot, can you explain why not?

Thanks.

Personally, hl-line-mode is used to show the approximate position of my point so the face defined in doom-one is fine to me. It needn’t to be too contrast as it hurts my eyes in daily use.
But when debugging, I need to know where the line as if I step over the interesting line I will blame myself. Debugging is more serious than coding/writing, so I would like to
make the line highlighted/contrast. 

(defun make-hl-line-face-contrast ()
  (setq-local hl-line-face ‘a-more-contrast-one))
(add-hook gdb-mode-hook #’make-hl-line-face-contrast)

But when I select the source buffer and move the point, forward a page, I can’t tell which line I’m debugging. So I need to seek for the arrow in fringe but it’s too small to be discovered.
I imagine that if there is a sticky overlay what will happen. I will never lose my debug point…

> Why remove hl-line-mode?  It has gobs of users.

Specifically, the 8 lines in gud.el rather than the hl-line-mode itself.

 ;; If they turned on hl-line, move the hl-line highlight to
 ;; the arrow's line.
 (when (featurep 'hl-line)
   (cond
    (global-hl-line-mode
     (global-hl-line-highlight))
    ((and hl-line-mode hl-line-sticky-flag)
     (hl-line-highlight)))))

--
Zhiwei Chen

reply via email to

[Prev in Thread] Current Thread [Next in Thread]