>>> I don't understand what your use-case is. Note that `org-edit-special' >>> already preserves region. >> >> That's good, but not what I need. I want to go from an unmarked region >> in an org file with markup >> to a marked region without markup in the *Org Src* buffer. > > That still doesn't explain why you need it.
To automate things. I'm writing a function reference for a package here: https://raw.githubusercontent.com/abo-abo/lispy/gh-pages/index.org. Here's the link in case you don't want to compile the org-file: http://abo-abo.github.io/lispy/. Some of the source blocks in this document feature a marked region that I export marked to HTML. Most source blocks are step-by-step examples that assume a certain point and region state in order to work. And it's nice to automatically set the region state in order to text out an example. > >> I've defined a custom `org-babel-edit-prep:elisp' that does this, but >> it's not allowed to mark region in this function. > > Why? Well, I can call `set-mark' in this function, but it won't work unless the function that calls it binds `deactivate-mark' to nil. > >> Just to sum it up: I want a custom `org-babel-edit-prep:elisp' to be >> able to mark region, even if it wasn't marked before. > > Your markup is very personal. I still don't see the need to turn it into > a general mechanism. Well, I'm not trying to push my markup or anything, I just want my custom `org-babel-edit-prep:elisp' to be able to mark the region. Currently I'm not given that option. > Isn't an advice enough? I don't know how this would work. `org-babel-edit-prep:elisp' is already the exit point of `org-edit-src-code' and it's not allowed to mark the region. regards, Oleh