emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Tangling from indirect buffer
@ 2015-09-04 10:14 Rainer M Krug
  2015-09-04 14:49 ` Kyle Meyer
  0 siblings, 1 reply; 7+ messages in thread
From: Rainer M Krug @ 2015-09-04 10:14 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi

it seems that tangling from an indirect buffer does not work. Is this by
design or a bug?

Would it be possible to make this possible? I am working a lot in
indirect buffers (one subfolder R packages, another analysis of data, a
third one results) and would very much like to tangle from them instead of
having to go back to the actual buffer.

Thanks,

Rainer

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug

PGP: 0x0F52F982

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 480 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Tangling from indirect buffer
  2015-09-04 10:14 Tangling from indirect buffer Rainer M Krug
@ 2015-09-04 14:49 ` Kyle Meyer
  2015-09-04 20:18   ` Martin Carlé
  2015-09-07  8:46   ` Rainer M Krug
  0 siblings, 2 replies; 7+ messages in thread
From: Kyle Meyer @ 2015-09-04 14:49 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode

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

Rainer M Krug <Rainer@krugs.de> writes:

> Hi
>
> it seems that tangling from an indirect buffer does not work. Is this by
> design or a bug?

I don't think that's by design.

> Would it be possible to make this possible?

Does the below patch work for you?  If so, I can test it more thoroughly
and send a proper patch.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: tangle-indirect.patch --]
[-- Type: text/x-diff, Size: 774 bytes --]

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index d20c2b3..cf48db3 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -242,7 +242,7 @@ (defun org-babel-tangle (&optional arg target-file lang)
 			 (base-name (cond
 				     ((string= "yes" tangle)
 				      (file-name-sans-extension
-				       (buffer-file-name)))
+				       (nth 1 spec)))
 				     ((string= "no" tangle) nil)
 				     ((> (length tangle) 0) tangle)))
 			 (file-name (when base-name
@@ -427,7 +427,7 @@ (defun org-babel-tangle-single-block
 	 (start-line
 	  (save-restriction (widen)
 			    (+ 1 (line-number-at-pos (point)))))
-	 (file (buffer-file-name))
+	 (file (buffer-file-name (buffer-base-buffer)))
 	 (src-lang (nth 0 info))
 	 (params (nth 2 info))
 	 (extra (nth 3 info))

[-- Attachment #3: Type: text/plain, Size: 9 bytes --]


--
Kyle

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: Tangling from indirect buffer
  2015-09-04 14:49 ` Kyle Meyer
@ 2015-09-04 20:18   ` Martin Carlé
  2015-09-07  8:46   ` Rainer M Krug
  1 sibling, 0 replies; 7+ messages in thread
From: Martin Carlé @ 2015-09-04 20:18 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode

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

Indirect buffers are of immense help but I had the same issue.

Can confirm that the hack referring to spec instead to the
buffer-file-name and getting the buffer-base-buffer respectively, does
the trick.

Great!

On 2015-09-04 Fri 17:49, Kyle Meyer wrote:

> Rainer M Krug <Rainer@krugs.de> writes:
>
>> Hi
>>
>> it seems that tangling from an indirect buffer does not work. Is this by
>> design or a bug?
>
> I don't think that's by design.
>
>> Would it be possible to make this possible?
>
> Does the below patch work for you?  If so, I can test it more thoroughly
> and send a proper patch.

-- 
Fetch my gnupg key:
gpg --keyserver pgp.mit.edu --recv-keys 7E3CA33F

[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 805 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: Tangling from indirect buffer
  2015-09-04 14:49 ` Kyle Meyer
  2015-09-04 20:18   ` Martin Carlé
@ 2015-09-07  8:46   ` Rainer M Krug
  2015-09-09  3:55     ` [PATCH] Fix tangling in indirect buffers Kyle Meyer
  1 sibling, 1 reply; 7+ messages in thread
From: Rainer M Krug @ 2015-09-07  8:46 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode

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

Kyle Meyer <kyle@kyleam.com> writes:

> Rainer M Krug <Rainer@krugs.de> writes:
>
>> Hi
>>
>> it seems that tangling from an indirect buffer does not work. Is this by
>> design or a bug?
>
> I don't think that's by design.
>
>> Would it be possible to make this possible?
>
> Does the below patch work for you?  If so, I can test it more thoroughly
> and send a proper patch.

Yes - works perfectly. I would really appreciate this. Please submit.

Thanks,

Rainer
>
>
>
> --
> Kyle

-- 
Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany)

Centre of Excellence for Invasion Biology
Stellenbosch University
South Africa

Tel :       +33 - (0)9 53 10 27 44
Cell:       +33 - (0)6 85 62 59 98
Fax :       +33 - (0)9 58 10 27 44

Fax (D):    +49 - (0)3 21 21 25 22 44

email:      Rainer@krugs.de

Skype:      RMkrug

PGP: 0x0F52F982

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 480 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH] Fix tangling in indirect buffers
  2015-09-07  8:46   ` Rainer M Krug
@ 2015-09-09  3:55     ` Kyle Meyer
  2015-09-09 11:40       ` Nicolas Goaziou
  0 siblings, 1 reply; 7+ messages in thread
From: Kyle Meyer @ 2015-09-09  3:55 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode

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

Rainer M Krug <Rainer@krugs.de> writes:

> Kyle Meyer <kyle@kyleam.com> writes:
>
>> Rainer M Krug <Rainer@krugs.de> writes:
>>
>>> Hi
>>>
>>> it seems that tangling from an indirect buffer does not work. Is this by
>>> design or a bug?
>>
>> I don't think that's by design.
>>
>>> Would it be possible to make this possible?
>>
>> Does the below patch work for you?  If so, I can test it more thoroughly
>> and send a proper patch.
>
> Yes - works perfectly. I would really appreciate this. Please submit.

Patch against maint attached.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-tangling-in-indirect-buffers.patch --]
[-- Type: text/x-diff, Size: 1347 bytes --]

From 57beac5636d8be61c0e778d8b3f6da9d6ad208a6 Mon Sep 17 00:00:00 2001
From: Kyle Meyer <kyle@kyleam.com>
Date: Tue, 8 Sep 2015 23:48:44 -0400
Subject: [PATCH] Fix tangling in indirect buffers

* lisp/ob-tangle.el (org-babel-tangle-single-block): Get file name from
  base buffer.
(org-babel-tangle): Use file name from attribute list returned by
org-babel-tangle-single-block.

Reported-by: Rainer M Krug <Rainer@krugs.de>
<http://permalink.gmane.org/gmane.emacs.orgmode/100845>
---
 lisp/ob-tangle.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index d20c2b3..cf48db3 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -242,7 +242,7 @@ (defun org-babel-tangle (&optional arg target-file lang)
 			 (base-name (cond
 				     ((string= "yes" tangle)
 				      (file-name-sans-extension
-				       (buffer-file-name)))
+				       (nth 1 spec)))
 				     ((string= "no" tangle) nil)
 				     ((> (length tangle) 0) tangle)))
 			 (file-name (when base-name
@@ -427,7 +427,7 @@ (defun org-babel-tangle-single-block
 	 (start-line
 	  (save-restriction (widen)
 			    (+ 1 (line-number-at-pos (point)))))
-	 (file (buffer-file-name))
+	 (file (buffer-file-name (buffer-base-buffer)))
 	 (src-lang (nth 0 info))
 	 (params (nth 2 info))
 	 (extra (nth 3 info))
-- 
2.5.1


[-- Attachment #3: Type: text/plain, Size: 9 bytes --]


--
Kyle

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix tangling in indirect buffers
  2015-09-09  3:55     ` [PATCH] Fix tangling in indirect buffers Kyle Meyer
@ 2015-09-09 11:40       ` Nicolas Goaziou
  2015-09-09 13:57         ` Kyle Meyer
  0 siblings, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2015-09-09 11:40 UTC (permalink / raw)
  To: Kyle Meyer; +Cc: emacs-orgmode

Helo,

Kyle Meyer <kyle@kyleam.com> writes:

> Patch against maint attached.

LGTM. Thank you.

> -	 (file (buffer-file-name))
> +	 (file (buffer-file-name (buffer-base-buffer)))

I think there are some occurrences like this one in the code base that
should be fixed during some rainy day.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] Fix tangling in indirect buffers
  2015-09-09 11:40       ` Nicolas Goaziou
@ 2015-09-09 13:57         ` Kyle Meyer
  0 siblings, 0 replies; 7+ messages in thread
From: Kyle Meyer @ 2015-09-09 13:57 UTC (permalink / raw)
  To: Rainer M Krug; +Cc: emacs-orgmode

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Kyle Meyer <kyle@kyleam.com> writes:
>
>> Patch against maint attached.
>
> LGTM. Thank you.

Thanks for having a look. Pushed.

--
Kyle

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-09-09 13:57 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-04 10:14 Tangling from indirect buffer Rainer M Krug
2015-09-04 14:49 ` Kyle Meyer
2015-09-04 20:18   ` Martin Carlé
2015-09-07  8:46   ` Rainer M Krug
2015-09-09  3:55     ` [PATCH] Fix tangling in indirect buffers Kyle Meyer
2015-09-09 11:40       ` Nicolas Goaziou
2015-09-09 13:57         ` Kyle Meyer

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).