From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Leech-Pepin Subject: Re: How to utilize the vc package inside of the edit source block buffer? Date: Tue, 23 Sep 2014 14:52:38 -0400 Message-ID: References: <87mw9qnqre.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a11c12af28909540503c013ce Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47423) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWVD1-0000fb-G5 for emacs-orgmode@gnu.org; Tue, 23 Sep 2014 14:53:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XWVCz-0005Ts-St for emacs-orgmode@gnu.org; Tue, 23 Sep 2014 14:53:07 -0400 Received: from mail-qc0-x232.google.com ([2607:f8b0:400d:c01::232]:64341) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XWVCz-0005QA-Nk for emacs-orgmode@gnu.org; Tue, 23 Sep 2014 14:53:05 -0400 Received: by mail-qc0-f178.google.com with SMTP id x13so2196292qcv.23 for ; Tue, 23 Sep 2014 11:52:59 -0700 (PDT) In-Reply-To: <87mw9qnqre.fsf@gmail.com> 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: Grant Rettke , "emacs-orgmode@gnu.org" --001a11c12af28909540503c013ce Content-Type: text/plain; charset=UTF-8 Hello, On 23 September 2014 14:19, Aaron Ecay wrote: > Hi Grant, > > 2014ko irailak 23an, Grant Rettke-ek idatzi zuen: > > > > Good afternoon, > > > > The ability to org-edit-special inside of source block is truly > priceless. > > > > There is a delightful workflow to be found with approach. > > > > It has got me spending more and more time in the edit buffer though, > > wanting to utilize > > vc-next-action to initiate a commit. This is not possible because the > > buffer is not associated > > with a file. > > > > Is there some way to get tell Emacs to execute the action on the > > source buffer from which the > > source edit block buffer originated? > > One approach might be to advise the vc commands like (pseudocode): > > (defadvice vc-foo (around org-src activate) > (when (in-src-edit-p) > (org-edit-src-exit)) > ad-do-it) > > The following would work as a wrapper: (defun test-buffer () (interactive) (when org-edit-src-from-org-mode (let ((buffer (marker-buffer org-edit-src-beg-marker))) (with-current-buffer buffer (message "%s is current for file: %s" (current-buffer) (buffer-file-name)))))) Replace (message ...) with `vc-next-action` or use the above as advice [adjusting from (when..) to (if..)]. Regards, Jonathan > -- > Aaron Ecay > > --001a11c12af28909540503c013ce Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello,

On 23 September 2014 14:19, Aaron Ecay &= lt;aaronecay@gmail= .com> wrote:
Hi Grant,

2014ko irailak 23an, Grant Rettke-ek idatzi zuen:
>
> Good afternoon,
>
> The ability to org-edit-special inside of source block is truly pricel= ess.
>
> There is a delightful workflow to be found with approach.
>
> It has got me spending more and more time in the edit buffer though, > wanting to utilize
> vc-next-action to initiate a commit. This is not possible because the<= br> > buffer is not associated
> with a file.
>
> Is there some way to get tell Emacs to execute the action on the
> source buffer from which the
> source edit block buffer originated?

One approach might be to advise the vc commands like (pseudocode):
(defadvice vc-foo (around org-src activate)
=C2=A0 (when (in-src-edit-p)
=C2=A0 =C2=A0 (org-edit-src-exit))
=C2=A0 ad-do-it)


The following would work as a wrapper:

(defun test-= buffer ()
=C2=A0 (interactive)
=C2=A0 (when org-edit-src-from-org-mod= e
=C2=A0=C2=A0=C2=A0 (let ((buffer (marker-buffer org-edit-src-beg-marke= r)))
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (with-current-buffer buffer
=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (message "%s is current for fi= le: %s"
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 (current-buffer)
=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (buffer-file-name))))))

Replace (message ...) with= `vc-next-action` or use the above as advice [adjusting from (when..) to (i= f..)].

Regards,
Jonathan
=C2=A0
--
Aaron Ecay


--001a11c12af28909540503c013ce--