From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions Date: Thu, 05 Jan 2023 17:10:20 +0200 Message-ID: <83pmbtvwyr.fsf@gnu.org> References: <87fscpifdw.fsf@localhost> <83wn61w7lc.fsf@gnu.org> <8dea9f3e0e7865d8f3c6@heytings.org> <83r0w9vzgy.fsf@gnu.org> <8dea9f3e0e8e6114ffc3@heytings.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5766"; mail-complaints-to="usenet@ciao.gmane.io" Cc: yantar92@posteo.net, 60568@debbugs.gnu.org, mardani29@yahoo.es To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 05 16:11:24 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 1pDRtr-0001L7-Lb for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Jan 2023 16:11:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDRtY-0001VA-Lg; Thu, 05 Jan 2023 10:11:04 -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 1pDRtW-0001Uo-VT for bug-gnu-emacs@gnu.org; Thu, 05 Jan 2023 10:11: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 1pDRtW-0002EH-Na for bug-gnu-emacs@gnu.org; Thu, 05 Jan 2023 10:11:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pDRtW-0003sD-Cm for bug-gnu-emacs@gnu.org; Thu, 05 Jan 2023 10:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Jan 2023 15:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60568 X-GNU-PR-Package: emacs Original-Received: via spool by 60568-submit@debbugs.gnu.org id=B60568.167293141314831 (code B ref 60568); Thu, 05 Jan 2023 15:11:02 +0000 Original-Received: (at 60568) by debbugs.gnu.org; 5 Jan 2023 15:10:13 +0000 Original-Received: from localhost ([127.0.0.1]:52553 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDRsi-0003r9-UO for submit@debbugs.gnu.org; Thu, 05 Jan 2023 10:10:13 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51306) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDRsh-0003qp-5r for 60568@debbugs.gnu.org; Thu, 05 Jan 2023 10:10:11 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDRsb-0001z8-Kk; Thu, 05 Jan 2023 10:10:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=bZesfiQAbkY7b5WBqWdlFHHLmbhTYXbtJwwcaxh2UUA=; b=CMIcHagrKTEm 9fBn1XpSlTKDQW+DHxhvVxIyHjk8ehuezO1eVZvKF/jelR0FS8hGEVAFy3E5K+BRmeg7hgovMt+es 3sVIQSoaiX5lhfail7v0yUSA5HECN19Rf+PxNbaITq4xDsfzpEF5jb7l3Lyodd6CLaIxLkDVm0iJM QDr3GEViRU4Lygf8d3HVXO0fciX6Sj9ZbfOLV7p9/6PuFmCV7Ipoqm+YG6pnUlHYiFPfGnirKWEEo /xrH95aIxbKIeGCoyu5TL8PaqKiZxYcVGplhKwnjLY6Xhf5dV6RKrI/4JW+8mNhnd7r01P7VGocTI l1LlMej65xwK1r0leICQ9g==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pDRsb-0006Ig-4z; Thu, 05 Jan 2023 10:10:05 -0500 In-Reply-To: <8dea9f3e0e8e6114ffc3@heytings.org> (message from Gregory Heytings on Thu, 05 Jan 2023 14:27:41 +0000) 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:252606 Archived-At: > Date: Thu, 05 Jan 2023 14:27:41 +0000 > From: Gregory Heytings > cc: mardani29@yahoo.es, yantar92@posteo.net, 60568@debbugs.gnu.org > > > >> What is missing in the five-line patch that does this? With the > >> recipe, the file in which org-babel-execute:sh was defined > >> (ob-shell.el) is opened, and the function definition is displayed. I > >> don't think we can do much better (e.g. reliably find the place where > >> the function was defined). > > > > Why not? A function definition usually has some specific keywords in > > it. It is true that someone could have obfuscated the code which > > generates a function to the degree that it would be infeasible to > > recognize, but we don't need to support such arbitrary measures, we only > > need to support what's really being used. IOW, "reliably" doesn't need > > to mean with 110% reliability. > > Hmmm, you mean try to find heuristically where e.g. in the ob-shell.el > file the org-babel-execute:sh function was defined? Yes. > The function body is this: > > (lambda > (body params) > "Execute a block of sh commands with Babel." > (let > ((shell-file-name "sh") > (org-babel-prompt-command > (or > (alist-get "sh" org-babel-shell-set-prompt-commands) > (alist-get t org-babel-shell-set-prompt-commands)))) > (org-babel-execute:shell body params))) > > and it has been created here: > > (defun org-babel-shell-initialize () > "Define execution functions associated to shell names. > This function has to be called whenever `org-babel-shell-names' > is modified outside the Customize interface." > (interactive) > (dolist (name org-babel-shell-names) > (eval `(defun ,(intern (concat "org-babel-execute:" name)) > (body params) > ,(format "Execute a block of %s commands with Babel." name) > (let ((shell-file-name ,name) > (org-babel-prompt-command > (or (alist-get ,name org-babel-shell-set-prompt-commands) > (alist-get t org-babel-shell-set-prompt-commands)))) > (org-babel-execute:shell body params)))) > (eval `(defalias ',(intern (concat "org-babel-variable-assignments:" name)) > 'org-babel-variable-assignments:shell > ,(format "Return list of %s statements assigning to the block's \ > variables." > name))) > (eval `(defvar ,(intern (concat "org-babel-default-header-args:" name)) '())))) > > Do you think there is a way to find that place? Well, searching for the regexp "defun .*org-babel-execute:" would have done that, right?