emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [babel, ess] How can I make S-RET to be multi-session friendly?
@ 2012-08-09 18:44 Mikhail Titov
  2012-08-09 19:33 ` Achim Gratz
  2012-08-10 12:42 ` Eric Schulte
  0 siblings, 2 replies; 12+ messages in thread
From: Mikhail Titov @ 2012-08-09 18:44 UTC (permalink / raw)
  To: emacs-orgmode

Hello!

There is a wonderful post[1] on how to make S-RET to do handy things in
ESS mode. However I often find myself working on several Org documents
from different folders.

It is quite inconvenient to change a directory in =*R*= buffer each time
I work on different document.

Is there a neat way to somehow reuse Org mode property =session= that I
set buffer wide?

Also for some reason

#+PROPERTY: session *Rsomename*

does not override session name set in =org-babel-default-header-args:R=
even after =C-c C-c= on it when I re-evaluate babel code block with =C-c
C-c= on code block, while explicit block header =:session *Rsomename*=
makes difference.

,----[ snippet from dot emacs ]
| (setq org-babel-default-header-args:R
|       '((:results . "output") (:session . "*R*")))
`----

I'm running Org-mode version 7.8.10 (release_7.8.10-658-g451191.dirty)

Footnotes: 
[1]  http://www.kieranhealy.org/blog/archives/2009/10/12/make-shift-enter-do-a-lot-in-ess/

-- 
Mikhail

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

* Re: [babel, ess] How can I make S-RET to be multi-session friendly?
  2012-08-09 18:44 [babel, ess] How can I make S-RET to be multi-session friendly? Mikhail Titov
@ 2012-08-09 19:33 ` Achim Gratz
  2012-08-10 12:42 ` Eric Schulte
  1 sibling, 0 replies; 12+ messages in thread
From: Achim Gratz @ 2012-08-09 19:33 UTC (permalink / raw)
  To: emacs-orgmode

Mikhail Titov writes:
> I'm running Org-mode version 7.8.10 (release_7.8.10-658-g451191.dirty)

No you don't... please do

git fetch --tags origin

Can't help with your question, sorry.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Waldorf MIDI Implementation & additional documentation:
http://Synth.Stromeko.net/Downloads.html#WaldorfDocs

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

* Re: [babel, ess] How can I make S-RET to be multi-session friendly?
  2012-08-09 18:44 [babel, ess] How can I make S-RET to be multi-session friendly? Mikhail Titov
  2012-08-09 19:33 ` Achim Gratz
@ 2012-08-10 12:42 ` Eric Schulte
  2012-08-10 18:54   ` Mikhail Titov
  1 sibling, 1 reply; 12+ messages in thread
From: Eric Schulte @ 2012-08-10 12:42 UTC (permalink / raw)
  To: Mikhail Titov; +Cc: emacs-orgmode

Mikhail Titov <mlt@gmx.us> writes:

> Hello!
>
> There is a wonderful post[1] on how to make S-RET to do handy things in
> ESS mode. However I often find myself working on several Org documents
> from different folders.
>
> It is quite inconvenient to change a directory in =*R*= buffer each
> time I work on different document.
>
> Is there a neat way to somehow reuse Org mode property =session= that I
> set buffer wide?
>

I'm not sure what you mean by "reuse".  All of the information for how
to set header arguments in available at (info "(org) Using header arguments")

>
> Also for some reason
>
> #+PROPERTY: session *Rsomename*
>
> does not override session name set in
> =org-babel-default-header-args:R= even after =C-c C-c= on it when I
> re-evaluate babel code block with =C-c C-c= on code block, while
> explicit block header =:session *Rsomename*= makes difference.
>

Yes, the order of precedence is

system-level < buffer/subtree-level < language-level < code-block-level

>
> ,----[ snippet from dot emacs ]
> | (setq org-babel-default-header-args:R
> |       '((:results . "output") (:session . "*R*")))
> `----
>

Given that (:session . "*R*") will be used by default you could simply
remove it from your custom setting for org-babel-default-header-args.

Best,

>
> I'm running Org-mode version 7.8.10 (release_7.8.10-658-g451191.dirty)
>
> Footnotes: 
> [1]
> http://www.kieranhealy.org/blog/archives/2009/10/12/make-shift-enter-do-a-lot-in-ess/

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

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

* Re: [babel, ess] How can I make S-RET to be multi-session friendly?
  2012-08-10 12:42 ` Eric Schulte
@ 2012-08-10 18:54   ` Mikhail Titov
  2012-08-11  3:37     ` Eric Schulte
  0 siblings, 1 reply; 12+ messages in thread
From: Mikhail Titov @ 2012-08-10 18:54 UTC (permalink / raw)
  To: Eric Schulte; +Cc: emacs-orgmode

Eric Schulte <eric.schulte@gmx.com> writes:

>> There is a wonderful post[1] on how to make S-RET to do handy things in
>> ESS mode. However I often find myself working on several Org documents
>> from different folders.
>>
>> It is quite inconvenient to change a directory in =*R*= buffer each
>> time I work on different document.
>>
>> Is there a neat way to somehow reuse Org mode property =session= that I
>> set buffer wide?
>>
>
> I'm not sure what you mean by "reuse".  All of the information for how
> to set header arguments in available at (info "(org) Using header
> arguments")

Here is the outline of what I have and what I'm doing.

As I mentioned I set default :session header for R to *R*. In my file I have
something like

#+PROPERTY: session *Rreport*

Whenever I C-c C-c on code block, I can see that *R* buffer
was created instead of *Rreport* !

Now, if I edit my code block with C-c ' and hit S-RET on any line, it
evaluates in *R* whereas I'd prefer it to be *Rreport* somehow. I
understand that I'm trying to somewhat mix ob with plain
ESS. Nevertheless I wonder if it is somehow possible.

>> Also for some reason
>>
>> #+PROPERTY: session *Rsomename*
>>
>> does not override session name set in
>> =org-babel-default-header-args:R= even after =C-c C-c= on it when I
>> re-evaluate babel code block with =C-c C-c= on code block, while
>> explicit block header =:session *Rsomename*= makes difference.
>>
>
> Yes, the order of precedence is
>
> system-level < buffer/subtree-level < language-level <
> code-block-level

Then I'd say buffer level does NOT override system-level for some
reason. I just re-built Emacs from bzr to make sure I'm running somewhat
recent Org.

Another weird thing is that when I tried to use Org from git (and not
the stock one), Emacs freezes deadly on
(org-clock-persistence-insinuate) unless I kill ntvdm.exe with Task
Manager (I'm on Windows). But I guess it is a separate story.

>> ,----[ snippet from dot emacs ]
>> | (setq org-babel-default-header-args:R
>> |       '((:results . "output") (:session . "*R*")))
>> `----
>>
>
> Given that (:session . "*R*") will be used by default you could simply
> remove it from your custom setting for org-babel-default-header-args.

This made a trick. Now indeed I have *Rreport* after C-c C-c on code
block. However after C-c ' whenever I attempt to S-RET, yet another *R*
is launched every time instead of evaluating a line.

So the question perhaps is:

How to alter [1] such that when I edit code block with C-c ' , S-RET
executes lines in a proper session. I believe all information is in
there, I just have no clue how would I extract it, e.g. to which main
buffer that code editing buffer (I don't know the right name for it)
belongs to, and what session header is set to in that buffer.

If there is a way to fetch those, perhaps I'd be able to alter original
set up in [1].

>> Footnotes: 
>> [1]
>> http://www.kieranhealy.org/blog/archives/2009/10/12/make-shift-enter-do-a-lot-in-ess/

-- 
Mikhail

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

* Re: [babel, ess] How can I make S-RET to be multi-session friendly?
  2012-08-10 18:54   ` Mikhail Titov
@ 2012-08-11  3:37     ` Eric Schulte
  2012-08-11 14:33       ` Andrew Young
  0 siblings, 1 reply; 12+ messages in thread
From: Eric Schulte @ 2012-08-11  3:37 UTC (permalink / raw)
  To: Mikhail Titov; +Cc: emacs-orgmode

>>
>> Yes, the order of precedence is
>>
>> system-level < buffer/subtree-level < language-level <
>> code-block-level
>
> Then I'd say buffer level does NOT override system-level for some
> reason.

I believe you mean the buffer-level does not override the
language-level.

> I just re-built Emacs from bzr to make sure I'm running somewhat
> recent Org.
>
> Another weird thing is that when I tried to use Org from git (and not
> the stock one), Emacs freezes deadly on
> (org-clock-persistence-insinuate) unless I kill ntvdm.exe with Task
> Manager (I'm on Windows). But I guess it is a separate story.
>

I have no idea what could be causing the above, but it seems unrelated.

>
>>> ,----[ snippet from dot emacs ]
>>> | (setq org-babel-default-header-args:R
>>> |       '((:results . "output") (:session . "*R*")))
>>> `----
>>>
>>
>> Given that (:session . "*R*") will be used by default you could simply
>> remove it from your custom setting for org-babel-default-header-args.
>
> This made a trick. Now indeed I have *Rreport* after C-c C-c on code
> block. However after C-c ' whenever I attempt to S-RET, yet another *R*
> is launched every time instead of evaluating a line.
>
> So the question perhaps is:
>
> How to alter [1] such that when I edit code block with C-c ' , S-RET
> executes lines in a proper session. I believe all information is in
> there, I just have no clue how would I extract it, e.g. to which main
> buffer that code editing buffer (I don't know the right name for it)
> belongs to, and what session header is set to in that buffer.
>
> If there is a way to fetch those, perhaps I'd be able to alter original
> set up in [1].
>

You can find the name of the original org-mode buffer by running the
following snippet of elisp within the edit buffer.

    ;; -*- emacs-lisp -*-
    (marker-buffer org-edit-src-beg-marker)

The `org-src-in-org-buffer' macro may be used from an edit buffer to run
elisp inside the code block, in the org-mode buffer of the edit buffer.
e.g., the following 

    ;; -*- emacs-lisp -*-
    (org-src-in-org-buffer (message "-->%S" (org-babel-get-src-block-info)))

Best,

>
>>> Footnotes: 
>>> [1]
>>> http://www.kieranhealy.org/blog/archives/2009/10/12/make-shift-enter-do-a-lot-in-ess/

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

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

* Re: [babel, ess] How can I make S-RET to be multi-session friendly?
  2012-08-11  3:37     ` Eric Schulte
@ 2012-08-11 14:33       ` Andrew Young
  2012-08-14 13:17         ` Eric Schulte
  0 siblings, 1 reply; 12+ messages in thread
From: Andrew Young @ 2012-08-11 14:33 UTC (permalink / raw)
  To: Mikhail Titov; +Cc: emacs-orgmode

Hello All,

Well, despite being relatively new to elisp, I've decided to take a
crack at one of your problems. I'm not too sure what is causing the
strange behaviour of the session property, but I have some thoughts on
getting that one function working.

Bear with me :-)

It seems that for me, the inferior ess process is not being properly
associated with the src edit buffer.  It is being set correctly by
org-babel-R-associate-session, and then being set a second time
incorrectly by org-babel-edit-prep:R.  Commenting out line 5 in
org-babel-edit-prep:R seems to fix this issue, although I'm honestly
not sure if or what it breaks.  Everything seems ok for me, but ymmv.

Heres the change:
#+begin_src emacs-lisp
  (defun org-babel-edit-prep:R (info)
    (let ((session (cdr (assoc :session (nth 2 info)))))
      (when (and session (string-match "^\\*\\(.+?\\)\\*$" session))
        (save-match-data (org-babel-R-initiate-session session nil))
        ;;(setq ess-local-process-name (match-string 1 session)))))
        )))
#+end_src

Is there any one having such issues, or who can weigh in on what
exactly is happening here?

Without making the above change, it is possible to manually attach an
ess process to the current src buffer by using the command:

C-c C-s (ess-switch-process)

You'll have to specify the process name, rather than the buffer name,
and the session must have already been started. From here all ESS
functions should work. For example, calling:

C-c C-z (ess-switch-to-end-of-ESS)

will open the session buffer.

I've implemented a variation of the function you mentioned, which uses
the inferior process discussed above.  It should do something at least
remotely like the function you were asking for, and will work with
babel sessions, as long as the ess process is associated
properly. I've made one change worth mentioning: the function now
prompts for a buffer name to set up on if no ess process is associated,
instead of only and always using *R*.

Try it out, and let me know what you think.  Of course feel free to
tweak & share!  This is my real first dive into lisp, so if anyone has
anything to share please do.

#+begin_src emacs-lisp
  (defun my-ess-eval ()
    (interactive)
    (update-ess-process-name-list)
    (if (not (ess-make-buffer-current))
        ;; Obtain the target ess session
        (let ((session
               (read-string "Use session: "
                            (let ((proc (get-process ess-current-process-name)))
                              (if (processp proc)
                                  (buffer-name (process-buffer proc)))))))
          ;; Obtain buffer matching session
          (if (not (get-buffer session))
              ;; If there is no buffer, create a new one
              (save-excursion
                (inferior-ess)
                (rename-buffer session)))
          (setq ess-local-process-name
                (process-name (get-buffer-process session)))))
    (ess-make-buffer-current)
    (if (and transient-mark-mode mark-active)
        (call-interactively 'ess-eval-region)
      (call-interactively 'ess-eval-line-and-step)))

    (add-hook 'ess-mode-hook
              '(lambda ()
                 (local-set-key [(shift return)] 'my-ess-eval)))

    (add-hook 'inferior-ess-mode-hook
              '(lambda ()
                 (local-set-key [C-up] 'comint-previous-input)
                 (local-set-key [C-down] 'comint-next-input)))

    (add-hook 'Rnw-mode-hook
              '(lambda ()
                 (local-set-key [(shift return)] 'my-ess-eval)))

  (require 'ess-site)

#+end_src

Sincerely,
Andrew Young

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

* Re: [babel, ess] How can I make S-RET to be multi-session friendly?
  2012-08-11 14:33       ` Andrew Young
@ 2012-08-14 13:17         ` Eric Schulte
  2012-08-14 21:48           ` Mikhail Titov
  0 siblings, 1 reply; 12+ messages in thread
From: Eric Schulte @ 2012-08-14 13:17 UTC (permalink / raw)
  To: Andrew Young; +Cc: emacs-orgmode, Mikhail Titov

Andrew Young <youngar17@gmail.com> writes:

> Hello All,
>

Hi Andrew,

>
> Well, despite being relatively new to elisp, I've decided to take a
> crack at one of your problems. I'm not too sure what is causing the
> strange behaviour of the session property, but I have some thoughts on
> getting that one function working.
>

Thanks for sending this along, unfortunately ob-R.el is currently
without a core maintainer, so I'm not sure who on list would have the
expertise to review your submission.  Although hopefully those
experiencing the problem can at least check if it works for them.

>
> Bear with me :-)
>
> It seems that for me, the inferior ess process is not being properly
> associated with the src edit buffer.  It is being set correctly by
> org-babel-R-associate-session, and then being set a second time
> incorrectly by org-babel-edit-prep:R.  Commenting out line 5 in
> org-babel-edit-prep:R seems to fix this issue, although I'm honestly
> not sure if or what it breaks.  Everything seems ok for me, but ymmv.
>
> Heres the change:
> #+begin_src emacs-lisp
>   (defun org-babel-edit-prep:R (info)
>     (let ((session (cdr (assoc :session (nth 2 info)))))
>       (when (and session (string-match "^\\*\\(.+?\\)\\*$" session))
>         (save-match-data (org-babel-R-initiate-session session nil))
>         ;;(setq ess-local-process-name (match-string 1 session)))))
>         )))
> #+end_src
>

Perhaps replacing the commented "setq ess-local-process-name" line with
ess-switch-process could solve this problem?  Could the process name be
found programatically, perhaps using the regexp solution above.

>
> Is there any one having such issues, or who can weigh in on what
> exactly is happening here?
>
> Without making the above change, it is possible to manually attach an
> ess process to the current src buffer by using the command:
>
> C-c C-s (ess-switch-process)
>
> You'll have to specify the process name, rather than the buffer name,
> and the session must have already been started. From here all ESS
> functions should work. For example, calling:
>
> C-c C-z (ess-switch-to-end-of-ESS)
>
> will open the session buffer.
>
> I've implemented a variation of the function you mentioned, which uses
> the inferior process discussed above.  It should do something at least
> remotely like the function you were asking for, and will work with
> babel sessions, as long as the ess process is associated
> properly. I've made one change worth mentioning: the function now
> prompts for a buffer name to set up on if no ess process is associated,
> instead of only and always using *R*.
>
> Try it out, and let me know what you think.  Of course feel free to
> tweak & share!  This is my real first dive into lisp, so if anyone has
> anything to share please do.
>
> #+begin_src emacs-lisp
>   (defun my-ess-eval ()
>     (interactive)
>     (update-ess-process-name-list)
>     (if (not (ess-make-buffer-current))
>         ;; Obtain the target ess session
>         (let ((session
>                (read-string "Use session: "
>                             (let ((proc (get-process ess-current-process-name)))
>                               (if (processp proc)
>                                   (buffer-name (process-buffer proc)))))))
>           ;; Obtain buffer matching session
>           (if (not (get-buffer session))
>               ;; If there is no buffer, create a new one
>               (save-excursion
>                 (inferior-ess)
>                 (rename-buffer session)))
>           (setq ess-local-process-name
>                 (process-name (get-buffer-process session)))))
>     (ess-make-buffer-current)
>     (if (and transient-mark-mode mark-active)
>         (call-interactively 'ess-eval-region)
>       (call-interactively 'ess-eval-line-and-step)))
>
>     (add-hook 'ess-mode-hook
>               '(lambda ()
>                  (local-set-key [(shift return)] 'my-ess-eval)))
>
>     (add-hook 'inferior-ess-mode-hook
>               '(lambda ()
>                  (local-set-key [C-up] 'comint-previous-input)
>                  (local-set-key [C-down] 'comint-next-input)))
>
>     (add-hook 'Rnw-mode-hook
>               '(lambda ()
>                  (local-set-key [(shift return)] 'my-ess-eval)))
>
>   (require 'ess-site)
>
> #+end_src
>

This looks good to me, perhaps it should be added to the Worg page on
using R with Org-mode?

http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html

Thanks,

>
> Sincerely,
> Andrew Young
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

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

* Re: [babel, ess] How can I make S-RET to be multi-session friendly?
  2012-08-14 13:17         ` Eric Schulte
@ 2012-08-14 21:48           ` Mikhail Titov
  2012-08-14 21:59             ` Bastien
  0 siblings, 1 reply; 12+ messages in thread
From: Mikhail Titov @ 2012-08-14 21:48 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Andrew Young, emacs-orgmode

Eric Schulte <eric.schulte@gmx.com> writes:

> Thanks for sending this along, unfortunately ob-R.el is currently
> without a core maintainer

Quite a sad situation, many good modules lack maintainers :(

>, so I'm not sure who on list would have the expertise to review your
>submission.  Although hopefully those experiencing the problem can at
>least check if it works for them.

I'm not an expert but I gave it a shot.

>> It seems that for me, the inferior ess process is not being properly
>> associated with the src edit buffer.  It is being set correctly by
>> org-babel-R-associate-session, and then being set a second time
>> incorrectly by org-babel-edit-prep:R.  Commenting out line 5 in
>> org-babel-edit-prep:R seems to fix this issue, although I'm honestly
>> not sure if or what it breaks.  Everything seems ok for me, but ymmv.
>>
>> Heres the change:
>> #+begin_src emacs-lisp
>>   (defun org-babel-edit-prep:R (info)
>>     (let ((session (cdr (assoc :session (nth 2 info)))))
>>       (when (and session (string-match "^\\*\\(.+?\\)\\*$" session))
>>         (save-match-data (org-babel-R-initiate-session session nil))
>>         ;;(setq ess-local-process-name (match-string 1 session)))))
>>         )))
>> #+end_src
>>
>
> Perhaps replacing the commented "setq ess-local-process-name" line with
> ess-switch-process could solve this problem?  Could the process name be
> found programatically, perhaps using the regexp solution above.
>
>>
>> Is there any one having such issues, or who can weigh in on what
>> exactly is happening here?
>>
>> Without making the above change, it is possible to manually attach an
>> ess process to the current src buffer by using the command:
>>
>> C-c C-s (ess-switch-process)
>>
>> You'll have to specify the process name, rather than the buffer name,
>> and the session must have already been started.

I would say that after applying changes to my-ess-eval and to
org-babel-edit-prep:R as suggested by Andrew, it looks like everything
is working right for me. Once I hit C-c ' I see properly named buffer
appear with new process. Then if I hit S-RET it asks me what session to
use and since I have ido mode, it already highlights proper session
name, so I just hit RET. Perhaps it worth recommending to use ido?

Note that I do not have to enter process name.

If I quite R, while editing code in a separate buffer, and hit S-RET it
is executed in the wrong one without any question being asked :(

I'm running somewhat recent bzr version of Emacs with default Org in it.

-- 
Mikhail

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

* Re: [babel, ess] How can I make S-RET to be multi-session friendly?
  2012-08-14 21:48           ` Mikhail Titov
@ 2012-08-14 21:59             ` Bastien
  2012-08-16 21:06               ` Mikhail Titov
  0 siblings, 1 reply; 12+ messages in thread
From: Bastien @ 2012-08-14 21:59 UTC (permalink / raw)
  To: Mikhail Titov; +Cc: Andrew Young, emacs-orgmode, Eric Schulte

Hi Mikhail,

Mikhail Titov <mlt@gmx.us> writes:

> I would say that after applying changes to my-ess-eval and to
> org-babel-edit-prep:R as suggested by Andrew, it looks like everything
> is working right for me.

I'v been bold and I pushed the change Andrew suggested.

Thanks for reporting this and for testing around -- and thanks
to Andrew for the exploration and the fix! 

-- 
 Bastien

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

* Re: [babel, ess] How can I make S-RET to be multi-session friendly?
  2012-08-14 21:59             ` Bastien
@ 2012-08-16 21:06               ` Mikhail Titov
  2012-08-17 14:29                 ` Eric Schulte
  0 siblings, 1 reply; 12+ messages in thread
From: Mikhail Titov @ 2012-08-16 21:06 UTC (permalink / raw)
  To: Bastien; +Cc: Andrew Young, emacs-orgmode, Eric Schulte

Bastien <bzg@gnu.org> writes:

>> I would say that after applying changes to my-ess-eval and to
>> org-babel-edit-prep:R as suggested by Andrew, it looks like everything
>> is working right for me.
>
> I'v been bold and I pushed the change Andrew suggested.
>
> Thanks for reporting this and for testing around -- and thanks
> to Andrew for the exploration and the fix! 

Though not related to Org, I noticed that ess-make-buffer-current calls
(update-ess-process-name-list) thus making a call for it in my-ess-eval,
probably, somewhat redundant, right?

Another thing that somewhat bugs me is that if R process quits (or
probably dies as well) when editing source code block in a separate
buffer, the subsequent S-RET will silently execute a line in a wrong
buffer/process. If there are no buffers with R process, it will create
the default *R* named buffer. It might be exotic but I think it is an
issue.

Does it mean that there is a bug in ess-make-buffer-current function
somewhere? Something, probably, re-associates a buffer to another
process, does it?

I think it might be relevant that code editing buffer local variable
ess-local-process-name is non-nil when associated process quits. This
results in first ess-make-buffer-current in my-ess-eval silently
launching *R*.

I'm not sure if it is too much to fix. Perhaps hitting C-c ' twice to
re-start editing is a reasonable workaround.

Eric Schulte <eric.schulte@gmx.com> writes:

> You can find the name of the original org-mode buffer by running the
> following snippet of elisp within the edit buffer.
>
>     ;; -*- emacs-lisp -*-
>     (marker-buffer org-edit-src-beg-marker)
>
> The `org-src-in-org-buffer' macro may be used from an edit buffer to run
> elisp inside the code block, in the org-mode buffer of the edit buffer.
> e.g., the following 
>
>     ;; -*- emacs-lisp -*-
>     (org-src-in-org-buffer (message "-->%S" (org-babel-get-src-block-info)))

Where is org-src-in-org-buffer macro defined. Searching all dot el files
in org folder does not show anything neither does C-h f show anything
similar.

-- 
Mikhail

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

* Re: [babel, ess] How can I make S-RET to be multi-session friendly?
  2012-08-16 21:06               ` Mikhail Titov
@ 2012-08-17 14:29                 ` Eric Schulte
  2012-08-23 22:11                   ` Mikhail Titov
  0 siblings, 1 reply; 12+ messages in thread
From: Eric Schulte @ 2012-08-17 14:29 UTC (permalink / raw)
  To: Mikhail Titov; +Cc: Bastien, Andrew Young, emacs-orgmode

>>
>> The `org-src-in-org-buffer' macro may be used from an edit buffer to run
>> elisp inside the code block, in the org-mode buffer of the edit buffer.
>> e.g., the following 
>>
>>     ;; -*- emacs-lisp -*-
>>     (org-src-in-org-buffer (message "-->%S" (org-babel-get-src-block-info)))
>
> Where is org-src-in-org-buffer macro defined. Searching all dot el files
> in org folder does not show anything neither does C-h f show anything
> similar.

(describe-function 'org-src-in-org-buffer) shows that
org-src-in-org-buffer can be found in org-src.el (line 679 in my
version).

-- 
Eric Schulte
http://cs.unm.edu/~eschulte

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

* Re: [babel, ess] How can I make S-RET to be multi-session friendly?
  2012-08-17 14:29                 ` Eric Schulte
@ 2012-08-23 22:11                   ` Mikhail Titov
  0 siblings, 0 replies; 12+ messages in thread
From: Mikhail Titov @ 2012-08-23 22:11 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Bastien, Andrew Young, emacs-orgmode

Another issue I've noticed is that if I save a buffer, that was
previously associated with R session, under different name in different
folder, then that association is not getting reset and/or overridden by
session property of Org buffer. Namely, I had dot R file that I saved in
different folder as dot org one while wrapping code in babel blocks and
adding session property. I did C-c C-c.

I believe there is somewhere a check whether a buffer is associated or
not but no check if it is associated with a proper buffer/session.

Eric Schulte writes on Fri Aug 17 2012 at 09:29 :

>>>
>>> The `org-src-in-org-buffer' macro may be used from an edit buffer to run
>>> elisp inside the code block, in the org-mode buffer of the edit buffer.
>>> e.g., the following 
>>>
>>>     ;; -*- emacs-lisp -*-
>>>     (org-src-in-org-buffer (message "-->%S" (org-babel-get-src-block-info)))
>>
>> Where is org-src-in-org-buffer macro defined. Searching all dot el files
>> in org folder does not show anything neither does C-h f show anything
>> similar.
>
> (describe-function 'org-src-in-org-buffer) shows that
> org-src-in-org-buffer can be found in org-src.el (line 679 in my
> version).

I guess it did not propagate to bzr yet :( I've checked with rev
109760. For some reason I had problems building git version on Windows a
while ago and I didn't try since then.

-- 
Mikhail

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

end of thread, other threads:[~2012-08-23 22:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-09 18:44 [babel, ess] How can I make S-RET to be multi-session friendly? Mikhail Titov
2012-08-09 19:33 ` Achim Gratz
2012-08-10 12:42 ` Eric Schulte
2012-08-10 18:54   ` Mikhail Titov
2012-08-11  3:37     ` Eric Schulte
2012-08-11 14:33       ` Andrew Young
2012-08-14 13:17         ` Eric Schulte
2012-08-14 21:48           ` Mikhail Titov
2012-08-14 21:59             ` Bastien
2012-08-16 21:06               ` Mikhail Titov
2012-08-17 14:29                 ` Eric Schulte
2012-08-23 22:11                   ` Mikhail Titov

Code repositories for project(s) associated with this 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).