[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated
From: |
Eli Zaretskii |
Subject: |
bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions |
Date: |
Thu, 05 Jan 2023 17:10:20 +0200 |
> Date: Thu, 05 Jan 2023 14:27:41 +0000
> From: Gregory Heytings <gregory@heytings.org>
> 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?
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, (continued)
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Gregory Heytings, 2023/01/05
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Daniel MartÃn, 2023/01/05
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Ihor Radchenko, 2023/01/05
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Eli Zaretskii, 2023/01/05
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Gregory Heytings, 2023/01/05
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Eli Zaretskii, 2023/01/05
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Gregory Heytings, 2023/01/05
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions,
Eli Zaretskii <=
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Gregory Heytings, 2023/01/05
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Eli Zaretskii, 2023/01/05
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Gregory Heytings, 2023/01/05
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Eli Zaretskii, 2023/01/06
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Gregory Heytings, 2023/01/06
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Stefan Monnier, 2023/01/06
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Gregory Heytings, 2023/01/06
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Stefan Monnier, 2023/01/06
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Eli Zaretskii, 2023/01/07
- bug#60568: [FR] 30.0.50; Help buffers and function bodies for generated functions, Gregory Heytings, 2023/01/07