Re: [O] tangle and comments.

2017-10-31 Thread Yury G. Kudryashov
Uwe Brauer writes:

> Thanks but the following file does not work neither
> that is running  org-babel-tangle gives me
> Tangled 0 code blocks from
You should add ":tangle yes" or ":tangle output.el" to header-args.

>  tangling with yes or link comments
> :header-args: :comments org
> :END:
> The top block
> #+begin_src emacs-lisp :comments org
>   (message "first block")
> #+end_src
> here's some text which won't be tangled
According to, this line won't be
tangled, because there are no other source code blocks after this line,
but before the next heading.
Sincerely yours,
Yury G. Kudryashov

[O] Edit whole session with org-edit-src-edit

2017-10-08 Thread Yury G. Kudryashov

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

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