Following this thread: http://thread.gmane.org/gmane.emacs.orgmode/77572/focus=77648 I found that setting org-confirm-babel-evaluate to a lambda form BREAKS inline src blocks. Here is an ECM: # ==== #+BEGIN_SRC emacs-lisp (setf org-confirm-babel-evaluate (lambda (&rest args) (message "info: %S" (org-babel-get-src-block-info 'light)) nil)) #+END_SRC #+RESULTS: src_R{1+1} # ====
Charles Berry <ccberry@ucsd.edu> writes: > Following this thread: > > http://thread.gmane.org/gmane.emacs.orgmode/77572/focus=77648 > > I found that setting org-confirm-babel-evaluate to a lambda form > BREAKS inline src blocks. > > > Here is an ECM: > > # ==== > > #+BEGIN_SRC emacs-lisp > (setf org-confirm-babel-evaluate > (lambda (&rest args) > (message "info: %S" (org-babel-get-src-block-info 'light)) > nil)) > #+END_SRC > > #+RESULTS: > > src_R{1+1} > > # ==== > > Thanks for pointing this out, I've just pushed up a fix. -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D
Eric Schulte <schulte.eric <at> gmail.com> writes: > > Charles Berry <ccberry <at> ucsd.edu> writes: > [snip] > > Thanks for pointing this out, I've just pushed up a fix. > AFAICS, it is still broken. I did a git pull, downloaded the patches, applied them, compiled ob-core.el. I am still getting org-babel-exp-results: Wrong type argument: integer-or-marker-p, nil I suspect that (,head (nth 6 ,info)) ... (goto-char ,head) in the org-babel-check-confirm-evaluate macro is the source of the message. (nth 6 info) is nil for inline src blocks. HTH, Chuck
Charles Berry <ccberry@ucsd.edu> writes: > Eric Schulte <schulte.eric <at> gmail.com> writes: > >> >> Charles Berry <ccberry <at> ucsd.edu> writes: >> > [snip] >> >> Thanks for pointing this out, I've just pushed up a fix. >> > > AFAICS, it is still broken. > > I did a git pull, downloaded the patches, applied them, compiled > ob-core.el. I am still getting > > org-babel-exp-results: Wrong type argument: integer-or-marker-p, nil > > > I suspect that > > (,head (nth 6 ,info)) > ... > (goto-char ,head) > > in the org-babel-check-confirm-evaluate macro is the source of the message. > > (nth 6 info) is nil for inline src blocks. > Indeed the fix was to set this element of info to point to the front of the inline src block. I imagine that you probably don't have the patched version of the relevant function loaded. Please try M-x describe-function on org-babel-get-src-block-info, then jump to the definition of said function where you should see the following code which now sets the location of the inline src block head into the last element of the info list. ;; inline source block (when (org-babel-get-inline-src-block-matches) (setq head (match-beginning 0)) (setq info (org-babel-parse-inline-src-block-match)))) Best, > > HTH, > > Chuck > > -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D
Eric Schulte <schulte.eric <at> gmail.com> writes: > > Charles Berry <ccberry <at> ucsd.edu> writes: > > > Eric Schulte <schulte.eric <at> gmail.com> writes: > > > >> > >> Charles Berry <ccberry <at> ucsd.edu> writes: > >> > > [snip] > Indeed the fix was to set this element of info to point to the front of > the inline src block. I imagine that you probably don't have the > patched version of the relevant function loaded. Please try M-x > describe-function on org-babel-get-src-block-info, then jump to the > definition of said function where you should see the following code > which now sets the location of the inline src block head into the last > element of the info list. > > ;; inline source block > (when (org-babel-get-inline-src-block-matches) > (setq head (match-beginning 0)) > (setq info (org-babel-parse-inline-src-block-match)))) > That _is_ what I had loaded, but ... org-babel-get-src-block-info is *not* *called* for inline src blocks. org-babel-exp-non-block-elements doesn't call org-babel-get-src-block-info. Instead, it has this (let* ((info (org-babel-parse-inline-src-block-match)) for inline src blocks. So changing org-babel-get-src-block-infodoes not fix the inline src block issue. === Juat to be sure that I understood what was happening, I instrumented org-babel-get-src-block-info and ran the ECM I posted at the start of this thread. org-babel-get-src-block-info got called twice for the first src block, then I got prompted "Evaluate this emacs-lisp code block on your system? " If I answer 'n' (skip the block redefining org-confirm-babel-evaluate, then I get prompted for the inline src block _without_ org-babel-get-src-block-info being called again. If I answer 'y' (redefine org-confirm-babel-evaluate as a lambda form), I get the error message. org-babel-exp-results: Wrong type argument: integer-or-marker-p, nil HTH, Chuck
>> Indeed the fix was to set this element of info to point to the front of >> the inline src block. I imagine that you probably don't have the >> patched version of the relevant function loaded. Please try M-x >> describe-function on org-babel-get-src-block-info, then jump to the >> definition of said function where you should see the following code >> which now sets the location of the inline src block head into the last >> element of the info list. >> >> ;; inline source block >> (when (org-babel-get-inline-src-block-matches) >> (setq head (match-beginning 0)) >> (setq info (org-babel-parse-inline-src-block-match)))) >> > > > That _is_ what I had loaded, but ... > > org-babel-get-src-block-info is *not* *called* for inline src blocks. > > org-babel-exp-non-block-elements doesn't call org-babel-get-src-block-info. > Instead, it has this > > (let* ((info (org-babel-parse-inline-src-block-match)) > > for inline src blocks. > > So changing org-babel-get-src-block-infodoes not fix the inline src block > issue. > Oh, I was testing with interactive evaluation, not export. I've just pushed up another fix which should fix this for export too. Thanks again, -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D
Eric Schulte <schulte.eric <at> gmail.com> writes: > [delete long discussion of bug] > > I've just pushed up another fix which should fix this for export too. > And it works! Thanks for the fix and for enabling this useful capability! Chuck