From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [PATCH] Make tangling work in an indirect buffer Date: Fri, 15 Apr 2011 09:57:25 -0600 Message-ID: <87ei53a3d9.fsf@gmail.com> References: <4D77B173.3030904@slugfest.demon.co.uk> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([140.186.70.92]:43397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAlqa-0001WQ-2h for emacs-orgmode@gnu.org; Fri, 15 Apr 2011 12:26:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QAlqW-0006pe-Cg for emacs-orgmode@gnu.org; Fri, 15 Apr 2011 12:26:16 -0400 Received: from mail-pw0-f41.google.com ([209.85.160.41]:37331) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QAlqW-0006pa-4a for emacs-orgmode@gnu.org; Fri, 15 Apr 2011 12:26:12 -0400 Received: by pwi10 with SMTP id 10so1591118pwi.0 for ; Fri, 15 Apr 2011 09:26:11 -0700 (PDT) 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: Shaun Johnson Cc: Org Mode Hi Shaun, Thanks for sharing this patch, I have just applied it. And yes, this is my preferred format for sharing a patch. Sorry about the delay, I missed this email initially. Adding a "[babel]" tag to the subject line of emails related to Babel code will help ensure that they are noticed. Thanks again for the patch! -- Eric Shaun Johnson writes: > The attached patch makes tangling (org-babel-tangle) work > in indirect buffers. Previously it would fail before running > org-babel-post-tangle-hook because indirect have a buffer-file-name > of nil whereas the code was expecting a string in the following > fragment: > > (message "tangled %d code block%s from %s" block-counter > (if (= block-counter 1) "" "s") > (file-name-nondirectory (buffer-file-name (or > (buffer-base-buffer) (current-buffer))))) > > > I hope the patch is in the correct format. > > Shaun. > From d11bae118dcc1e69fd148002a55e4ae29551c319 Mon Sep 17 00:00:00 2001 > From: Shaun Johnson > Date: Wed, 9 Mar 2011 15:32:40 +0000 > Subject: [PATCH] Babel: Stop tangling failing in an indirect buffer > > * ob-tangle.el (org-babel-tangle): Make it work in an indirect buffer. > > The problem was that the message generated after tangling included the > file name of the current buffer which was nil in an indirect buffer. > > TINYCHANGE > --- > lisp/ob-tangle.el | 2 +- > 1 files changed, 1 insertions(+), 1 deletions(-) > > diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el > index 4e203be..f7f7047 100644 > --- a/lisp/ob-tangle.el > +++ b/lisp/ob-tangle.el > @@ -243,7 +243,7 @@ exported source code blocks by language." > (org-babel-tangle-collect-blocks lang)) > (message "tangled %d code block%s from %s" block-counter > (if (= block-counter 1) "" "s") > - (file-name-nondirectory (buffer-file-name (current-buffer)))) > + (file-name-nondirectory (buffer-file-name (or (buffer-base-buffer) (current-buffer))))) > ;; run `org-babel-post-tangle-hook' in all tangled files > (when org-babel-post-tangle-hook > (mapc -- Eric Schulte http://cs.unm.edu/~eschulte/