From mboxrd@z Thu Jan 1 00:00:00 1970 From: Oleh Subject: Re: [PATCH] org-src: allow `org-babel-edit-prep:.*' to mark region Date: Sat, 29 Nov 2014 15:34:50 +0100 Message-ID: References: <8761dynnca.fsf@nicolasgoaziou.fr> <871tomnldi.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:54959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xuj6q-0003T6-J1 for emacs-orgmode@gnu.org; Sat, 29 Nov 2014 09:34:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xuj6p-0000XJ-LF for emacs-orgmode@gnu.org; Sat, 29 Nov 2014 09:34:52 -0500 Received: from mail-wg0-x22b.google.com ([2a00:1450:400c:c00::22b]:64928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xuj6p-0000XD-Cp for emacs-orgmode@gnu.org; Sat, 29 Nov 2014 09:34:51 -0500 Received: by mail-wg0-f43.google.com with SMTP id l18so10832238wgh.16 for ; Sat, 29 Nov 2014 06:34:50 -0800 (PST) In-Reply-To: <871tomnldi.fsf@nicolasgoaziou.fr> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: org mode >>> 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