From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Jaros=C5=82aw_?= =?UTF-8?Q?Rzesz=C3=B3tko?= Newsgroups: gmane.emacs.bugs Subject: bug#16192: hl-line-mode: Current line highlighting takes precedence over region highlighting Date: Thu, 19 Dec 2013 12:38:28 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b6dc1a4b5050904ede19918 X-Trace: ger.gmane.org 1387453177 8172 80.91.229.3 (19 Dec 2013 11:39:37 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 19 Dec 2013 11:39:37 +0000 (UTC) To: 16192@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 19 12:39:42 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Vtbx2-0002KA-8h for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Dec 2013 12:39:36 +0100 Original-Received: from localhost ([::1]:43504 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vtbx1-00053w-Mx for geb-bug-gnu-emacs@m.gmane.org; Thu, 19 Dec 2013 06:39:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49308) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtbwZ-0004Ut-Qm for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2013 06:39:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtbwV-0007dY-31 for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2013 06:39:07 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44264) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtbwV-0007dU-04 for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2013 06:39:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VtbwU-0001Fr-MH for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2013 06:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jaros=C5=82aw_?= =?UTF-8?Q?Rzesz=C3=B3tko?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Dec 2013 11:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16192 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.13874531294796 (code B ref -1); Thu, 19 Dec 2013 11:39:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Dec 2013 11:38:49 +0000 Original-Received: from localhost ([127.0.0.1]:58283 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VtbwH-0001FI-Bz for submit@debbugs.gnu.org; Thu, 19 Dec 2013 06:38:49 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:47496) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VtbwE-0001F9-Vx for submit@debbugs.gnu.org; Thu, 19 Dec 2013 06:38:47 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VtbwA-0007bD-6q for submit@debbugs.gnu.org; Thu, 19 Dec 2013 06:38:46 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:44753) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VtbwA-0007b9-0c for submit@debbugs.gnu.org; Thu, 19 Dec 2013 06:38:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vtbw5-0003tX-0u for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2013 06:38:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vtbvy-0007ZT-Ri for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2013 06:38:36 -0500 Original-Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]:43516) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vtbvy-0007ZF-Jf for bug-gnu-emacs@gnu.org; Thu, 19 Dec 2013 06:38:30 -0500 Original-Received: by mail-pa0-f53.google.com with SMTP id hz1so1045458pad.40 for ; Thu, 19 Dec 2013 03:38:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=t9aKgJQXybAHcX6iGe4YwyEAIi/QEi1qsNjnhuWPiHI=; b=PU74OqCEzTICWq7h/rCZEVxmWfyEGngT04WddHksBF5pvSNJ6QTw3TY7NpF6nC4reg 6yV1oJJFHCt0B/FhQS0dG2Hf2vCdzZu11nzZaJ3+chX6lIbjZ9562mWw03P9LiWuQdPG 4XPfEtwQfGDgV5g6dmPJIVIOm+wgNDonk3HIwEOhfPTZo5uoM4IqWAvjZ3vakvVHfnTB jaKBt95Z/pzUKg5aQ/8OrDXmPwK46OnkbHnj4YIqIbt5GH08B2T/3eMg3S7s+huzRnmi ktt9DdszmqwCIwD7l6WQTqxz0ChrE3FNcLeL8sm2IyW46cZyHwv+772KdJjMs2phH99m oRFw== X-Received: by 10.68.99.99 with SMTP id ep3mr1017275pbb.107.1387453109042; Thu, 19 Dec 2013 03:38:29 -0800 (PST) Original-Received: by 10.66.77.230 with HTTP; Thu, 19 Dec 2013 03:38:28 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:82213 Archived-At: --047d7b6dc1a4b5050904ede19918 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable 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 (=3D (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=B3aw Rzesz=F3tko --047d7b6dc1a4b5050904ede19918 Content-Type: text/html; charset=ISO-8859-2 Content-Transfer-Encoding: quoted-printable
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 us= ability, since you no longer see where the region is, and in this particula= r situation where the current line is would be obvious without the highligh= ting (the user is in the middle of selecting the region so he knows where h= e 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
=A0=A0=A0=A0=A0 (lambda ()
=A0=A0=A0= =A0=A0=A0=A0 (if (region-active-p)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 nil=
=A0=A0=A0=A0=A0=A0=A0=A0=A0 (cons (line-beginning-position) (line-begin= ning-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
=A0=A0=A0=A0=A0 (lambda ()
=A0=A0=A0= =A0=A0=A0=A0 (let ((line-beg-pos (line-beginning-position))
=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0=A0=A0=A0 (line-end-pos (line-beginning-position 2)))
= =A0=A0=A0=A0=A0=A0=A0=A0=A0 (if (region-active-p)
=A0=A0=A0=A0=A0=A0=A0= =A0=A0=A0=A0=A0=A0 (if (=3D (point) (region-end))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (cons (point) line-end-= pos)
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (cons line-beg-pos (p= oint)))
=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 (cons line-beg-pos line-end-po= s)))))

The last function is better but since hl-line-range-function = returns a single range, it is impossible to highlight the line on both side= s of a region that is part of a single line. In general I appreciate that t= his 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 beh= aviours (as evidenced by what most editors do in this respect).

Cheers,
Jaros=B3aw Rzesz=F3tko
--047d7b6dc1a4b5050904ede19918--