From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: delete-selection-mode as default Date: Tue, 18 Sep 2018 15:31:04 +0300 Message-ID: <83va73f0mv.fsf@gnu.org> References: <83k1nxvm5j.fsf@gnu.org> <87sh2ih0bp.fsf@fastmail.fm> <770f48a8-664a-40ae-8e03-19f6aad248b6@default> <20180910181615.GA4829@ACM> <874lev3bq4.fsf@toy.adminart.net> <20180912131602.GA5582@ACM> <87d0tihxzw.fsf@toy.adminart.net> <20180913174640.GB4019@ACM> <8736udkuit.fsf@toy.adminart.net> <20180914104833.GA4103@ACM> <83k1nojgia.fsf@gnu.org> <874leq799e.fsf@toy.adminart.net> <835zz5ie17.fsf@gnu.org> <87musg0wyf.fsf@toy.adminart.net> NNTP-Posting-Host: blaine.gmane.org X-Trace: blaine.gmane.org 1537273870 9380 195.159.176.226 (18 Sep 2018 12:31:10 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 18 Sep 2018 12:31:10 +0000 (UTC) Cc: spacibba@aol.com, joostkremers@fastmail.fm, npostavs@gmail.com, emacs-devel@gnu.org, yurivkhan@gmail.com, acm@muc.de, drew.adams@oracle.com, phillip.lord@russet.org.uk To: hw Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Sep 18 14:31:05 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1g2F9k-0002IL-NF for ged-emacs-devel@m.gmane.org; Tue, 18 Sep 2018 14:31:04 +0200 Original-Received: from localhost ([::1]:40128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2FBr-0004Hp-CU for ged-emacs-devel@m.gmane.org; Tue, 18 Sep 2018 08:33:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52198) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2FBU-0004Ej-Qj for emacs-devel@gnu.org; Tue, 18 Sep 2018 08:33:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g2FBT-0000t0-I6 for emacs-devel@gnu.org; Tue, 18 Sep 2018 08:32:52 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:43815) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g2FA6-0007WU-5d; Tue, 18 Sep 2018 08:31:26 -0400 Original-Received: from [176.228.60.248] (port=4094 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1g2FA4-0005t7-CC; Tue, 18 Sep 2018 08:31:26 -0400 In-reply-to: <87musg0wyf.fsf@toy.adminart.net> (message from hw on Tue, 18 Sep 2018 00:11:05 +0200) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:229938 Archived-At: > From: hw > Cc: spacibba@aol.com, joostkremers@fastmail.fm, npostavs@gmail.com, emacs-devel@gnu.org, yurivkhan@gmail.com, acm@muc.de, drew.adams@oracle.com, phillip.lord@russet.org.uk > Date: Tue, 18 Sep 2018 00:11:05 +0200 > > >> That would allow to decouple navigation from (making) selections, and > >> the concept of a region becomes obsolete, removing all the entanglement > >> and greatly simplifying things. > > > > You forget the kill-ring and the kill/yank commands. Those are almost > > exactly identical to what other apps give you with copy/paste, and the > > latter use selections. So the reasons Emacs implements selections > > using the region are more fundamental than just navigation. > > What are these fundamental reasons? They were just described above: the set of commands that copy/kill and paste text. > Other programs, like joe, allow you to use the selection for > navigation without having a region. Once again, in Emacs region _is_ the selection. > > Once again: in Emacs, selection _is_ the region, and for some very > > good reasons. > > Not to me. The selection is what becomes highlighted when I make one. That's a minor detail in Emacs. The underlying fundamental functionality is the region. > > You can, of course, start inventing an Emacs that is based on > > selections. But if that Emacs will still support copy/paste inside > > Emacs and vis-a-vis other apps, if it will support commands that > > operate on the selected text and/or work different when some text is > > selected -- then what you will have at the end is the same Emacs, just > > one where the region is called "selection". OK, maybe you will lose > > the ability to do "C-x C-x" for navigation -- but to what purpose? > > I never use that, why would I? Others do. Emacs caters to many different workflows, and it is fine not to have to use some of its features for which you don't have a need. But we cannot remove them just because you personally don't use them, can we? > Do you mean the one that solves some problems with delete-selection-mode > by "arming" the region instead of activating it? I'd rather call it > "disarming" because disarming before killing makes more sense than > arming before killing :) > > IIUC, your idea is to *generally* either "activate" a region or to > "disarm" it, depending on which behaviour a user wants. I'm not sure > how this is different from delete-selection-mode, and I think it needs > more variations: > > By setting mark-even-if-inactive to nil, I have "fortified" the region > because nothing can be done with it unless it is "active". > > There are more variations, like disabling shift-selection and disabling > making a selection with the trackball. That might make the region > "protected". When it's also fortified, it would be "inert", unless it > has been disarmed, in which case it would be "content". These word plays just muddy the waters. The basic point is to have more than just 2 states of the region, and allow various features behave differently by being sensitive to the current state of the region. > I like the idea because having a domain of fundamental region states > that can be combined with each other can lead to more consistency, and > the whole domain could be explained to users so they can get the > behaviour they prefer by picking any combination of states. Currently, > all the modes and options involved appear to be unrelated, and users may > never find what suits them best because they don't know all the > available options. Bringing them together in one domain would change > that. Good, so we agree. > They actually *are* two different things for me. The selection is what > I make to work with and what becomes highlighted. The region is > something unwanted always lurking in the background waiting for me to > make a mistake and making me feel uneasy. > > The problem is that Emacs is unable to make this important distinction. > I could say that this confuses things. Because in Emacs, selection _is_ the region. Adding a state property could allow us to make the distinction nonetheless. > Navigating a buffer and making selections are two totally unrelated > things. No, they are closely related, because in general you need to navigate to a place to mark it as beginning/ending a selection. > > You are missing the point. The point is that sometimes the user > > doesn't want a selection to be replaced by a character she types, and > > other times she does. The issue at hand is how to design a UI that > > will allow both possibilities, without telling the users to turn on or > > off delete-selection-mode for that purpose. > > Do you mean there is a big problem with delete-selection-mode when > transient-mark-mode is disabled because then there is "maybe sometimes" > a selection a user may want to replace by inserting characters? No, I mean delete-selection-mode changes the effects of some commands in ways that could be very inconvenient in some situations, and currently the only way for the user to deal with such conflicts is by turning on or off delete-selection-mode. There should be a better way of temporarily enabling/disabling delete-selection-mode, similar to what we have for transient-mark-mode. > Other than that, Emacs would have to read the users` minds to figure out > what they want with each character they insert. See above: I believe we can let the users speak their minds so that Emacs doesn't need to read them. > Upcase-region works without activating the region first though > transient-mark-mode says that commands should be limited to the "active" > region. So for upcase-region to work when no region is "active", it is > as if the region is secretly activated so that upcase-region can work, > and this may be unexpected. What do you want upcase-region to do when there's no active region, then? Doing nothing or signaling an error would go against Emacs's tradition of DWIM-ish operation. > > This flies in the face of a long tradition in Emacs to provide DWIMish > > operation, whereby if something makes a lot of sense in some > > specialized situation, Emacs should do that automatically, even if it > > deviates from the "normal" operation. A notable example is what C-t > > does when point is at end of line. > > > > So if some effect of a command would make sense when it is invoked > > without any "selection", we program Emacs to do that, and that is not > > a bug at all, it's why Emacs shines in many situations where other > > editors don't. > > That's a difficult thing because it creates inconsistencies. If what Emacs does is what the user would expect, what makes sense, then the inconsistencies don't matter. > >> Or why would I want something like upcase-region to suddenly mess up > >> random parts of a buffer? > > > > Only they aren't random. > > They are as random as the region, and the region is entirely random. I disagree. IME, it is never random when I want to act on it. > > If you want Emacs to do something with text in the region, you will > > redefine the region before invoking the command > > I always do that. That's "making a selection", and it's the selection I > work with, not the region. The only time the region is not random is > when it is a(n active) selection. Which always happens before you invoke a command that works on a region. And in some case, the region is already conveniently set to what you might want to act upon.