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#66908: Exposing more public nadvice API Date: Sat, 04 Nov 2023 08:18:59 +0530 Message-ID: <875y2ifd2c.fsf@gmail.com> References: <878r7fw802.fsf@posteo.net> <87msvufz8n.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="22988"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Philip Kaludercic , 66908@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 04 03:49:49 2023 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 1qz6jN-0005qX-Dn for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Nov 2023 03:49:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qz6j4-0003Rm-0X; Fri, 03 Nov 2023 22:49:30 -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 1qz6j1-0003RU-P2 for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2023 22:49:27 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qz6j0-0007Ha-Id for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2023 22:49:27 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qz6ja-0006nd-8l for bug-gnu-emacs@gnu.org; Fri, 03 Nov 2023 22:50:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Visuwesh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Nov 2023 02:50:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66908 X-GNU-PR-Package: emacs Original-Received: via spool by 66908-submit@debbugs.gnu.org id=B66908.169906618626102 (code B ref 66908); Sat, 04 Nov 2023 02:50:02 +0000 Original-Received: (at 66908) by debbugs.gnu.org; 4 Nov 2023 02:49:46 +0000 Original-Received: from localhost ([127.0.0.1]:60166 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qz6jK-0006mv-Fa for submit@debbugs.gnu.org; Fri, 03 Nov 2023 22:49:46 -0400 Original-Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:55691) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qz6jJ-0006mL-04 for 66908@debbugs.gnu.org; Fri, 03 Nov 2023 22:49:45 -0400 Original-Received: by mail-pf1-x444.google.com with SMTP id d2e1a72fcca58-6bd32d1a040so2894154b3a.3 for <66908@debbugs.gnu.org>; Fri, 03 Nov 2023 19:49:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1699066143; x=1699670943; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=joXp6oIe0lnx1FFYt9M6IoMF2fKMufK6G9yzdRHTUbw=; b=Sq7pR+luSy5twz/ez7+tmS4ANeTNUDBWULa9w9osLpfnzggUjMn8ZiquSnwH//tBE4 c7Ixbrq9Kop8dicuA2+Wwg1D0sFD4g2yq4vgApDgMogU5RUP2Usd3CsGmv2cIaTRmfuu HHzQEQDKhQylKhH/Eto4l9idgR19236ECIVPQ9VMFv+tnbPOyIgXQffPzerzvZgDMyD/ ljtEQruROukYTZQ3BgCZrzjBdk3iuV7wjuRHAUjSQfGYOEYRunLpcV+UgnEW0AiBdmcr QanlaAhalooeTUYXNgss8RjvfMpBhQRhJOF9a0WXWJKstKh54Tc3fuYMqP6MuCxFUs2V cqwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699066143; x=1699670943; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=joXp6oIe0lnx1FFYt9M6IoMF2fKMufK6G9yzdRHTUbw=; b=I9M3WCFhEngUC02iuV1AkpxnBce0MSz7uY9vRGK10FBjch+KLXsuqX8ZLU1xdLWCe4 qSlVrjuBaPMdSN5h9gHP4eyZPFSj+xHj38AA31O2o9IYFEe1UYl3+ZnQAwCOq4yv4gbN gvR3x8p/qtBEZ/rTJTxkTSvs91CHsllmR98rB+f8npoTkyf8SC8pyH7Mt/Is0lBj4NWJ ikDbYRoEkpsk1fKxX961tzJmG7NdtO2N0yuhXS44n/nbrLbCCtSC35RSz0abIDeXV8v3 1UyRgyOXT3bT6ZQHprbJbFC5RigmWIRm612fnpzDzd1ttPZPBOsrE+HxdN8M6EZzSptV iuVw== X-Gm-Message-State: AOJu0Ywml980sE/t31W6B58cvVwCBLV0QKsrrkO9xGpBaNURBuC+MkWx MhI7iNFV5PL0aXiJ8Exh1G0= X-Google-Smtp-Source: AGHT+IFkpBDmGVIvFbMuGMLs1/ywD8Ilha0n4VIELzsIhEXVHmcrz2iX+b1US9k+FFCg2CZVD899CQ== X-Received: by 2002:a05:6a20:8f1c:b0:153:63b9:8bf9 with SMTP id b28-20020a056a208f1c00b0015363b98bf9mr28472477pzk.0.1699066142855; Fri, 03 Nov 2023 19:49:02 -0700 (PDT) Original-Received: from localhost ([115.240.90.130]) by smtp.gmail.com with ESMTPSA id j16-20020a056a00175000b006933b69f7afsm2041994pfc.42.2023.11.03.19.49.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Nov 2023 19:49:02 -0700 (PDT) In-Reply-To: (Stefan Monnier's message of "Fri, 03 Nov 2023 18:05:40 -0400") 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:273739 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 03, 2023] Stefan Monnier wrot= e: >>> It's clearly the internal function most frequently used outside of >>> `nadvice.el`, indeed. >>> I think it'd be OK to promote that function to a non-internal name. >> It would be nice if you could since it would also provide some guarantee >> of it being a fairly stable interface. > > Could you describe the circumstance where you need it? We need to get the func-arity of the original function and not its advice. I have xref-find-definitions adviced but (func-arity 'xref-find-definitions);; =E2=87=92 (0 . many) returns the func-arity of the advice meanwhile, what we are really interested in is the func-arity of xref-find-definitions as shown in the *Help* buffer i.e., (func-arity (advice--cd*r (indirect-function 'xref-find-definitions))) = ;; =E2=87=92 (1 . 1) which is the right return value. It might be nice to not have to call `indirect-function' here for the "global" function but you can be a better judge of that. >> The other function that I saw get usage outside of nadvice and bytecomp >> was advice--symbol-function. Should we use its return value, or is >> indirect-function's return value good enough for advice--cd*r? IIRC, >> help-function-arglist uses indirect-function and it also works for our >> use case. > > I don't think `advice--symbol-function` is a good candidate because its > semantics is not very clearly defined. E.g. I'd be hard pressed to give > a comprehensible documentation of it without either being too vague, > or promising things I can't always provide, or getting too much into the > the nitty gritty details of the various possible situations. > That's why I haven't promoted the comment in its body > to an actual docstring :-( > > Most callers are in only one of the many different situations, in which > case they usually don't need that functionality. In our case, the functions that will be checked for its arity should be defined at the time of func-arity call. Or at least auto-loaded AFAIU. Philip can correct me if I'm wrong.