GNU bug report logs -
#16192
hl-line-mode: Current line highlighting takes precedence over region highlighting
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
I use a current emacs build from VCS. When you use hl-line-mode with the
default settings, the highlighting of the current line takes precedence
over the region highlighting. In my opinion this is bad usability, since
you no longer see where the region is, and in this particular situation
where the current line is would be obvious without the highlighting (the
user is in the middle of selecting the region so he knows where he is in
the file I guess). Would a hl-line-range function of this kind not be a
better default:
(setq hl-line-range-function
(lambda ()
(if (region-active-p)
nil
(cons (line-beginning-position) (line-beginning-position 2)))))
Or one that keeps the current line highlighting only where it does not
interfere with the region highlighting:
(setq hl-line-range-function
(lambda ()
(let ((line-beg-pos (line-beginning-position))
(line-end-pos (line-beginning-position 2)))
(if (region-active-p)
(if (= (point) (region-end))
(cons (point) line-end-pos)
(cons line-beg-pos (point)))
(cons line-beg-pos line-end-pos)))))
The last function is better but since hl-line-range-function returns a
single range, it is impossible to highlight the line on both sides of a
region that is part of a single line. In general I appreciate that this is
customizable and one can overwrite it, but it takes quite some time to fix
it yourself, and I think most users want to see one of those two behaviours
(as evidenced by what most editors do in this respect).
Cheers,
Jarosław Rzeszótko
[Message part 2 (text/html, inline)]
This bug report was last modified 10 years and 49 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.