all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting
@ 2013-12-19 11:38 Jarosław Rzeszótko
  2013-12-19 14:02 ` Stefan Monnier
  2013-12-19 16:38 ` Drew Adams
  0 siblings, 2 replies; 12+ messages in thread
From: Jarosław Rzeszótko @ 2013-12-19 11:38 UTC (permalink / raw)
  To: 16192

[-- Attachment #1: Type: text/plain, Size: 1669 bytes --]

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

[-- Attachment #2: Type: text/html, Size: 1746 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-06-17 15:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-12-19 11:38 bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting Jarosław Rzeszótko
2013-12-19 14:02 ` Stefan Monnier
2013-12-19 14:19   ` Jarosław Rzeszótko
2013-12-19 16:43   ` Drew Adams
2013-12-19 17:41     ` Jarosław Rzeszótko
2013-12-19 19:27       ` Eli Zaretskii
2013-12-19 19:47         ` Jarosław Rzeszótko
2013-12-19 20:31           ` Stefan Monnier
2013-12-19 18:02     ` Stefan Monnier
     [not found]       ` <bcaf51ae-dec7-4ac3-87f8-0142ababbc9c@default>
2014-06-17 14:30         ` Drew Adams
2014-06-17 15:07         ` Stefan Monnier
2013-12-19 16:38 ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.