emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Edit whole session with org-edit-src-edit
@ 2017-10-08 22:58 Yury G. Kudryashov
  2017-10-09  2:40 ` Berry, Charles
  2017-10-10  7:25 ` Nicolas Goaziou
  0 siblings, 2 replies; 4+ messages in thread
From: Yury G. Kudryashov @ 2017-10-08 22:58 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

I want to use orgmode for literate programming with Coq.
I like the "edit in major mode" org-edit-src-edit feature, but it
exports only the current src block to the temprorary buffer, so it's
impossible to debug the file in the temporary buffer using coq-mode
(proofgeneral) "phrase by phrase" execution.

I think that some other languages may have similar problems. Say,
code completion works better, if the whole file is available.

I propose the following feature:

1. When the temporary buffer is created,

   - the whole session (or all the code with that will go to one file
     when tangling) is written to the buffer;
   - all the code except for the current block is marked as read-only.

2. When writing the temporary buffer back to the main file, drop the
     read-only regions.

An even more useful (though may be harder to implement) version:

1. When the temporary buffer is created,

   - then whole session is written to the temporary buffer;
   - before each block, a commented line with some meta-data (original
     buffer, line range, src-block #+NAME attribute) is inserted;
   - these commented lines are made read-only, while the blocks are left
     read-write.

2. When writing back, each block is rewritten.

This way a user may have file headers (#include in C/C++, imports in
Python etc) in one #src block, and easily modify it while editing some
"main" code in a temporary buffer.

Unfortunately, I'm new to (e)lisp, so I'm not sure whether I'll manage
to implement these features myself.
-- 
Sincerely yours,
Yury G. Kudryashov

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

* Re: Edit whole session with org-edit-src-edit
  2017-10-08 22:58 Edit whole session with org-edit-src-edit Yury G. Kudryashov
@ 2017-10-09  2:40 ` Berry, Charles
  2017-10-09 11:28   ` urkud
  2017-10-10  7:25 ` Nicolas Goaziou
  1 sibling, 1 reply; 4+ messages in thread
From: Berry, Charles @ 2017-10-09  2:40 UTC (permalink / raw)
  To: Yury G. Kudryashov; +Cc: emacs-orgmode@gnu.org


> On Oct 8, 2017, at 3:58 PM, Yury G. Kudryashov <urkud@urkud.name> wrote:
> 
> Hello,
> 
> I want to use orgmode for literate programming with Coq.
> I like the "edit in major mode" org-edit-src-edit feature, but it
> exports only the current src block to the temprorary buffer, so it's
> impossible to debug the file in the temporary buffer using coq-mode
> (proofgeneral) "phrase by phrase" execution.
> 
> I think that some other languages may have similar problems. Say,
> code completion works better, if the whole file is available.


I used the babel jump facility proposed here:

From: Andrew Kirkpatrick <ubermonk@gmail.com>
Subject: Jumping between source blocks in a file
Message-ID: <CAHo11d5aOTLAbR1gy9+9=h_zBgTREpg7HLfLTDuhUYyBwgFDKA@mail.gmail.com>
Archived-At: <http://permalink.gmane.org/gmane.emacs.orgmode/103130>

It is not `all blocks in one buffer', but by jumping from one to the next I get much the same effect.  Any changes in a block get written back to the org buffer when you jump to the next block.  Binding the `*-next' function to meta-down and `*-previous' to `meta-up' makes navigation intuitive.

HTH,

Chuck

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

* Re: Edit whole session with org-edit-src-edit
  2017-10-09  2:40 ` Berry, Charles
@ 2017-10-09 11:28   ` urkud
  0 siblings, 0 replies; 4+ messages in thread
From: urkud @ 2017-10-09 11:28 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

On October 8, 2017 10:40:09 PM EDT, "Berry, Charles" <ccberry@ucsd.edu> wrote:
>
>> On Oct 8, 2017, at 3:58 PM, Yury G. Kudryashov <urkud@urkud.name>
>wrote:
>> 
>> Hello,
>> 
>> I want to use orgmode for literate programming with Coq.
>> I like the "edit in major mode" org-edit-src-edit feature, but it
>> exports only the current src block to the temprorary buffer, so it's
>> impossible to debug the file in the temporary buffer using coq-mode
>> (proofgeneral) "phrase by phrase" execution.
>> 
>> I think that some other languages may have similar problems. Say,
>> code completion works better, if the whole file is available.
>
>
>I used the babel jump facility proposed here:
It doesn't help, if I want to debug a Coq proof using proofgeneral. I need to feed to coqtop all the text that should go before the current "phrase" in a file.
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

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

* Re: Edit whole session with org-edit-src-edit
  2017-10-08 22:58 Edit whole session with org-edit-src-edit Yury G. Kudryashov
  2017-10-09  2:40 ` Berry, Charles
@ 2017-10-10  7:25 ` Nicolas Goaziou
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2017-10-10  7:25 UTC (permalink / raw)
  To: Yury G. Kudryashov; +Cc: emacs-orgmode

Hello,

"Yury G. Kudryashov" <urkud@urkud.name> writes:

> I propose the following feature:
>
> 1. When the temporary buffer is created,
>
>    - the whole session (or all the code with that will go to one file
>      when tangling) is written to the buffer;
>    - all the code except for the current block is marked as read-only.
>
> 2. When writing the temporary buffer back to the main file, drop the
>      read-only regions.

This is an interesting idea. However that could slow down src block
editing so it would need to be explicitly required by the user (e.g.,
with an optional argument).

Also, it should be necessary to mark somehow the read-only parts or it
could be confusing. Maybe with some glyph in the margin.

> Unfortunately, I'm new to (e)lisp, so I'm not sure whether I'll manage
> to implement these features myself.

You can only know if you try. You will find help on this mailing list
whenever you hit a road block.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2017-10-10  7:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-08 22:58 Edit whole session with org-edit-src-edit Yury G. Kudryashov
2017-10-09  2:40 ` Berry, Charles
2017-10-09 11:28   ` urkud
2017-10-10  7:25 ` Nicolas Goaziou

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