emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] automatic tangle


From: Eric Schulte
Subject: Re: [O] automatic tangle
Date: Fri, 20 Jan 2012 10:54:52 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux)

I've just added the two functions below to org-src.el.

Cheers,

András Major <address@hidden> writes:

> Thanks Eric,
>
> Thanks a lot for the quick reply.  Any chances of this being
> incorporated into Org-Mode in the near future?
>
>   András
>
>
> On 1/14/12, Eric Schulte <address@hidden> wrote:
>> András Major <address@hidden> writes:
>>
>>> Hi Sebastien,
>>>
>>>> I have the impression it's already there: if you edit your code directly
>>>> in
>>>> the Org buffer, without opening an indirect buffer, the only thing you
>>>> have to
>>>> do is:
>>>
>>> That's precisely what I want to avoid.  I'd like to use the
>>> language-specific indentation and highlighting using the indirect
>>> buffer.  Basically, what I'm after is a quick keyboard command that
>>> tangles the entire file while I'm in the indirect buffer.
>>>
>>
>> The following functions provide for (1) easily executing code in the
>> org-mode buffer related to the current edit buffer and (2) tangling the
>> org-mode buffer related to the current edit buffer.  Binding (2) to a
>> key in `org-src-mode' should provide the functionality you describe.
>>
>> #+BEGIN_SRC emacs-lisp
>>   (defmacro org-src-in-org-buffer (&rest body)
>>     `(save-window-excursion
>>        (org-edit-src-exit 'save)
>>        ,@body
>>        (setq msg (current-message))
>>        (if (eq org-src-window-setup 'other-frame)
>>            (let ((org-src-window-setup 'current-window))
>>              (org-edit-src-code 'save))
>>          (org-edit-src-code 'save))
>>        (message (or msg ""))))
>>
>>   (defun org-src-tangle (arg)
>>     (interactive "P")
>>     (org-src-in-org-buffer (org-babel-tangle arg)))
>> #+END_SRC
>>
>> I think that the above should be folded into org-src.el, but I'm not
>> entirely sure how.  (1) could be used to perform a number of functions
>> in the org buffer from an edit buffer, although off the top of my head
>> I'm not sure if there exists a need for this aside from tangling.
>>
>> Best,
>>
>> --
>> Eric Schulte
>> http://cs.unm.edu/~eschulte/
>>
>

-- 
Eric Schulte
http://cs.unm.edu/~eschulte/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]