GNU bug report logs - #16192
hl-line-mode: Current line highlighting takes precedence over region highlighting

Previous Next

Package: emacs;

Reported by: Jarosław Rzeszótko <sztywny <at> gmail.com>

Date: Thu, 19 Dec 2013 11:39:02 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> IRO.UMontreal.CA>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#16192: closed (hl-line-mode: Current line highlighting takes
 precedence over region highlighting)
Date: Thu, 19 Dec 2013 20:32:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 19 Dec 2013 15:31:28 -0500
with message-id <jwv8uvgh9bi.fsf-monnier+emacsbugs <at> gnu.org>
and subject line Re: bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting
has caused the debbugs.gnu.org bug report #16192,
regarding hl-line-mode: Current line highlighting takes precedence over region highlighting
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
16192: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16192
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Jarosław Rzeszótko <sztywny <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: hl-line-mode: Current line highlighting takes precedence over region
 highlighting
Date: Thu, 19 Dec 2013 12:38:28 +0100
[Message part 3 (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 4 (text/html, inline)]
[Message part 5 (message/rfc822, inline)]
From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Jarosław Rzeszótko <sztywny <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 16192-done <at> debbugs.gnu.org
Subject: Re: bug#16192: hl-line-mode: Current line highlighting takes
 precedence over region highlighting
Date: Thu, 19 Dec 2013 15:31:28 -0500
> Thanks, it's perfect now!

Thank you, closing,


        Stefan


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.