emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* How to utilize the vc package inside of the edit source block buffer?
@ 2014-09-23 17:15 Grant Rettke
  2014-09-23 18:19 ` Aaron Ecay
  0 siblings, 1 reply; 4+ messages in thread
From: Grant Rettke @ 2014-09-23 17:15 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

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?

My apologies as I have not been able to locate the post where this
topic was originally discussed.

Kind regards,

-- 
Grant Rettke
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to utilize the vc package inside of the edit source block buffer?
  2014-09-23 17:15 How to utilize the vc package inside of the edit source block buffer? Grant Rettke
@ 2014-09-23 18:19 ` Aaron Ecay
  2014-09-23 18:52   ` Jonathan Leech-Pepin
  0 siblings, 1 reply; 4+ messages in thread
From: Aaron Ecay @ 2014-09-23 18:19 UTC (permalink / raw)
  To: Grant Rettke, emacs-orgmode@gnu.org

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)

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to utilize the vc package inside of the edit source block buffer?
  2014-09-23 18:19 ` Aaron Ecay
@ 2014-09-23 18:52   ` Jonathan Leech-Pepin
  2014-09-27 23:33     ` Grant Rettke
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Leech-Pepin @ 2014-09-23 18:52 UTC (permalink / raw)
  To: Grant Rettke, emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1355 bytes --]

Hello,

On 23 September 2014 14:19, Aaron Ecay <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
> 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
>
>

[-- Attachment #2: Type: text/html, Size: 2245 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to utilize the vc package inside of the edit source block buffer?
  2014-09-23 18:52   ` Jonathan Leech-Pepin
@ 2014-09-27 23:33     ` Grant Rettke
  0 siblings, 0 replies; 4+ messages in thread
From: Grant Rettke @ 2014-09-27 23:33 UTC (permalink / raw)
  To: Jonathan Leech-Pepin; +Cc: emacs-orgmode@gnu.org

Thank you Aaron and Jonathan.

Here is what I did:

(defadvice vc-next-action (before vc-next-action-in-org-src-block last activate)
  "If in org source block, exit it."
  (when (condition-case nil
            (org-src-in-org-buffer)
          (error nil))
    (org-edit-src-exit)))

I had trouble with the latter and I suspect it is due to my personal
configuration. That would be quite nice indeed to be able to keep the
org source edit buffer open.

On Tue, Sep 23, 2014 at 1:52 PM, Jonathan Leech-Pepin
<jonathan.leechpepin@gmail.com> wrote:
> Hello,
>
> On 23 September 2014 14:19, Aaron Ecay <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
>> > 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
>>
>



-- 
Grant Rettke
gcr@wisdomandwonder.com | http://www.wisdomandwonder.com/
“Wisdom begins in wonder.” --Socrates
((λ (x) (x x)) (λ (x) (x x)))
“Life has become immeasurably better since I have been forced to stop
taking it seriously.” --Thompson

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-09-27 23:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-23 17:15 How to utilize the vc package inside of the edit source block buffer? Grant Rettke
2014-09-23 18:19 ` Aaron Ecay
2014-09-23 18:52   ` Jonathan Leech-Pepin
2014-09-27 23:33     ` Grant Rettke

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).