emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to evaluate source code while in the edit buffer?
@ 2020-12-04 13:58 Mirko Vukovic
  2020-12-04 14:26 ` Jean Louis
  2020-12-04 17:41 ` Pankaj Jangid
  0 siblings, 2 replies; 9+ messages in thread
From: Mirko Vukovic @ 2020-12-04 13:58 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello,

Creating/editing UML diagrams using plantuml mode is an iterative process.
My current workflow is

   1. Enter edit buffer (C-c ')
   2. Perform edits in the window
   3. Exit edit mode (C-c ')
   4. Evaluate code (C-c C-c)
   5. Monitor changes to resulting png file

I would prefer instead to skip step 3, and evaluate the code from within
the edit mode. I tried evaluating org-babel-execute-src-block from the edit
buffer, but that resulted in an error:
helm-M-x-execute-command: Wrong type argument: consp, nil

Is it possible to execute code from the edit buffer?

Thank you,

Mirko

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

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

* Re: How to evaluate source code while in the edit buffer?
  2020-12-04 13:58 How to evaluate source code while in the edit buffer? Mirko Vukovic
@ 2020-12-04 14:26 ` Jean Louis
  2020-12-04 17:09   ` Pankaj Jangid
  2020-12-04 17:41 ` Pankaj Jangid
  1 sibling, 1 reply; 9+ messages in thread
From: Jean Louis @ 2020-12-04 14:26 UTC (permalink / raw)
  To: Mirko Vukovic; +Cc: emacs-orgmode

* Mirko Vukovic <mirko.vukovic@gmail.com> [2020-12-04 16:59]:
> Hello,
> 
> Creating/editing UML diagrams using plantuml mode is an iterative process.
> My current workflow is
> 
>    1. Enter edit buffer (C-c ')
>    2. Perform edits in the window
>    3. Exit edit mode (C-c ')
>    4. Evaluate code (C-c C-c)
>    5. Monitor changes to resulting png file
> 
> I would prefer instead to skip step 3, and evaluate the code from within
> the edit mode. I tried evaluating org-babel-execute-src-block from the edit
> buffer, but that resulted in an error:
> helm-M-x-execute-command: Wrong type argument: consp, nil

Pozdrav Mirko,

If you are editing source block in Org file, why not just do C-c C-c
right there in the block to evaluate it?

Jean


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

* Re: How to evaluate source code while in the edit buffer?
  2020-12-04 14:26 ` Jean Louis
@ 2020-12-04 17:09   ` Pankaj Jangid
  0 siblings, 0 replies; 9+ messages in thread
From: Pankaj Jangid @ 2020-12-04 17:09 UTC (permalink / raw)
  To: Jean Louis; +Cc: emacs-orgmode, Mirko Vukovic

Jean Louis <bugs@gnu.support> writes:

> * Mirko Vukovic <mirko.vukovic@gmail.com> [2020-12-04 16:59]:
>> Creating/editing UML diagrams using plantuml mode is an iterative process.
>> My current workflow is
>> 
>>    1. Enter edit buffer (C-c ')
>>    2. Perform edits in the window
>>    3. Exit edit mode (C-c ')
>>    4. Evaluate code (C-c C-c)
>>    5. Monitor changes to resulting png file
>> 
>> I would prefer instead to skip step 3, and evaluate the code from within
>> the edit mode. I tried evaluating org-babel-execute-src-block from the edit
>> buffer, but that resulted in an error:
>> helm-M-x-execute-command: Wrong type argument: consp, nil
>
> Pozdrav Mirko,
>
> If you are editing source block in Org file, why not just do C-c C-c
> right there in the block to evaluate it?

Because major-mode features for the language are not available in org-mode.


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

* Re: How to evaluate source code while in the edit buffer?
  2020-12-04 13:58 How to evaluate source code while in the edit buffer? Mirko Vukovic
  2020-12-04 14:26 ` Jean Louis
@ 2020-12-04 17:41 ` Pankaj Jangid
  2020-12-04 18:59   ` Mirko Vukovic
  2020-12-04 21:17   ` George Mauer
  1 sibling, 2 replies; 9+ messages in thread
From: Pankaj Jangid @ 2020-12-04 17:41 UTC (permalink / raw)
  To: Mirko Vukovic; +Cc: emacs-orgmode

Mirko Vukovic <mirko.vukovic@gmail.com> writes:

> My current workflow is
>
>    1. Enter edit buffer (C-c ')
>    2. Perform edits in the window
>    3. Exit edit mode (C-c ')
>    4. Evaluate code (C-c C-c)
>    5. Monitor changes to resulting png file
>
> I would prefer instead to skip step 3, and evaluate the code from within
> the edit mode.
>
> Is it possible to execute code from the edit buffer?

1. When I enter the edit mode (C-c ') it connects to plantuml server
(that I don't like), and produces the error that you have specified:
"Wrong type argument: stringp, nil".

2. Pressing C-c C-c in the edit buffer opens up plantuml preview but it
gives some error: "The plugin you are using seems to generate a bad
URL".

I am on Emacs 28.x and default org 9.3.


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

* Re: How to evaluate source code while in the edit buffer?
  2020-12-04 17:41 ` Pankaj Jangid
@ 2020-12-04 18:59   ` Mirko Vukovic
  2020-12-04 19:11     ` Jean Louis
  2020-12-04 21:17   ` George Mauer
  1 sibling, 1 reply; 9+ messages in thread
From: Mirko Vukovic @ 2020-12-04 18:59 UTC (permalink / raw)
  To: Mirko Vukovic, pankaj, bugs; +Cc: emacs-orgmode

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

On Fri, Dec 4, 2020 at 12:41 PM Pankaj Jangid <pankaj@codeisgreat.org>
wrote:

> Mirko Vukovic <mirko.vukovic@gmail.com> writes:
>
> > My current workflow is
> >
> >    1. Enter edit buffer (C-c ')
> >    2. Perform edits in the window
> >    3. Exit edit mode (C-c ')
> >    4. Evaluate code (C-c C-c)
> >    5. Monitor changes to resulting png file
> >
> > I would prefer instead to skip step 3, and evaluate the code from within
> > the edit mode.
> >
> > Is it possible to execute code from the edit buffer?
>
> 1. When I enter the edit mode (C-c ') it connects to plantuml server
> (that I don't like), and produces the error that you have specified:
> "Wrong type argument: stringp, nil".
>
> 2. Pressing C-c C-c in the edit buffer opens up plantuml preview but it
> gives some error: "The plugin you are using seems to generate a bad
> URL".
>
> I am on Emacs 28.x and default org 9.3.
>

So I tried C-c C-c and got the same response as Pankaj.

I traced the code to understand better and saw that plant-uml-exec-mode can
have settings of server and jar

With the jar setting (and after pointing a few variables to the jar file),
I am getting a different error:

error in process sentinel: PLANTUML Preview failed: exited abnormally with
code 1

The plantuml.el code seems to

   1. start a process and then
   2. pass the plantuml string to the process.

It is at step 2 that the error is issued.

Mirko

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

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

* Re: How to evaluate source code while in the edit buffer?
  2020-12-04 18:59   ` Mirko Vukovic
@ 2020-12-04 19:11     ` Jean Louis
  2020-12-05  2:10       ` Pankaj Jangid
  0 siblings, 1 reply; 9+ messages in thread
From: Jean Louis @ 2020-12-04 19:11 UTC (permalink / raw)
  To: Mirko Vukovic; +Cc: emacs-orgmode, pankaj

* Mirko Vukovic <mirko.vukovic@gmail.com> [2020-12-04 22:00]:
> error in process sentinel: PLANTUML Preview failed: exited abnormally with
> code 1
> 
> The plantuml.el code seems to
> 
>    1. start a process and then
>    2. pass the plantuml string to the process.
> 
> It is at step 2 that the error is issued.

Maybe you wish to show that code? Did you maybe test it outside of
Emacs that it works well?


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

* Re: How to evaluate source code while in the edit buffer?
  2020-12-04 17:41 ` Pankaj Jangid
  2020-12-04 18:59   ` Mirko Vukovic
@ 2020-12-04 21:17   ` George Mauer
  2020-12-04 21:37     ` Tom Gillespie
  1 sibling, 1 reply; 9+ messages in thread
From: George Mauer @ 2020-12-04 21:17 UTC (permalink / raw)
  To: Mirko Vukovic, emacs-orgmode

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

+1 to this question. I have the exact same annoyance (would also be nice to
do some threading so it doesn't lock up emacs for a few seconds)

On Fri, Dec 4, 2020 at 2:28 PM Pankaj Jangid <pankaj@codeisgreat.org> wrote:

> Mirko Vukovic <mirko.vukovic@gmail.com> writes:
>
> > My current workflow is
> >
> >    1. Enter edit buffer (C-c ')
> >    2. Perform edits in the window
> >    3. Exit edit mode (C-c ')
> >    4. Evaluate code (C-c C-c)
> >    5. Monitor changes to resulting png file
> >
> > I would prefer instead to skip step 3, and evaluate the code from within
> > the edit mode.
> >
> > Is it possible to execute code from the edit buffer?
>
> 1. When I enter the edit mode (C-c ') it connects to plantuml server
> (that I don't like), and produces the error that you have specified:
> "Wrong type argument: stringp, nil".
>
> 2. Pressing C-c C-c in the edit buffer opens up plantuml preview but it
> gives some error: "The plugin you are using seems to generate a bad
> URL".
>
> I am on Emacs 28.x and default org 9.3.
>
>

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

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

* Re: How to evaluate source code while in the edit buffer?
  2020-12-04 21:17   ` George Mauer
@ 2020-12-04 21:37     ` Tom Gillespie
  0 siblings, 0 replies; 9+ messages in thread
From: Tom Gillespie @ 2020-12-04 21:37 UTC (permalink / raw)
  To: gmauer; +Cc: emacs-orgmode, Mirko Vukovic

While we're on the subject of execution in the edit buffer, it is not
entirely clear what such execution would mean. Mirko's desire seems to
be to execute the buffer directly without org-babel as an
intermediary. However, the most consistent approach would be a command
to pop back to the source buffer from the edit buffer and use
org-babel-execute-src-block to run the code. If org were to provide
edit buffer evaluation it would likely have to be that. The reason for
this is that direct execution of code in the major mode of the edit
buffer is not well defined. For some languages (e.g. racket) there is
no easy way to evaluate a buffer that does not correspond directly to
a file on the file system, which is part of why org babel exists in
the first place (to define those semantics). In theory babel languages
could provide an alternate implementation for how an edit buffer can
be run, but absent such an implementation it would be up to the user
to figure out the semantics for each of the languages they wanted to
evaluate directly. Best,
Tom


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

* Re: How to evaluate source code while in the edit buffer?
  2020-12-04 19:11     ` Jean Louis
@ 2020-12-05  2:10       ` Pankaj Jangid
  0 siblings, 0 replies; 9+ messages in thread
From: Pankaj Jangid @ 2020-12-05  2:10 UTC (permalink / raw)
  To: Jean Louis; +Cc: emacs-orgmode, Mirko Vukovic

Jean Louis <bugs@gnu.support> writes:

>> error in process sentinel: PLANTUML Preview failed: exited abnormally with
>> code 1
>> 
>> The plantuml.el code seems to
>> 
>>    1. start a process and then
>>    2. pass the plantuml string to the process.
>> 
>> It is at step 2 that the error is issued.
>
> Maybe you wish to show that code? Did you maybe test it outside of
> Emacs that it works well?

Even inside Emacs it works. When we exit the plantuml specific edit
buffer and press C-c C-c in the souce code block.


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

end of thread, other threads:[~2020-12-05  2:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-04 13:58 How to evaluate source code while in the edit buffer? Mirko Vukovic
2020-12-04 14:26 ` Jean Louis
2020-12-04 17:09   ` Pankaj Jangid
2020-12-04 17:41 ` Pankaj Jangid
2020-12-04 18:59   ` Mirko Vukovic
2020-12-04 19:11     ` Jean Louis
2020-12-05  2:10       ` Pankaj Jangid
2020-12-04 21:17   ` George Mauer
2020-12-04 21:37     ` Tom Gillespie

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