From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: Proposal to change cursor appearance to indicate region activation Date: Sat, 20 Apr 2013 00:23:59 -0700 Message-ID: References: <1366426478.1624.YahooMailClassic@web141106.mail.bf1.yahoo.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1366442655 2940 80.91.229.3 (20 Apr 2013 07:24:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 20 Apr 2013 07:24:15 +0000 (UTC) To: "'Kelly Dean'" , Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Apr 20 09:24:15 2013 Return-path: Envelope-to: ged-emacs-devel@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 1UTS9f-0008TR-2B for ged-emacs-devel@m.gmane.org; Sat, 20 Apr 2013 09:24:15 +0200 Original-Received: from localhost ([::1]:43931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTS9e-0005ED-Lq for ged-emacs-devel@m.gmane.org; Sat, 20 Apr 2013 03:24:14 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35229) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTS9a-0005Dm-Ng for emacs-devel@gnu.org; Sat, 20 Apr 2013 03:24:12 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UTS9Z-0004XU-1s for emacs-devel@gnu.org; Sat, 20 Apr 2013 03:24:10 -0400 Original-Received: from userp1040.oracle.com ([156.151.31.81]:35599) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UTS9Y-0004XO-RL for emacs-devel@gnu.org; Sat, 20 Apr 2013 03:24:08 -0400 Original-Received: from ucsinet21.oracle.com (ucsinet21.oracle.com [156.151.31.93]) by userp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r3K7O6Jj011919 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 20 Apr 2013 07:24:07 GMT Original-Received: from aserz7022.oracle.com (aserz7022.oracle.com [141.146.126.231]) by ucsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3K7O6Fe022761 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Sat, 20 Apr 2013 07:24:06 GMT Original-Received: from abhmt113.oracle.com (abhmt113.oracle.com [141.146.116.65]) by aserz7022.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r3K7O5k6019451; Sat, 20 Apr 2013 07:24:05 GMT Original-Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 20 Apr 2013 00:24:05 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <1366426478.1624.YahooMailClassic@web141106.mail.bf1.yahoo.com> Thread-Index: Ac49cm1S0uDW1h80R/+ElDXnJSqm4gAGZrcg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: ucsinet21.oracle.com [156.151.31.93] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:159031 Archived-At: > By default in Emacs, when the region is active but empty, > there's no visual indication of this status. See below. > Neither is there indication of the active region if > point is one less than mark and blink-cursor-mode is off. Hm. That's not what I see. > Also, if point is greater than mark, the active region > is highlighted, but the block cursor does an inverse-video > highlight of the character following the region, which > (speaking from experience) an Emacs newbie finds > distracting, since it seems to indicate that that character > is also part of the region It's been a long since I was a newbie wrt transient-mark mode. But I have a hard time believing that inverse video has much, if anything, to do with it. A block cursor itself is the cause of any such confusion, I think, regardless of inverse video. It sits on top of a char, so a priori it is ambiguous whether the region includes that character or not. Any editor would choose to be consistent here, whichever choice were made (include it or not). A newbie just has to discover which choice has been made. ;-) And a moment's thought would anyway reach the conclusion that choosing to include the char under the cursor would mean that the active region always has at least one char (the one under the cursor). > Adding to the confusion, the inverse-video > highlighted character actually is part of the region in the > case that point is less than mark. Setting the cursor type to > bar when the region is active solves all those problems, and > I recommend it as the default for Emacs. I don't see those as great problems. But you could argue that I am already used to the current way. > (add-hook 'deactivate-mark-hook (lambda () (setq cursor-type t))) > (add-hook 'activate-mark-hook (lambda () (setq cursor-type 'bar))) I wouldn't have a problem with that being the default behavior, but I don't see a crying need for it either. You might also want to conditionalize the activation part with (when transient-mark-mode (setq...)): there are still some who are not transient-mark modists. Making default behavior depend on such hooks makes it more difficult for users (especially newbies) to change the behavior. There could be ways around that, wrapping the complexity in defcustoms or some such. But as you present it, it requires users to fiddle with Lisp a bit to make changes. [I think you will find, BTW, that with recent Emacs 24 builds a `mouse-1' click sometimes leaves the cursor as a bar and sometimes as a block. A bug apparently - it does not seem to happen with 24.3 or earlier. Seems to depend on the line clicked, for some reason. At least that's what I see on MS Windows.] > Simply setting the cursor type permanently to bar would solve > most of the problems, but still wouldn't indicate an active > empty region. And a permanent bar cursor makes it hard to > find the cursor on screen if blink mode is off. So I > recommend keeping the current default of a block cursor when > the region isn't active. Yes. A bar cursor does not particularly stand out as an indication of an empty active region, however. It might be better than no indication, but it is not really going to prevent people from getting into the typical troubles from not realizing that the region is active and empty. FWIW, I use code[*] that indicates the size of the active region in the mode line (using face `region'). It is an option (choice) whether it indicates an empty active region also (useful or distracting, depending on your point of view). I also use a dynamically changing cursor[**] for other purposes than indicating the active region: * change color when using an input method * change shape (to block, by default) when Emacs is idle * change shape (to block, by default) when in overwrite mode or read-only So in my case the cursor is a bar when I'm actually editing, regardless of whether the region is active. It is a block when Emacs is idle or the buffer is read-only or in overwrite mode. And I use `blink-cursor-mode', so the block cursor that appears when Emacs is idle does not confuse wrt the active region. In sum, your arguments are sound and your proposal is reasonable. This is the kind of simple observation and thinking that we need more of, IMHO. But there are multiple ways to skin the cat. I'm neutral on your proposal wrt the resulting behavior, and slightly negative wrt the mechanism (hooks). If we do what you suggest by default then it might be good to wrap the hook stuff in defcustoms (e.g. :set sexps) or minor modes, so users don't need to fiddle with Lisp to make simple behavior changes. (No, it's not a big deal, but why not make it easier?) [*] code: http://www.emacswiki.org/emacs-en/download/modeline-posn.el description: http://www.emacswiki.org/ModeLinePosition [**] code: http://www.emacswiki.org/emacs-en/download/cursor-chg.el description: http://www.emacswiki.org/ChangingCursorDynamically