bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#16192: hl-line-mode: Current line highlighting takes precedence over


From: Jarosław Rzeszótko
Subject: bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting
Date: Thu, 19 Dec 2013 12:38:28 +0100

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

reply via email to

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