emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Mikhail Titov <mlt@gmx.us>
To: Eric Schulte <eric.schulte@gmx.com>
Cc: Andrew Young <youngar17@gmail.com>, emacs-orgmode@gnu.org
Subject: Re: [babel, ess] How can I make S-RET to be multi-session friendly?
Date: Tue, 14 Aug 2012 16:48:52 -0500	[thread overview]
Message-ID: <9q0a9xxrvp7.fsf@gmx.us> (raw)
In-Reply-To: <87y5lh6291.fsf@gmx.com> (Eric Schulte's message of "Tue, 14 Aug 2012 07:17:36 -0600")

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

  reply	other threads:[~2012-08-14 21:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9q0a9xxrvp7.fsf@gmx.us \
    --to=mlt@gmx.us \
    --cc=emacs-orgmode@gnu.org \
    --cc=eric.schulte@gmx.com \
    --cc=youngar17@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).