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.devel Subject: RE: [External] : Re: Use of advice [was: Is it valid to call isearch-filter-predicate outside isearch?] Date: Wed, 7 Jun 2023 14:44:33 +0000 Message-ID: References: <87edmo17v7.fsf@web.de> <87ttvkoue6.fsf@web.de> 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="16303"; mail-complaints-to="usenet@ciao.gmane.io" To: Michael Heerdegen , "emacs-devel@gnu.org" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jun 07 16:45:32 2023 Return-path: Envelope-to: ged-emacs-devel@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 1q6uPk-0003yc-HW for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Jun 2023 16:45:32 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q6uOu-0005n8-TB; Wed, 07 Jun 2023 10:44:40 -0400 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 1q6uOu-0005mz-5r for emacs-devel@gnu.org; Wed, 07 Jun 2023 10:44:40 -0400 Original-Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q6uOs-0007VK-Bi for emacs-devel@gnu.org; Wed, 07 Jun 2023 10:44:39 -0400 Original-Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 357EZVd7008091; Wed, 7 Jun 2023 14:44:37 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-2023-03-30; bh=YJLw50/HVukKFqJ2tUB9Eyu8Hbm0Hf1HETDodVZ21Ic=; b=A80zjqE83cSQS0ZrG01MRBt6zEKOpQl4chk+R2BZINuVz9DLNfy3NqBd4gMFgCyTng5N xrjKQQppt2ZtM5NYRCb6F8dhgvu+owYq2nslXNOVjG7eKw0px+YI0xqGo9uB4JNzh9tr Wc9ImZI9oWzYrTe6mZv1dz6q2NVTuj4hFQaHFx1HE0JGurg2tCnBAren5EUyNnKygNIV 5/jj83U+0RyD6f8ZmUmjP00LM+r4MlI7q4jO3xra3cpLAWmG8LD46GTaab09r6i6PPuc UnX3HS48Q/Q3AuZ0EAdGxLiT4zvFJL97p+7aBgMG0j86ZH3h1fDA/WS1Hq8zN2hWOcp9 RA== Original-Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3r2a6rhy3j-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 07 Jun 2023 14:44:37 +0000 Original-Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 357DoE4H036628; Wed, 7 Jun 2023 14:44:36 GMT Original-Received: from nam12-dm6-obe.outbound.protection.outlook.com (mail-dm6nam12lp2174.outbound.protection.outlook.com [104.47.59.174]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 3r2a6jubv1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 07 Jun 2023 14:44:36 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RCm0QYY+2Srd5EHz8h7byXUjZd9cUtR1XNJ7I3tBS3ymJGXlLd2F4pIXh6rGx+Ss+nTV46kYsvoxZfDVz9hHVcKa/JMrLHHjcEREH+y4qmn/XyusQiv1yYaSypoJ5S2FCvD5J3SfuYoWibzKnm6jUFztG7b+pJ4hR0gu8zhkrR0TtXR8gZBBuIaZNQLBpkqmxDw52bFQ+Y07qnjZYAtfKZhti3lFibxXMc8ZLMV932zuYcWwHNCdh948XrNe9IRnkQv1WZ3phL3B0+J690oE+bGbSLtcpgot6YNt1WhSVKZJhC1YLtpKKLT3U8uXzDpw7l1rvv+O280Aixo0oZCOZw== 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=YJLw50/HVukKFqJ2tUB9Eyu8Hbm0Hf1HETDodVZ21Ic=; b=BjaCYDCkqmlTQuDlzjWQcQt+5gVhAJB5GmPZ7eTmteYJaImMGLUa70hIc2JweZjibdCXbfzTRuNXceHdvvvV6lTvpqBEiDGY+E60cZmQ4ozCEMmc4FKVZXhQm2k65PKZqrsS2MV6Tb9EEHd746b1jwFhPRRKA/mLKYo2Qb9J0gGU9N/Up7ZbT/xZ0uH7UoLA+S6RF+hYuGXIl9HsEMIIuqEbq0s1Suc5yyE1CaJyoG7NVDtBJGm8aIfRjY6mrCyzF98VE3/NdmTL/iTf3HxG2pibCFTfSoQNocdgqwaRQwXmFv9QIZBEt4fDqR/DuFmUnFeVPIChy066DZmduMLWtQ== 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=YJLw50/HVukKFqJ2tUB9Eyu8Hbm0Hf1HETDodVZ21Ic=; b=I8LYb0KGCVBcM+WFodMirwrj5IaCvDu4DVjL8FJWlOpme0hIFQLWS4el0YkwUdAvt2i3UJPvdrVbIGqndpbIVoL/q+JKJg1vRNMNL6cyo66Ux/ed7mBUFwIvTA7unh8ggnaRBjcL1xWszcQ//Nr3v4tFeGGUoeDlLU/OtwVEwI0= Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com (2603:10b6:a03:37e::19) by IA1PR10MB7446.namprd10.prod.outlook.com (2603:10b6:208:447::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6455.32; Wed, 7 Jun 2023 14:44:33 +0000 Original-Received: from SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::a995:2ae5:2745:24ff]) by SJ0PR10MB5488.namprd10.prod.outlook.com ([fe80::a995:2ae5:2745:24ff%6]) with mapi id 15.20.6455.030; Wed, 7 Jun 2023 14:44:33 +0000 Thread-Topic: [External] : Re: Use of advice [was: Is it valid to call isearch-filter-predicate outside isearch?] Thread-Index: AQHZmOtYqkvtFvqv20+t6ARMxrCrCq9/YVRw In-Reply-To: <87ttvkoue6.fsf@web.de> Accept-Language: en-US Content-Language: en-US x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SJ0PR10MB5488:EE_|IA1PR10MB7446:EE_ x-ms-office365-filtering-correlation-id: fb69b386-9ddc-4acb-1555-08db6765b550 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: eYSziaCkq6UcOsjOOukE/REIQJoQqqNQ7K5GstGG1SrQtec2a/0lgV1cuvTZe96FJCx837q6NRILPh/ejQsFJ3vmCfT91Y+tIfsdxnSQbSs4n+e4oxHJNOGm41fjjNedvuSDhm5RL2qbBBgEp9icQ67tNP62jwegfseV54cgD1CguKDGpBE0ipIHzFKpl+6UeiY95TqGsQ1P6jP7LBhrd+9EnTzW4eG7qhHOz54n14TUI5FzBDoNpbObZdEYHDXMbkrD3ho1jM2CnVumy0H1vV5fPIukyzFuRBozK+jBAnFftmfNnXo2vOnes2voQCk22l84qTC06w+ydd5tafgDLagAdq4CE6e9IGqcOImEhJH3O7GbHNLGfGMh2oiFU8HHwbWJOZe0+WOlplZ4tdI2Yw4MAOfgW97Kq2nG6xmEAnNKZpM9i2XNk3TyeHfvwj1xLqABenqrm9smcqVcpBz1ytEcTKu2rfP4Mc26hXaXQ0oIDxwyd8NxvjsjEgEvM6t/gMGlZA2GwfTQN0NGwLW4FrPavqnvieUlU4CA6UZXCUVDG8vySuM8snCnHcgUcbM3ncYICSLcF+DRL4lksS76S+F7tMwKzYbhdMOS579dbSc= 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:(13230028)(39860400002)(136003)(396003)(346002)(376002)(366004)(451199021)(7696005)(38070700005)(966005)(71200400001)(9686003)(26005)(6506007)(33656002)(186003)(86362001)(55016003)(38100700002)(122000001)(44832011)(110136005)(5660300002)(52536014)(316002)(41300700001)(66446008)(8936002)(66556008)(66946007)(76116006)(64756008)(66476007)(478600001)(8676002)(2906002); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?0C1fj/xGPYWLGF3q9zSrvxJyJtK/v37pOzMrmnjXwSQKGTyEEpWRLUlWC9B6?= =?us-ascii?Q?wrHsAix6cYIOgAGz7/MUHXJfKLvOfRgtKnwrQee0SVGWp/V/I+JY/TGewnAa?= =?us-ascii?Q?t48Kb44GnLdhtSvzibplqcoSK3RYagD8eXs2ITAi5p99A273hbmCGBJT7Xg6?= =?us-ascii?Q?uE8qLd5sP00xtb1eEdjGAqXaqPGcZIlQmJQeYKx31kIlTsEo6PBORc/2H5eN?= =?us-ascii?Q?dj6aes3CNdpykoIMipOY6M3PtLIyuq4e7rImqjh4FuPWaLpfUEyEqt/zlUzN?= =?us-ascii?Q?yZ7KwBksmX3UdML+J8DwGqgaDsjf/98zyjIvz0QBR4IEtE9iR7UqA3T3YKuf?= =?us-ascii?Q?jW6HHmttYeYTD+5p9nvMeWnaLA8DmaeLBCgdbEvtxidEVSAIi4ANBWcy1VKS?= =?us-ascii?Q?KqKrG66ml/153dyPl7hS4nPrBalwXz2yrBL9ErIqxOU0jo61OjEmasJdVZbF?= =?us-ascii?Q?4jgNsE31uSBBbkei4AiMDehdU/hVGs4Oz28UxBDatMzUynozWNgSVhXnCxEB?= =?us-ascii?Q?rOxlYOR1Ywv2umKfptO2jFy5yZ0uytVc2E/ypG7Ah9yFb7xqlwUMYqu63W/N?= =?us-ascii?Q?YSji1ihA/X8GYMP1tlJlp/ET2nVW5zYGRxxg1Gp76MNOg5r2+9TR6yykEVH4?= =?us-ascii?Q?gN X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: BfFThnzxHbu+rGbNCjcdCiigeYVWGT4orPSi8HVj/NPbS3ucmKmuViW69FBuCbbbHBXIb+XrO44PJ4BH8oyckUymc8L1xE51a5krwLffmelR9ws9pKpOaVZuj+jCFk6d0m8/oim8DcB9Ui9VcPEBbdFRxTHCjM3vGh6lHfL1qv9UUROAF91RjTy460PpiGS1Mhhbv5VsY/RlGaMfZGLOtLKqNOc86G6LiuDBmTyKYwEwwQi038J/tz22mJAFgGSFuP0zJloongsTe5TSBliitr8BDkgPL5HmVzwvysv1F3ipaeTvdy5ySgrEQXzBDzDn1VTVBBRupLet6xTQFNJ+6Of6MV1du6kHanC3qBR+YeWHi3KAEH99VoFrcl5KMUvY99eKcISUbKm2DYiIjs70qIWlgSTNXBlIDT6DU+MQ2Zci1o5igMnXdiaT36sWRKkB2H2YyAf+5WLU2IWiVJO8RqX/a1SJlZpFRefyQ8W5FxZoiZ2X5cV/QG5k/n7vcBa1aazR366SXG7VWYQ0aEpcf/uYJPMuHjQVrbwySjOXzWWEoVeUN2wKRQeaZvpczjk8Q7Y+m9WdTWHd51d8gHgs3MWqpAvJQg9OcXVV5jtlgAuD2b1V5N0gllDmIGibABz5fyyrftkMvcJAuEI0h2b9PfPICshIrkMX7I/v/T+IRgkEM5hRKxlkXdo8OMFlPN+9xbZSshf5NDpdzY6MNIO6MGd0A+/AAlvFuuMEgMUUIqr959 c2ZgfsxCEg+GBCahns 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: fb69b386-9ddc-4acb-1555-08db6765b550 X-MS-Exchange-CrossTenant-originalarrivaltime: 07 Jun 2023 14:44:33.4315 (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: JJnDNqQumEFsUq+BZuMqpfDbSqD22rna+HVrGKCptLUxrBf04yJYzPOKjcUGFgVqzcPEWYrCgZWMjwmy4QTuhQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB7446 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.573,FMLib:17.11.176.26 definitions=2023-06-07_07,2023-06-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 suspectscore=0 mlxscore=0 adultscore=0 mlxlogscore=892 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306070125 X-Proofpoint-ORIG-GUID: cdR8MOLNDWp2-5GtN6jDNM26kRL8Jy9M X-Proofpoint-GUID: cdR8MOLNDWp2-5GtN6jDNM26kRL8Jy9M Received-SPF: pass client-ip=205.220.177.32; envelope-from=drew.adams@oracle.com; helo=mx0b-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_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:306684 Archived-At: > > > Dunno if it would be worth it that variables which are > > > considered to be modified by advising should have a > > > special suffix (like "-hook" for hooks). Or maybe we > > > already more or less have it: "...-function". > > > `setq'ing such variables in the Emacs sources is > > > probably not user friendly. > > > > I guess you're talking about a variable that's > > expected to be used a bit like a hook. > > > > That's the case, BTW, for variables such as > > `isearch-filter-predicate'. (OK, it uses suffix > > `-predicate' instead of `-function' or `-hook'. > > But the idea's the same.) >=20 > Yes, we have a few. But `-predicate' is irrelevant > for naming - not all such places will be predicate > functions. And you can't tell from the name that > the variable should be advised and not set. Are you talking about an advice name or the name of a predicate-valued variable? For the latter, we could adopt suffix `-predicate' conventionally. A predicate in Lisp is a Boolean function. (It's not just a Boolean value.) However, just as with other functions, predicates can have different signatures. So that suffix would correspond to an "abnormal" hook, i.e., one whose value could accept args. ____ I'll also pointed out that predicates are _particularly_ useful use cases for advice, as the ways you can combine the advice include the usual logical combinations (AND, OR, NOT). IOW, knowing that the function being advised, as well as the intended result of advising, are to be _predicates_ means you can use such general logical combinations as ways of advising them. That's what my Isearch dynamic filtering code does: it lets you combine predicates easily (interactively) using AND, OR, and NOT, among other possibilities. And there are two versions of ORing and complementing: 1. Just add a predicate, ORing/complementing the current predicate. 2. Replace the last-added predicate (advice) by its disjunction with a new predicate or by its complement. https://www.emacswiki.org/emacs/DynamicIsearchFiltering#FilteringCommandsAv= ailableDuringSearch Advising an arbitrary function doesn't allow such combining possibilities. But at least you still have some other general operations: add advice, remove advice, replace advice, list/show/describe current advice, save current advised definition (to reuse later), keep or not for subsequent commands, reset to original predicate.