From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings Newsgroups: gmane.emacs.bugs Subject: bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions Date: Thu, 05 Jan 2023 14:27:41 +0000 Message-ID: <8dea9f3e0e8e6114ffc3@heytings.org> References: <87fscpifdw.fsf@localhost> <83wn61w7lc.fsf@gnu.org> <8dea9f3e0e7865d8f3c6@heytings.org> <83r0w9vzgy.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15521"; mail-complaints-to="usenet@ciao.gmane.io" Cc: yantar92@posteo.net, 60568@debbugs.gnu.org, mardani29@yahoo.es To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 05 15:28:12 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 1pDRE3-0003oy-OG for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Jan 2023 15:28:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pDRDv-0001Fy-LF; Thu, 05 Jan 2023 09:28: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 1pDRDu-0001Ca-Dp for bug-gnu-emacs@gnu.org; Thu, 05 Jan 2023 09:28: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 1pDRDu-0001Cq-59 for bug-gnu-emacs@gnu.org; Thu, 05 Jan 2023 09:28:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pDRDt-0008Rj-OR for bug-gnu-emacs@gnu.org; Thu, 05 Jan 2023 09:28:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gregory Heytings Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Jan 2023 14:28:01 +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.167292886532445 (code B ref 60568); Thu, 05 Jan 2023 14:28:01 +0000 Original-Received: (at 60568) by debbugs.gnu.org; 5 Jan 2023 14:27:45 +0000 Original-Received: from localhost ([127.0.0.1]:50578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDRDd-0008RE-3Q for submit@debbugs.gnu.org; Thu, 05 Jan 2023 09:27:45 -0500 Original-Received: from heytings.org ([95.142.160.155]:60028) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pDRDa-0008R6-Ka for 60568@debbugs.gnu.org; Thu, 05 Jan 2023 09:27:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heytings.org; s=20220101; t=1672928861; bh=oXNGL8B/qteWSzsiBrCFD8g2HnGXNHIyB03paFRyQmU=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References:From; b=QnOuXfHXcxZL1Q7iUlWX2WiOjYenrLKME2yjKsx2m7NxZKCmpRHhtob2JYnoMOkfX E4i7+8Afxm0SJPr/C3we8koIXl8aUvvkumoLg020jKMwkSIJlpSfvSnVkkBMtDdib2 jr33GiXSe6PfBJMz2KdwFbyKn0mU6nV7QD0xPOx67ZejPaHrk8RlUxkJp8xwh8zB4Q jY23kmUa5++NthuYkJ4rRF54qz1pw3FFCKbx/8XPm2w6FGLOsoYxQU1VV6XqBQLSFl fbFJTEBd5SXGkFU1mbB9YB6ZYDmxgdvfAOL8ggfWMzkFHVGO9pReJFDEnTMpkQZmH6 uBCwiDdlQV+PA== In-Reply-To: <83r0w9vzgy.fsf@gnu.org> 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:252605 Archived-At: >> 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? 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? AFAIU, all elements in the function definition could be variables in the form that is evalled.