emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [BUG] org-confirm-babel-evaluate breaks inline src blocks
@ 2013-11-16 20:05 Charles Berry
  2013-11-22 15:29 ` Eric Schulte
  0 siblings, 1 reply; 7+ messages in thread
From: Charles Berry @ 2013-11-16 20:05 UTC (permalink / raw)
  To: emacs-orgmode


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}

# ====

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] org-confirm-babel-evaluate breaks inline src blocks
  2013-11-16 20:05 [BUG] org-confirm-babel-evaluate breaks inline src blocks Charles Berry
@ 2013-11-22 15:29 ` Eric Schulte
  2013-11-23  4:50   ` Charles Berry
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2013-11-22 15:29 UTC (permalink / raw)
  To: Charles Berry; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] org-confirm-babel-evaluate breaks inline src blocks
  2013-11-22 15:29 ` Eric Schulte
@ 2013-11-23  4:50   ` Charles Berry
  2013-11-23 16:19     ` Eric Schulte
  0 siblings, 1 reply; 7+ messages in thread
From: Charles Berry @ 2013-11-23  4:50 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] org-confirm-babel-evaluate breaks inline src blocks
  2013-11-23  4:50   ` Charles Berry
@ 2013-11-23 16:19     ` Eric Schulte
  2013-11-23 18:24       ` Charles Berry
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2013-11-23 16:19 UTC (permalink / raw)
  To: Charles Berry; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] org-confirm-babel-evaluate breaks inline src blocks
  2013-11-23 16:19     ` Eric Schulte
@ 2013-11-23 18:24       ` Charles Berry
  2013-11-23 19:28         ` Eric Schulte
  0 siblings, 1 reply; 7+ messages in thread
From: Charles Berry @ 2013-11-23 18:24 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] org-confirm-babel-evaluate breaks inline src blocks
  2013-11-23 18:24       ` Charles Berry
@ 2013-11-23 19:28         ` Eric Schulte
  2013-11-23 20:38           ` Charles Berry
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Schulte @ 2013-11-23 19:28 UTC (permalink / raw)
  To: Charles Berry; +Cc: emacs-orgmode

>> 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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [BUG] org-confirm-babel-evaluate breaks inline src blocks
  2013-11-23 19:28         ` Eric Schulte
@ 2013-11-23 20:38           ` Charles Berry
  0 siblings, 0 replies; 7+ messages in thread
From: Charles Berry @ 2013-11-23 20:38 UTC (permalink / raw)
  To: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-11-23 20:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-16 20:05 [BUG] org-confirm-babel-evaluate breaks inline src blocks Charles Berry
2013-11-22 15:29 ` Eric Schulte
2013-11-23  4:50   ` Charles Berry
2013-11-23 16:19     ` Eric Schulte
2013-11-23 18:24       ` Charles Berry
2013-11-23 19:28         ` Eric Schulte
2013-11-23 20:38           ` Charles Berry

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).