From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: kill-region in 24.4 shouldn't require BEG and END Date: Sat, 15 Nov 2014 10:22:24 -0500 Message-ID: References: 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 1416064985 2029 80.91.229.3 (15 Nov 2014 15:23:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Nov 2014 15:23:05 +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 16:22:58 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 1XpfBf-00066R-Uh for ged-emacs-devel@m.gmane.org; Sat, 15 Nov 2014 16:22:56 +0100 Original-Received: from localhost ([::1]:40863 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpfBf-0007RR-ES for ged-emacs-devel@m.gmane.org; Sat, 15 Nov 2014 10:22:55 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52679) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpfBL-0007R7-Rl for emacs-devel@gnu.org; Sat, 15 Nov 2014 10:22:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XpfBC-0007j3-AF for emacs-devel@gnu.org; Sat, 15 Nov 2014 10:22:35 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:5678) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XpfBC-0007iv-7S for emacs-devel@gnu.org; Sat, 15 Nov 2014 10:22:26 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: As0IAGA2ZVRLd+sd/2dsb2JhbABbgw6EM4YvywwEAgKBHBcBAQEBAQF8hAMBAQMBIzMjBRYaAhgOAhYYDSSISwm6XZYnAQsggS2PZweCd4FUBYwLpxeBdoQaH4J7AQEB X-IPAS-Result: As0IAGA2ZVRLd+sd/2dsb2JhbABbgw6EM4YvywwEAgKBHBcBAQEBAQF8hAMBAQMBIzMjBRYaAhgOAhYYDSSISwm6XZYnAQsggS2PZweCd4FUBYwLpxeBdoQaH4J7AQEB X-IronPort-AV: E=Sophos;i="5.07,380,1413259200"; d="scan'208";a="97086549" Original-Received: from 75-119-235-29.dsl.teksavvy.com (HELO pastel.home) ([75.119.235.29]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 15 Nov 2014 10:22:25 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 2DD0D85E5; Sat, 15 Nov 2014 10:22:25 -0500 (EST) Original-References: In-Reply-To: (Kelly Dean's message of "Sat, 15 Nov 2014 06:55:38 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:177187 Archived-At: > If the REGION argument is non-nil, then BEG and END shouldn't be > required, since they're unused (except in one place where they aren't > needed). 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. I think a simpler change would be to add, right after the `interactive' line, a simple: (if region (setq beg (mark) end (point))) Which would make it obvious that the beg/end arguments are not used when region is non-nil, without having to scan the rest of the code. And it would keep the rest of the code simpler (less sprinkling of tests of `region'). And we could even use another API where we only have BEG and END and say that if BEG is the symbol `region', then use *the* region. Stefan