emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Shaun Johnson <shaun@slugfest.demon.co.uk>
To: Org Mode <emacs-orgmode@gnu.org>
Subject: [PATCH] Make tangling work in an indirect buffer
Date: Wed, 09 Mar 2011 16:57:23 +0000	[thread overview]
Message-ID: <4D77B173.3030904@slugfest.demon.co.uk> (raw)

[-- Attachment #1: Type: text/plain, Size: 516 bytes --]

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.

[-- Attachment #2: 0001-Babel-Stop-tangling-failing-in-an-indirect-buffer.patch --]
[-- Type: text/plain, Size: 1186 bytes --]

From d11bae118dcc1e69fd148002a55e4ae29551c319 Mon Sep 17 00:00:00 2001
From: Shaun Johnson <shaun@slugfest.demon.co.uk>
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


             reply	other threads:[~2011-03-09 16:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-09 16:57 Shaun Johnson [this message]
2011-04-15 15:57 ` [PATCH] Make tangling work in an indirect buffer Eric Schulte

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=4D77B173.3030904@slugfest.demon.co.uk \
    --to=shaun@slugfest.demon.co.uk \
    --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).