emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Babel Edit Code Whole Session Context
@ 2018-06-24 14:50 Kevin Foley
  2018-06-24 16:10 ` Grant Rettke
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Foley @ 2018-06-24 14:50 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 818 bytes --]

Is there anyway to edit a source code block with the context of all other
source code blocks in the same session?  Specifically when working with
Python I'd like features like company to be able to use the rest of the
code in the session.

For example consider the following org file:

#+begin_src python :tangle yes :session my_session
  var = 'variable'

  var_upper = var.
#+end_src

#+begin_src python :tangle yes :session my_session
  var_lower = var.
#+end_src

If I call `org-edit-src-code` on the first block and move the point to
after the dot in "var." and call `elpy-company-backend` I get suggestions
of all methods associated with strings in Python.  However if I do the same
in the second code block I get the message "No completion found".

Is there any solution to this issue?

-- 
Thanks,
Kevin Foley

[-- Attachment #2: Type: text/html, Size: 1158 bytes --]

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

* Re: Babel Edit Code Whole Session Context
  2018-06-24 14:50 Babel Edit Code Whole Session Context Kevin Foley
@ 2018-06-24 16:10 ` Grant Rettke
  2018-06-24 19:46   ` Kevin Foley
  0 siblings, 1 reply; 3+ messages in thread
From: Grant Rettke @ 2018-06-24 16:10 UTC (permalink / raw)
  To: Kevin Foley; +Cc: Org-mode

Hi Kevin,

On Sun, Jun 24, 2018 at 9:50 AM, Kevin Foley <kfoley15@gmail.com> wrote:
> Is there anyway to edit a source code block with the context of all other
> source code blocks in the same session?  Specifically when working with
> Python I'd like features like company to be able to use the rest of the code
> in the session.

I hear you and think I understand what you say. I also know it can be
irritating when
somebody answers a slightly different question question you asked. If
you humor me,
I'm about to do that.

I don't know how to do what you ask. However, I have something to do
that I would be
pretty happy.

1. Set the default headers args to noweb :tangle
2. Develop blocks normally, without Company.
3. When I am ready to work on the whole codebase with company, tangle
    to a file.
4. Go to that file. Leverage Company and make changes. When you are
done detangle.
5. Iterate

That way you can get what you need albeit not how you wanted it to work.

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

* Re: Babel Edit Code Whole Session Context
  2018-06-24 16:10 ` Grant Rettke
@ 2018-06-24 19:46   ` Kevin Foley
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Foley @ 2018-06-24 19:46 UTC (permalink / raw)
  To: gcr; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1193 bytes --]

Hi Grant,

> I hear you and think I understand what you say. I also know it can be
> irritating when
> somebody answers a slightly different question question you asked. If
> you humor me,
> I'm about to do that.

No problem, I appreciate all discussion on the matter.

> I don't know how to do what you ask. However, I have something to do
> that I would be
> pretty happy.

> 1. Set the default headers args to noweb :tangle
> 2. Develop blocks normally, without Company.
> 3. When I am ready to work on the whole codebase with company, tangle
>     to a file.
> 4. Go to that file. Leverage Company and make changes. When you are
> done detangle.
> 5. Iterate

I'm thinking of trying to implement something similar.  My solution would
be to place all code from blocks of the same session into the edit buffer
and then narrow to only the section from the current code block.  Then all
features should work seamlessly.  I'm not quite sure the best approach to
do this but I'm going to start poking around in the source code to see if
it's feasible.

If anyone has a solution that's already available or any feedback on my
proposed approach I'd greatly appreciate it.

-- 
Thanks,
Kevin Foley

[-- Attachment #2: Type: text/html, Size: 2929 bytes --]

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

end of thread, other threads:[~2018-06-24 19:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-24 14:50 Babel Edit Code Whole Session Context Kevin Foley
2018-06-24 16:10 ` Grant Rettke
2018-06-24 19:46   ` Kevin Foley

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