From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Richard Lawrence Newsgroups: gmane.emacs.bugs Subject: bug#51320: 26.1; kill-region does not ignore its first two args if region is active Date: Thu, 21 Oct 2021 20:57:17 +0200 Message-ID: <877de6p5o2.fsf@aquinas.rewrittenlocator.xyz> References: <87a6j2pnmw.fsf@aquinas.rewrittenlocator.xyz> <83v91q8gfl.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34853"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51320@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 21 20:58:16 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mddGY-0008io-IK for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Oct 2021 20:58:15 +0200 Original-Received: from localhost ([::1]:50666 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mddGX-0007ud-3d for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Oct 2021 14:58:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52450) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mddGM-0007uV-EO for bug-gnu-emacs@gnu.org; Thu, 21 Oct 2021 14:58:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47012) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mddGM-0003sR-6c for bug-gnu-emacs@gnu.org; Thu, 21 Oct 2021 14:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mddGM-0003mK-46 for bug-gnu-emacs@gnu.org; Thu, 21 Oct 2021 14:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Richard Lawrence Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Oct 2021 18:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51320 X-GNU-PR-Package: emacs Original-Received: via spool by 51320-submit@debbugs.gnu.org id=B51320.163484265214477 (code B ref 51320); Thu, 21 Oct 2021 18:58:02 +0000 Original-Received: (at 51320) by debbugs.gnu.org; 21 Oct 2021 18:57:32 +0000 Original-Received: from localhost ([127.0.0.1]:58558 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mddFo-0003lO-DH for submit@debbugs.gnu.org; Thu, 21 Oct 2021 14:57:31 -0400 Original-Received: from out4-smtp.messagingengine.com ([66.111.4.28]:60657) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mddFm-0003l7-Rm for 51320@debbugs.gnu.org; Thu, 21 Oct 2021 14:57:27 -0400 Original-Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id B579B5C01B2; Thu, 21 Oct 2021 14:57:20 -0400 (EDT) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 21 Oct 2021 14:57:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= recursewithless.net; h=from:to:cc:subject:in-reply-to:references :date:message-id:mime-version:content-type; s=fm1; bh=no+9C8N4VC yqAIRMOHjXLNp5dKmcGfDot49DCr1XELE=; b=YDLbCN9LigezybXqqliy1aNHh/ pjsa7WtZa1QmM5cuMkzOBB1lQmmDqkQgCeeSqerj/WIWUgFYR5iG+Nk5y0Xv1WOg g/8K2COjfdZ8KFY6AGBp6HVxUIgtTs5uRbWsSs6oAa1ZaZ5HmmDTkXTPszm6s7nv Yx1oMR6PEjYdPS9eOcYwGzsAr4rvc7MugRQQVkphFkH/mpBRT0JnsLyzzrIfTayR qwHMFA2L0qonBiVnvHRXHKuB22MoLEVCWWhjd+jEWfkD6HQu8x04HspUjFIP1d0t OkXgm6MHIV+LURCwQXBC056oWqRgdrVE7eqORuIX9Talu2St2qzpcHDaM2Gg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=no+9C8N4VCyqAIRMOHjXLNp5dKmcGfDot49DCr1XELE=; b=Ije1rUOd 6cha4iP3V3vQBm15qvm/4rooOIh6/BEXpqtRohG57b+5eQDzSBVOES7DzOKinkYx 0j3jYeUyWXvOku4kWZcJCAWseDXJkiZwCBYJKRXpYdkP0+E93E0dvoDjIzLl91lN P51YlUMR+jiA2pie7nwWlNW5RFjRvuogO10EXbaGaeWi4+ClHNvSAj+7bbQpCnP9 nkvgwYSeHtlF/4PMxcCmcL9tVvlw57o37RWj38Pe2g/XI0EwHRexBm/ulvKDAgdn Ijj8NVWlsaZ6IzlxO2k+A7w825dDv3c4kHuCF7v0kHsJneShtrFFFTqOnmafL+aD dgBarv0HCEF1Fw== X-ME-Sender: X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvtddrvddviedguddvlecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enfghrlhcuvffnffculddvfedmnecujfgurhephffvufgjfhffkfggtgesthdttddttddt tdenucfhrhhomheptfhitghhrghrugcunfgrfihrvghntggvuceorhiflhesrhgvtghurh hsvgifihhthhhlvghsshdrnhgvtheqnecuggftrfgrthhtvghrnhepkeekvdetffekleek gefftdfhuedutdfhueeiheefveefteelfeefgfdvleeigfelnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprhiflhesrhgvtghurhhsvgifihht hhhlvghsshdrnhgvth X-ME-Proxy: Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 21 Oct 2021 14:57:20 -0400 (EDT) Original-Received: from rwl by aquinas with local (Exim 4.92) (envelope-from ) id 1mddFd-0005kO-SG; Thu, 21 Oct 2021 20:57:17 +0200 In-Reply-To: <83v91q8gfl.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:217802 Archived-At: >> From: Richard Lawrence >> Date: Thu, 21 Oct 2021 14:29:11 +0200 >> >> In a function I'm writing, I tried to call kill-region like this: >> >> (and (use-region-p) (kill-region nil nil t)) >> >> with its first two arguments being nil, because the docstring says: >> >> "Supply two arguments, character positions BEG and END indicating the >> stretch of text to be killed. If the optional argument REGION is >> non-nil, the function ignores BEG and END, and kills the current >> region instead." >> >> But in fact, if both BEG and END are nil as in my function call, >> kill-region doesn't ignore them but throws an error, since its first two >> lines are: >> >> (unless (and beg end) >> (user-error "The mark is not set now, so there is no region")) >> >> This was surprising to me, since I expected these values to be ignored. Eli Zaretskii writes: > The error is thrown because there's no region in the buffer where you > invoke this. The fact that you pass BEG and END nil is not the reason > for the error. Forgive me, I'm no expert, but that doesn't sound right to me, for two reasons: 1) In my example, kill-region is only called if use-region-p returns t. (I also checked that (point) and (mark) return non-nil in this context with the debugger.) 2) Literally the first and only thing that kill-region does before throwing the error is check whether BEG and END are non-nil. The error I see is the one in the unless clause quoted above. Am I missing something? -- Best, Richard