emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Eric Schulte <eric.schulte@gmx.com>
To: "András Major" <andras.g.major@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: Re: automatic tangle
Date: Sat, 14 Jan 2012 10:41:01 -0700	[thread overview]
Message-ID: <871ur26v2q.fsf@gmx.com> (raw)
In-Reply-To: <CALPHr6z_vk3aojF=O6YqKs4VpahQzO1qDKCxcC9EtevbKPG9yw@mail.gmail.com> ("András Major"'s message of "Wed, 11 Jan 2012 20:21:37 +0100")

András Major <andras.g.major@gmail.com> 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/

  parent reply	other threads:[~2012-01-14 17:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-11 19:21 automatic tangle András Major
2012-01-11 20:37 ` Sebastien Vauban
2012-01-14 17:41 ` Eric Schulte [this message]
2012-01-17  8:06   ` András Major
2012-01-20 17:54     ` Eric Schulte
  -- strict thread matches above, loose matches on Subject: below --
2012-01-11 14:36 András Major
2012-01-11 15:18 ` Sebastien Vauban
2012-01-11 22:39 ` Eric S Fraga

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871ur26v2q.fsf@gmx.com \
    --to=eric.schulte@gmx.com \
    --cc=andras.g.major@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).