From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii 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 19:56:46 +0300 Message-ID: <83v91q8gfl.fsf@gnu.org> References: <87a6j2pnmw.fsf@aquinas.rewrittenlocator.xyz> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27724"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51320@debbugs.gnu.org To: Richard Lawrence Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 21 19:07:00 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 1mdbWq-0006oc-2L for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Oct 2021 19:06:56 +0200 Original-Received: from localhost ([::1]:41628 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdbWo-0003vy-7Z for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Oct 2021 13:06:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56664) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdbVz-0003v7-Fe for bug-gnu-emacs@gnu.org; Thu, 21 Oct 2021 13:06:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46895) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mdbVy-0004dQ-VY for bug-gnu-emacs@gnu.org; Thu, 21 Oct 2021 13:06:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mdbVy-0006kV-Qn for bug-gnu-emacs@gnu.org; Thu, 21 Oct 2021 13:06:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Oct 2021 17:06: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.163483595625919 (code B ref 51320); Thu, 21 Oct 2021 17:06:02 +0000 Original-Received: (at 51320) by debbugs.gnu.org; 21 Oct 2021 17:05:56 +0000 Original-Received: from localhost ([127.0.0.1]:58440 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdbVs-0006jz-Ak for submit@debbugs.gnu.org; Thu, 21 Oct 2021 13:05:56 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:59268) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mdbVr-0006jo-Gq for 51320@debbugs.gnu.org; Thu, 21 Oct 2021 13:05:55 -0400 Original-Received: from fencepost.gnu.org ([209.51.188.10]:34450) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mdbVl-0004Ll-Tz; Thu, 21 Oct 2021 13:05:50 -0400 Original-Received: from [87.69.77.57] (port=1136 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mdbMm-0006Wh-BT; Thu, 21 Oct 2021 12:56:32 -0400 In-Reply-To: <87a6j2pnmw.fsf@aquinas.rewrittenlocator.xyz> (message from Richard Lawrence on Thu, 21 Oct 2021 14:29:11 +0200) 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:217783 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. 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.