From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Visuwesh Newsgroups: gmane.emacs.bugs Subject: bug#59379: 29.0.50; `define-advice' documentation needs improving Date: Sat, 19 Nov 2022 17:53:20 +0530 Message-ID: <877czrb0av.fsf@gmail.com> References: 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="14560"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 59379@debbugs.gnu.org, Stefan Monnier To: Stefan Kangas Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 19 13:24:10 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 1owMtG-0003fC-2I for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Nov 2022 13:24:10 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1owMt9-00042U-QL; Sat, 19 Nov 2022 07:24:03 -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 1owMt8-000426-K7 for bug-gnu-emacs@gnu.org; Sat, 19 Nov 2022 07:24:02 -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 1owMt8-0005cc-Be for bug-gnu-emacs@gnu.org; Sat, 19 Nov 2022 07:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1owMt8-0001ly-6O for bug-gnu-emacs@gnu.org; Sat, 19 Nov 2022 07:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Nov 2022 12:24:02 +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.16688606146777 (code B ref 59379); Sat, 19 Nov 2022 12:24:02 +0000 Original-Received: (at 59379) by debbugs.gnu.org; 19 Nov 2022 12:23:34 +0000 Original-Received: from localhost ([127.0.0.1]:39202 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1owMsg-0001lE-Gd for submit@debbugs.gnu.org; Sat, 19 Nov 2022 07:23:34 -0500 Original-Received: from mail-pl1-f194.google.com ([209.85.214.194]:40750) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1owMsc-0001kz-Q4 for 59379@debbugs.gnu.org; Sat, 19 Nov 2022 07:23:34 -0500 Original-Received: by mail-pl1-f194.google.com with SMTP id p21so6786038plr.7 for <59379@debbugs.gnu.org>; Sat, 19 Nov 2022 04:23:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pSs9u+UD4mzitQP7jCyxlMhSOWk/2GJh/FDgDAt2oSw=; b=KbC4mHmOaYpcKiEhSuqmstS0nDblsvBh8qZIVO2i98mBrkzInRFhLNFEYqvZvNGtS8 02wZH2w0CUbWFQwEOpwWWV8CDSO+m/m2FjRpj0YNk0yLhpjM1hm/yUgTWw1tEL/Ln7W+ ZiAG2cA+Yxg7OZqSYMBtg+6PexMi9ztXWcFzX2g4pocWifdHn9Oe3C8Goembkf2EdOmz NAkQ1y/vHWz889kdmp7z0NK6VY+4PMhAdbXf2UjuCQZjHDVxIql7OfLa7sMx44sOLBev xww5Oger67kBzPtWrNxEfC4/BcFqqpkSZM2GBhq4728CVGz6Jjx6BA7EtWawMzvUfO4s s2LQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:user-agent :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=pSs9u+UD4mzitQP7jCyxlMhSOWk/2GJh/FDgDAt2oSw=; b=x9Pye3CnvXVFuCsOTbnvgPkRAyYfYIIWjt78RBsXqQQntdnd077bupSX4gudlZOX0P EiieXLIpsaFEuoKRustWRk1VlZath5RuPcEPtv3R1VuTzRc93lEmRwxGDmTgOLDBZp9x io2mxWW0baF3qDTWoKrQJ+5CTK6iu9lh6+ZwSKkBWFrBgfsJ4ZF1+DIhmCp2ION0Wh+X vZztsjdEyPvWnmeIxIvoWgreXPVv8pbsE35IkTHK+DvLYGVEqiqG+B4NJhVquN3z6rUD ft8mSP/oCaweC8Kv/w6LADYDwBL3oeoVQBGkoG4s0kp+k2OVECgBsow27ZQnRRAO5cPM 3Jig== X-Gm-Message-State: ANoB5pl46vNIzQcKQeqTZShhqW65Yiw+yMMXLD518FvgCbgcc7doltbD nbRikWwjmGWQZflWJ0lcJZ0= X-Google-Smtp-Source: AA0mqf7Qu5NHEpOiWZ0s4zRPKylGPRZApailW8YSlY0duldDwgc/fmByrgxvv1a5Go7XZc7ct6yZqg== X-Received: by 2002:a17:90b:394a:b0:210:4438:2d40 with SMTP id oe10-20020a17090b394a00b0021044382d40mr18066865pjb.196.1668860604878; Sat, 19 Nov 2022 04:23:24 -0800 (PST) Original-Received: from localhost ([118.185.152.162]) by smtp.gmail.com with ESMTPSA id o31-20020a635d5f000000b004769f0fd385sm4299823pgm.52.2022.11.19.04.23.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 19 Nov 2022 04:23:24 -0800 (PST) In-Reply-To: (Stefan Kangas's message of "Fri, 18 Nov 2022 23:26:00 -0800") 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:248333 Archived-At: [=E0=AE=B5=E0=AF=86=E0=AE=B3=E0=AF=8D=E0=AE=B3=E0=AE=BF =E0=AE=A8=E0=AE=B5= =E0=AE=AE=E0=AF=8D=E0=AE=AA=E0=AE=B0=E0=AF=8D 18, 2022] Stefan Kangas wrote: > This bug report is about the documentation of the `define-advice' macro. > > [...] > > 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. > 4. There also seem to be a mistake (or merely a typo) in the argument > list as described in the argument list (note that "HOW" above is > replaced with "where"): > > -- Macro: define-advice symbol (where lambda-list &optional name dept= h) > &rest body IIRC, Stefan prefers HOW over WHERE since add-function has :filter-args and friends. > 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, o= r a function named =E2=80=98symbol@name=E2=80=99. 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-L= IST BODY) ...) HTH.