From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: [External] : interactive to do `use-region-p' Date: Sun, 6 Nov 2022 15:41:08 +0000 Message-ID: References: <87o7tkci2t.fsf@dataswamp.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30553"; mail-complaints-to="usenet@ciao.gmane.io" To: Emanuel Berg , "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 06 16:42:01 2022 Return-path: Envelope-to: geh-help-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 1orhma-0007hL-4M for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 06 Nov 2022 16:42:00 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1orhly-0006sc-4o; Sun, 06 Nov 2022 10:41:22 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orhlw-0006sN-Ov for help-gnu-emacs@gnu.org; Sun, 06 Nov 2022 10:41:20 -0500 Original-Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orhlu-00028v-5x for help-gnu-emacs@gnu.org; Sun, 06 Nov 2022 10:41:20 -0500 Original-Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 2A6Aah4s018896; Sun, 6 Nov 2022 15:41:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=corp-2022-7-12; bh=lkDuInqna/DUdZ7RJINO+l66IJCHgYaWnsNtuErcklE=; b=gBNL5x+ijHHl8+frHzCm2vA1TMChudYfljui/gMYGH+UxTmuzhP4K7wtKW6HvyNeQ+yF muEYrrpSeqssqs3m/cj9GWdQXG/PkHwYIRzcwWoozPcEcGB64sVrBswFILbJgCBeuTgM PWNIVWU/QPhxIo6JYFbCHKg2U01ENx4y/8BcG6dHZQAJrOMggxkiIqWm70TgYBgHkfmv AAYjMGYTG7nmT8Dy3qKK/iTtT0qT61rBaJab9RXlN7tv+kilN/4ogigs/eP0bWEkx2Ax hXmRMMjeZVC1P+eqS9C3bFExqEJs5txNKxwQWcEHmZcjHt6dlYidOr5oEzuWeQU90jRg ZQ== Original-Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3kngkfsvpr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 06 Nov 2022 15:41:12 +0000 Original-Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.5/8.17.1.5) with ESMTP id 2A6CGNMe024948; Sun, 6 Nov 2022 15:41:10 GMT Original-Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2105.outbound.protection.outlook.com [104.47.58.105]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3kpcsbjgyc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sun, 06 Nov 2022 15:41:10 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H/RAq1jmkBRdhBZOgPfPOXmEFIp2oqDQLyzy03t7gTvn+QWySsa+xzRMAES6lnxTW9Hyvgb9ZRQZpczSBk8OuK/v3zfSYgwM+y0eLu1CYgs0nZ8WKSup45dDXsjWclGgXJhuFQnQtZe2x3ml9cOO3JCE0PAjC4uylI76gjeJa5if0svnFLOv+4Gmf5nYcSiXG9IBmFuPvnygjyK3HVtW9ape+pAzSmx/xawUGw2h822LAbFulDatSmEYWbglfHREu+oiGF1H4l9+CGrQRpywahs58a7bb211gTsLYrSMSIEI1s/Xy1sFHy2QgfJiP0RYHn2aeYO1TJwb+SiFQ9eZXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=lkDuInqna/DUdZ7RJINO+l66IJCHgYaWnsNtuErcklE=; b=ku1kLI5JwWvC0OIHDkssg91MRHcgOHW/Y0Aa4AtQ/gBrx3PeBh6nWo10J1OYvkpVSztGV7pAH1VWFYQWlvbMGxPVVVFX/v1qSfezPo0WD0jm4VpLbTpSOjC9/QKWk68ZN8gvnU/FpcDyLKaMiS/8fXmkXKbkMo0hHqwwmssQcL4NT8/hGGukDOCYJ5KaINHFfQ2h2e9gC1CbuIFRu30IhQS1AvjxSZzzjjN7IXnj/9WuEMELRMN0YOKeKyZktRQs06kHyj9C7TCONk87OmtPois6lhV9O70vpWxQU+EhfahQ83Duv0QlYwBC+i0/L/u7DQiS62VhvFEH4nJe10iM3A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lkDuInqna/DUdZ7RJINO+l66IJCHgYaWnsNtuErcklE=; b=Am0msegdRUrmirwtPbLH5lQHT0SCNvZj+FB51NrNZiHaRM6Ppr+cSulB6ED+U/9kfNsBa/678m+B5Z0zuexVFnY65Smeuxs+vuCCAExJl2bFinly2HO+DM/1xP1S2jDRLNWlz2PGF56xnUxjVdlWGaEd2wja2/zzql6J0ZDAjIY= Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19) by CO1PR10MB4626.namprd10.prod.outlook.com (2603:10b6:303:9f::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5791.25; Sun, 6 Nov 2022 15:41:08 +0000 Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::6951:297b:f3d5:2588]) by SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::6951:297b:f3d5:2588%9]) with mapi id 15.20.5791.025; Sun, 6 Nov 2022 15:41:08 +0000 Thread-Topic: [External] : interactive to do `use-region-p' Thread-Index: AQHY8exuLSuUUmQcb0S2Esgt7Vaphq4yA4SQ In-Reply-To: <87o7tkci2t.fsf@dataswamp.org> Accept-Language: en-US Content-Language: en-US x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ0PR10MB5488:EE_|CO1PR10MB4626:EE_ x-ms-office365-filtering-correlation-id: c6694e3f-81fa-478c-7f1e-08dac00d52f5 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 1zMRmqERASsdsZQsChj7w0XSblSeNAP8D+eoSUaXp/D0PWDdh4fOuQ4nOGrPTiqIstF1lSGVMUp0VNItJw1P3b/g4LxQfvk8FcOJoPHcezol3ZrwccljUv0I0CE3VUj0lzX+VZaXfp8VeVRY6HC2B8BqMtzUWDsnVVazO5IwZ3Y1XEkXv29jbl169A8t0NcGIKjm1b/SS25KvPha+M8BcO88syn8di1UO+S/rgpymDFkp4ttv49L6KIOcBd2UL4moVkl5YI5jnCvtZXztptUlmVmZ086pjG8XtHtCqA7yrcOZlmZEOtUsGMsAd2bcvXu6i8cua3jCl37XOFlM27y1ooqn0gCCdwGbuabAFjL33Aw6acdtzL/KZaWqGWCBda1NNjSVL26S24cmgQnSiw07+7Ib7fyKxO8vv6ksR9qxcjmQIjsqVuqBjuGT5IXlUJqANkg79+9jOw/Xppcax2s4gfU9byPNtWQP5rXViVTeDadvBqJMVx1cm3XAiR7lPjm6nst8Gp8r1ARhr//NYrItS+tSHRVjJAtzm4aEAEA2zDW+JHj9gGPOgv5ZDx2xUWTDY+RQNS3LvHHY4Nab/44g1SOOkB+Y/RLFgpTvvn+QnQDyBMDX5LWXevHGJu+WyC+zQ2tQMidWm671pJJRU4LZaUBdn2aIxxWCQ1IvNKJyAviD2/ZYHTyF5SdJRr0JBlmcrCpUGOni2PgqQEShvuOj+0M2e962ZfYgSzyUnBBRSmVOdYmoA6SVpTxPfE0l KYV+feWrTavWeu/XttFRCrwWMU9aERndeMIujO3cnkq6LU= x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:SJ0PR10MB5488.namprd10.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230022)(39860400002)(366004)(136003)(346002)(376002)(396003)(451199015)(66556008)(66946007)(66446008)(66476007)(76116006)(55016003)(71200400001)(64756008)(8676002)(110136005)(38100700002)(122000001)(5660300002)(316002)(33656002)(52536014)(41300700001)(2906002)(44832011)(4744005)(7696005)(8936002)(6506007)(186003)(83380400001)(9686003)(26005)(478600001)(86362001)(38070700005)(81973001); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?KmpoCCuCifERh/8xhLV/gKvnCnEDbcF2xMq4qrHOmp50rX9PL6me9yHdPjX6?= =?us-ascii?Q?VdZo9YW4C+IGyC8MXJvrqvYFjRLefAi7C1lFHSEYNcuKJjPx99JIeiNzR73y?= =?us-ascii?Q?WOEpzsgYEAQfPDe5H0KvPYz/58iVgUH+9nnKutQC3su8hcjNO0bd44LhVu2Z?= =?us-ascii?Q?UD+BJ2R/WwP/lC3ke2/qL/39DTnajFpfKMbAfpDaSrlthyKfSt4bweEBFJbQ?= =?us-ascii?Q?XlkYV4XILspjPi6rr0LVrTQLU6Zc3kfaJin1iAF6/CPF97S5ogvW+DpFy2cl?= =?us-ascii?Q?TjXUFGopMaINXE/LEEuWGhqkZEI0tkauMyPUPc4JWapF6j4++KL2hc0siDbR?= =?us-ascii?Q?i1G+hvPL4B4zt5YkYz6atZGN1+obi+Kt8WTBTs8Go29bATMAoYTXbr/P3Q4R?= =?us-ascii?Q?eP2biKhSDHov4tyDdu3fvGJiKeyRVT+TvsA7LwbL3uj1rkWzHemgnYdsPapE?= =?us-ascii?Q?isU8FS5zS9BjoWxMJsIJ/93nbE2P+Qku2y2rhlib4ovvzb8LFQCLOSwzIKZw?= =?us-ascii?Q?cSXXqy37ZsxxfB+l4gZ8bnOO5WHEyc1AzjrSiImZwSomWmEQKYTMGfludybt?= =?us-ascii?Q?kscG9fq/jJqvnn6imRRgjvSlmqfhYDC0YjBfLva44XHFJJ4Z2m9EQztSNtAI?= =?us-ascii?Q?ms X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5488.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c6694e3f-81fa-478c-7f1e-08dac00d52f5 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Nov 2022 15:41:08.4806 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: izoiossX6kFwH6zJqB5dpea+1LVuhqnY1tAmJyD4YcrdVXG8ePkAcEorWsEJLN/uH13efhOWa1LVM1yL46klyg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO1PR10MB4626 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-11-06_09,2022-11-03_01,2022-06-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 mlxscore=0 spamscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 bulkscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2210170000 definitions=main-2211060143 X-Proofpoint-ORIG-GUID: YKDoQ0bCjqyIZ2lBeg9WvBGZgid6lX8r X-Proofpoint-GUID: YKDoQ0bCjqyIZ2lBeg9WvBGZgid6lX8r Received-SPF: pass client-ip=205.220.165.32; envelope-from=drew.adams@oracle.com; helo=mx0a-00069f02.pphosted.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "help-gnu-emacs" Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:140738 Archived-At: > This is a common situation (the first three lines of the code > below) and possible area of integration, because there is > already a lowercase "r" you can send to `interactive', however > that doesn't do `use-region-p', maybe we could have an > uppercase "R" that sent (nil nil) unless use-region-p, and > otherwise behaved like "r", i.e. sent the region to beg > and end? `M-x report-emacs-bug' is also for enhancement requests. ___ But instead of (nil nil) you might prefer `(,(point-min) ,(point-max)). This use case: (interactive (let* ((regp (use-region-p)) (st (if regp (region-beginning) (point-min))) (en (if regp (region-end) (point-max)))) (list st en))) And then there are the cases where you want to ignore the value of `use-empty-active-region' (i.e., use `region-active-p' instead of `use-region-p'). `interactive' with string arg is OK, but often isn't TRT. It can sometimes be clearer to just define a function that does what you want, and use that with (interactive `(,@(DTRT))).