org-remark
org-remark copied to clipboard
source code edit buffer in org-mode
Hi When working with code blocks in org-mode it would be useful if we could use org-remark when we are in the code edit buffer that you get after doing C-c '. Currently it says buffer is not supported.
thanks FKG
How is it useful to you? What would happen to the highlight after you close the source code buffer? I believe it is meant to be a temporary buffer so the highlight would also go away once you close the buffer.
I would like the highlight to appear on the org file. Any highlight on any of the tmp buffers should appear on the actual org file just like any changes made in the tmp buffer are updated in the org file after you do C-' again.
I had a quick look at how org-src does this. I am afraid my current conclusion is that my skill is not good enough to achieve what you are asking for, and I don't have capacity to look at upskilling at the moment.
To me a core of the challenge is the way how the overlay works and hightlights are overlays. An overlay belongs to a buffer, not to the text string. This means when you close the src-edit temp buffer, you somehow need to make a new overlay in the original org buffer.
Somehow src-edit smartly works out the indentation, so the the temp buffer can have different indentation from the original org buffer.
This means... I don't know a good way to make a new overlay in the exactly the same relative position as in the temp buffer.
I also considered utilizing text-properties to represent highlights -- text-prop belongs to the text string. But org-src-exit seems to strips off the text-prop when it copies the temp buffer content over to the original -- so text-props won't be added to the text string in the original...
This is as far as I can get to for now.
I wonder if you or someone who can code can jump in and help. I'd be happy to see a PR on this, so I will keep the issue open.
As I finished writing the above, there might be some possible direction for implementation. Both are rather mid- or long-term perspective. This is a note for those who might come to help for implementation (or me later)
Two possible implementations to resolve the "relative location" issue:
- Highlight positions for line(s)
- Dynamic adjustment like we do with ebub support
Programming source code has the line-by-line nature; so this should work for indentation offsetting.
There will still be issues on "moving" between the original org buffer and the src temp buffer.
thanks for thinking about the problem!