From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: automatic tangle Date: Wed, 11 Jan 2012 22:39:56 +0000 Message-ID: <8739bl3ltv.fsf@ucl.ac.uk> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([140.186.70.92]:36572) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rl6q5-0007X3-E6 for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 17:40:14 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rl6q4-000671-BD for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 17:40:13 -0500 Received: from vscane-b.ucl.ac.uk ([144.82.108.141]:63656) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rl6q4-00063E-6s for emacs-orgmode@gnu.org; Wed, 11 Jan 2012 17:40:12 -0500 In-Reply-To: (=?utf-8?Q?=22Andr=C3=A1s?= Major"'s message of "Wed, 11 Jan 2012 15:36:32 +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@gnu.org --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Andr=C3=A1s Major writes: > Hi fellows, > > I've just discovered that I'm missing a feature in org-mode. These > days I write much of my code in an Org buffer and tangle it into a set > of source files. Currently, I follow a rather cumbersome procedure > when making changes to the code: > > 1. I change the Org file using the C-cC-c keystroke within the code > block I want to edit. > > 2. After editing, I press C-cc-c again to return to the main buffer. > > 3. I save the buffer. > > 4. I tangle the buffer using C-cC-vt. > > 5. For further editing, I press C-cC-c again. > > I know that 3. is optional, but this still leaves me with four steps > instead of (ideally) just one. > > What I would like to have is a way of reducing all this to just one > key command. Would it make sense to introduce such a command that > simply tangles the entire buffer, including the changes made in the > language-specific buffer, but leaving that buffer open for editing? > If it's a reasonably small change, could anyone introduce it? (I > don't have time to delve into the depths of org-mode.) > > Cheers, > > Andr=C3=A1s Probably not what you want but, assuming that the keys you hit are always the same, you could always define a keyboard macro, name it and save it as emacs lisp code. for example, the attached (because the insert-kbd-macro command creates emacs lisp code with control characters) defines a new command which, if starting from a code block special edit mode, exits that block, saves the file, tangles the whole buffer and re-enters the code block: You can then bind this new command to a key of your choice. Untested... --=-=-= Content-Type: text/orgmode Content-Disposition: attachment; filename=t.org Content-Transfer-Encoding: 8bit Content-Description: function definition * new function Allows one to exit a special code block editing mode, save the file, tangle all code blocks and then re-enter the code block editing mode. #+begin_src emacs-lisp (fset 'esf/org-save-tangle-reedit-macro (lambda (&optional arg) "Keyboard macro." (interactive "p") (kmacro-exec-ring-item (quote ("'t'" 0 "%d")) arg))) #+end_src --=-=-= Content-Type: text/plain HTH, eric -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.92.1 : using Org-mode version 7.8.03 (release_7.8.03.99.gce5c5) --=-=-=--