From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: automatic tangle Date: Sat, 14 Jan 2012 10:41:01 -0700 Message-ID: <871ur26v2q.fsf@gmx.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:36356) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rm7bL-0007n1-ID for emacs-orgmode@gnu.org; Sat, 14 Jan 2012 12:41:12 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rm7bK-0003uR-7X for emacs-orgmode@gnu.org; Sat, 14 Jan 2012 12:41:11 -0500 Received: from mailout-us.gmx.com ([74.208.5.67]:54278 helo=mailout-us.mail.com) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1Rm7bK-0003uD-2R for emacs-orgmode@gnu.org; Sat, 14 Jan 2012 12:41:10 -0500 In-Reply-To: (=?utf-8?Q?=22Andr=C3=A1s?= Major"'s message of "Wed, 11 Jan 2012 20:21:37 +0100") 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: =?utf-8?Q?Andr=C3=A1s?= Major Cc: emacs-orgmode Andr=C3=A1s Major 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 h= ave 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, --=20 Eric Schulte http://cs.unm.edu/~eschulte/