From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: kill-region in 24.4 shouldn't require BEG and END Date: Sat, 15 Nov 2014 10:38:05 +0200 Message-ID: <834mu0hn9u.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: ger.gmane.org 1416040736 4189 80.91.229.3 (15 Nov 2014 08:38:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Nov 2014 08:38:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: Kelly Dean Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Nov 15 09:38:49 2014 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 1XpYsZ-0001qu-D2 for ged-emacs-devel@m.gmane.org; Sat, 15 Nov 2014 09:38:47 +0100 Original-Received: from localhost ([::1]:39476 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpYsY-0000cN-Jk for ged-emacs-devel@m.gmane.org; Sat, 15 Nov 2014 03:38:46 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpYsG-0000cI-W7 for emacs-devel@gnu.org; Sat, 15 Nov 2014 03:38:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpYsA-00070s-Ku for emacs-devel@gnu.org; Sat, 15 Nov 2014 03:38:28 -0500 Original-Received: from mtaout26.012.net.il ([80.179.55.182]:58906) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpYsA-0006zu-8K for emacs-devel@gnu.org; Sat, 15 Nov 2014 03:38:22 -0500 Original-Received: from conversion-daemon.mtaout26.012.net.il by mtaout26.012.net.il (HyperSendmail v2007.08) id <0NF200A00N45NS00@mtaout26.012.net.il> for emacs-devel@gnu.org; Sat, 15 Nov 2014 10:36:45 +0200 (IST) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout26.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NF2006NVNX9Z050@mtaout26.012.net.il>; Sat, 15 Nov 2014 10:36:45 +0200 (IST) In-reply-to: X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 80.179.55.182 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:177150 Archived-At: > From: Kelly Dean > Date: Sat, 15 Nov 2014 06:55:38 +0000 >=20 > If the REGION argument is non-nil, then BEG and END shouldn't be re= quired, since they're unused (except in one place where they aren't n= eeded). So the test > =E2=8C=9Cunless (and beg end)=E2=8C=9D > in kill-region should be > =E2=8C=9Cunless (or region (and beg end))=E2=8C=9D > and the docstring should point out that if REGION is non-nil, then = BEG and END are unused and might as well be nil. First, please in the future report bugs with "M-x report-emacs-bug", which will direct the report to the bug tracker, and will also collec= t and report the details about your Emacs version and setup that might be required for analyzing the report. > The one place in kill-region where BEG and END are unnecessarily us= ed if REGION is non-nil is the line > =E2=8C=9C(kill-append string (< end beg))=E2=8C=9D > which should be something like > =E2=8C=9C(kill-append string (if region > =09=09=09(< (point) (mark)) > =09=09 (< end beg)))=E2=8C=9D > and similarly for copy-region-as-kill. >=20 > Without these changes, both kill-region and its docstring are confu= sing. I don't see how the doc string is confusing. Your observations might be correct, but they are based on reading the source code of the implementation of the function. I submit that what you saw there are internal implementation details subject to change without notice, and that therefore the doc string deliberately refrains from saying what you want it to say. IOW, if the implementation is changed some day such that BEG and END _are_ used even when REGION is given, the current doc string will still be correct. Implementation details aside, I've re-read the doc string and found nothing confusing in it. If I were to use this function, I understan= d =66rom the doc string that I need to provide BEG and END, and also provide REGION of BEG and END delineated the current region. This sounds pretty clear to me. > Also, it would be clearer to have different names for the region be= tween the cursor (er. point) and mark vs. a region between two specif= ied positions; maybe call the latter a =E2=80=9Frange=E2=80=9D, and h= ave a cut-range function that takes BEG and END and have a cut-region= function that takes no arguments, have both call kill-region, rename= the latter to =E2=80=9Fcut-range-or-region=E2=80=9D, and provide = =E2=80=9Fkill-region=E2=80=9D as an alias to the latter and mark it a= s deprecated, but I guess we'd have to wait 20 years before that alia= s could be safely removed. To go along with that, rename the kill-rin= g to =E2=80=9Fclip-ring=E2=80=9D (not =E2=80=9Fcut-ring=E2=80=9D sinc= e it holds not just cut things, but also copied things) to be memorab= le as a ring of clippings since everybody knows what a clipboard is, = and rename all the associated functions. IMO, this would be unnecessary complexity. We already have all those use cases covered in that single API. Thanks.