From mboxrd@z Thu Jan 1 00:00:00 1970 From: Shaun Johnson Subject: [PATCH] Make tangling work in an indirect buffer Date: Wed, 09 Mar 2011 16:57:23 +0000 Message-ID: <4D77B173.3030904@slugfest.demon.co.uk> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------090007000302020509090003" Return-path: Received: from [140.186.70.92] (port=36327 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PxMhZ-0002J2-O6 for emacs-orgmode@gnu.org; Wed, 09 Mar 2011 11:57:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PxMhY-0000gh-Dk for emacs-orgmode@gnu.org; Wed, 09 Mar 2011 11:57:33 -0500 Received: from anchor-post-1.mail.demon.net ([195.173.77.132]:37995) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PxMhY-0000gC-87 for emacs-orgmode@gnu.org; Wed, 09 Mar 2011 11:57:32 -0500 Received: from slugfest.demon.co.uk ([80.177.204.141] helo=[192.168.100.4]) by anchor-post-1.mail.demon.net with esmtp (Exim 4.69) id 1PxMhW-00055x-iA for emacs-orgmode@gnu.org; Wed, 09 Mar 2011 16:57:30 +0000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Org Mode This is a multi-part message in MIME format. --------------090007000302020509090003 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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. --------------090007000302020509090003 Content-Type: text/plain; name="0001-Babel-Stop-tangling-failing-in-an-indirect-buffer.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename*0="0001-Babel-Stop-tangling-failing-in-an-indirect-buffer.patch" >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 -- 1.7.4.msysgit.0 --------------090007000302020509090003--