From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Kangas Newsgroups: gmane.emacs.bugs Subject: bug#59379: 29.0.50; `define-advice' documentation needs improving Date: Sat, 19 Nov 2022 05:52:41 -0800 Message-ID: References: <877czrb0av.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29184"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 59379@debbugs.gnu.org, Stefan Monnier To: Visuwesh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 19 14:53:24 2022 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 1owOHb-0007SP-TR for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Nov 2022 14:53:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1owOHX-0008Nj-4B; Sat, 19 Nov 2022 08:53:19 -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 1owOHH-0008Iu-9K for bug-gnu-emacs@gnu.org; Sat, 19 Nov 2022 08:53:08 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1owOHG-0006nS-6d for bug-gnu-emacs@gnu.org; Sat, 19 Nov 2022 08:53:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1owOHF-0006CU-WD for bug-gnu-emacs@gnu.org; Sat, 19 Nov 2022 08:53:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Kangas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Nov 2022 13:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59379 X-GNU-PR-Package: emacs Original-Received: via spool by 59379-submit@debbugs.gnu.org id=B59379.166886597123817 (code B ref 59379); Sat, 19 Nov 2022 13:53:01 +0000 Original-Received: (at 59379) by debbugs.gnu.org; 19 Nov 2022 13:52:51 +0000 Original-Received: from localhost ([127.0.0.1]:39289 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1owOH5-0006C4-6n for submit@debbugs.gnu.org; Sat, 19 Nov 2022 08:52:51 -0500 Original-Received: from mail-ot1-f42.google.com ([209.85.210.42]:36701) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1owOH2-0006Br-7M for 59379@debbugs.gnu.org; Sat, 19 Nov 2022 08:52:50 -0500 Original-Received: by mail-ot1-f42.google.com with SMTP id l42-20020a9d1b2d000000b0066c6366fbc3so4745913otl.3 for <59379@debbugs.gnu.org>; Sat, 19 Nov 2022 05:52:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=yAP3M6bZrVR244Wira9upFJb0vtsyUfrapjbKfHoX70=; b=e9Slh5/RufCIRU1yKiabLBSjlXp5QkByYLD5odQHJZhEIDi8EnKatLceGNKzMAef/O gPzvhs8yc4QsYYCdSvy6MU00eMGwlMFLsRKrYNqdml5/G62j9/HSxiVl03d7ED5KC2xQ jBpjQThifRNHoveCiTWX1i9+W6zg7pppuH+UpKQG8KZSSl7DvqP8WSBZyyyx0n4FOtio 0sWbTCi0avaTgjxG65d/4waElilzT4xvj4Ix4vMf/mjduQNk6Pwz44yn4xODaGFVni80 Ibtw3k+0RnSsC7XGK4YTQF9Sf6LBP5DwUQHyb3Whwl30ZcRadE8PydMRBj8r3mTawStl KQ5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=yAP3M6bZrVR244Wira9upFJb0vtsyUfrapjbKfHoX70=; b=STS2nLQHPix9T+xlerZYASDXF/v70pW9raJi37D0dgjboP8NckECiL8Cxc2p8a/Ykh KaRS1hVdAz3ZSyyd72CcES9ruYOUuojNKF50lxF45vtBfgqGph67LJ95TeNCoH6ehtak x0zjXyDQUy6Yk7pVMZMU9abO4/NFN9lBqImp19HIOplzo0CNt2J8robAkXqZvj99CCFi gE3zkY3+KSGoRYKL9whpJKjWjjXpcteGYruWZx89XA1VavSmint91TOTfd3rUDHRh2wo OWcYq9CeHesDuZ0hWKb0GZf8PgXGJUu4V9UhKIHuNUQVm7/U5iGAaL5AurwDjmsuSNdd F3aQ== X-Gm-Message-State: ANoB5pmnLakLzJf7gwhFmRo8SknxkP/j5ov14/QUVeedX+G8TRustgQt Gv008O7/1GLmslW0TboGf5/uyXdrC2nsfQgcWtE= X-Google-Smtp-Source: AA0mqf6AAZ5Ws7gbFiHPFJWLoEBiRvJWkp+i2o0PQ1WK9IpC0hCyRUvMfUYGUn/qfEbPdiYGyNTeIRKwmfBPo3ozZtc= X-Received: by 2002:a9d:70cc:0:b0:66c:5232:b9d1 with SMTP id w12-20020a9d70cc000000b0066c5232b9d1mr5745652otj.224.1668865962471; Sat, 19 Nov 2022 05:52:42 -0800 (PST) Original-Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sat, 19 Nov 2022 05:52:41 -0800 In-Reply-To: <877czrb0av.fsf@gmail.com> X-Hashcash: 1:20:221119:59379@debbugs.gnu.org::o+76zGjZ8/QKKBaN:AXiI 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:248338 Archived-At: Visuwesh writes: >> 3. This is its argument list: >> >> (define-advice SYMBOL (HOW LAMBDA-LIST &optional NAME DEPTH) &rest >> BODY) >> >> The HOW, LAMBDA-LIST, NAME, DEPTH parameters are not documented in >> the docstring, nor in the info manual. > > HOW, LAMBDA-LIST, NAME, and DEPTH arguments become clear when once looks > up the add-function docstring, and the docstring already mentions > add-function. Then that should be explicitly stated. And LAMBDA-LIST is not explained there either, AFAICT. >> 5. The documentation of NAME says that: "The advice is an anonymous >> function if NAME is =E2=80=98nil=E2=80=99 or a function named =E2=80= =98symbol@name=E2=80=99." >> >> I struggle with parsing this sentence. It sounds like it is saying >> that, if I want an anonymous function, I should define a function >> named `symbol@name' (substituting `symbol' and `name') and then pass >> that argument as the NAME argument? But then the function is not >> anonymous? > > Would a comma help before the "or"? i.e., > > The advice is an anonymous function if NAME is =E2=80=98nil=E2=80=99,= or a function > named =E2=80=98symbol@name=E2=80=99. So it can be either nil or a symbol? How do I actually use it? > Changing symbol@name to SYMBOL@NAME like in the docstring will make it > clearer, I think. If still not clear, the following happens in the case > of NAME being nil vs. non-nil > > NAME nil =3D=3D> (advice-add SYMBOL HOW (lambda LAMBDA-LIST BODY) ...= ) > NAME non-nil =3D=3D> (advice-add SYMBOL HOW (defun SYMBOL@NAME LAMBDA= -LIST BODY) ...) This all needs to be explained clearly in the documentation.