emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Bug: org-babel-tangle-file [9.2.4 (9.2.4-3-g7bc6f8-elpaplus @ /home/stettberger/.emacs.d/elpa/org-plus-contrib-20190701/)]
@ 2019-08-13 13:49 Christian Dietrich
  2019-08-22  7:51 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Christian Dietrich @ 2019-08-13 13:49 UTC (permalink / raw)
  To: emacs-orgmode

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

Hi!

I think a found a bug in org-babel-tangle-file. It closes an user-opened
buffer if called with a symlink that points to the same file. Please see
the attached patch, which fixes the problem for me.

chris

Emacs  : GNU Emacs 27.0.50 (build 5, x86_64-pc-linux-gnu, GTK+ Version 3.24.0)
 of 2018-10-06
Package: Org mode version 9.2.4 (9.2.4-3-g7bc6f8-elpaplus @ /home/stettberger/.emacs.d/elpa/org-plus-contrib-20190701/)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-bug-in-org-babel-tangle-file-with-symlinked-file.patch --]
[-- Type: text/x-diff, Size: 1116 bytes --]

From 7901afc9c9b535cf2b5a523c4610ada37a468dfb Mon Sep 17 00:00:00 2001
From: Christian Dietrich <stettberger@dokucode.de>
Date: Tue, 13 Aug 2019 15:43:03 +0200
Subject: [PATCH] Fix bug in org-babel-tangle-file with symlinked files

Assume that there is file A and symlink B that points to file A. If
there is an open buffer that points to A and we
call (org-babel-tangle-file "B"), then this function kills the buffer
since get-file-buffer does not follow symlinks.
---
 lisp/ob-tangle.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index f9f785910..7dbd618a6 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -174,7 +174,7 @@ export file for all source blocks.  Optional argument LANG can be
 used to limit the exported source code blocks by language.
 Return a list whose CAR is the tangled file name."
   (interactive "fFile to tangle: \nP")
-  (let ((visited-p (get-file-buffer (expand-file-name file)))
+  (let ((visited-p (find-buffer-visiting (expand-file-name file)))
 	to-be-removed)
     (prog1
 	(save-window-excursion
-- 
2.23.0.rc1


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

* Re: Bug: org-babel-tangle-file [9.2.4 (9.2.4-3-g7bc6f8-elpaplus @ /home/stettberger/.emacs.d/elpa/org-plus-contrib-20190701/)]
  2019-08-13 13:49 Bug: org-babel-tangle-file [9.2.4 (9.2.4-3-g7bc6f8-elpaplus @ /home/stettberger/.emacs.d/elpa/org-plus-contrib-20190701/)] Christian Dietrich
@ 2019-08-22  7:51 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2019-08-22  7:51 UTC (permalink / raw)
  To: Christian Dietrich; +Cc: emacs-orgmode

Hello,

Christian Dietrich <dietrich@sra.uni-hannover.de> writes:

> I think a found a bug in org-babel-tangle-file. It closes an user-opened
> buffer if called with a symlink that points to the same file. Please see
> the attached patch, which fixes the problem for me.

Applied. Thank you!

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2019-08-22  7:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-13 13:49 Bug: org-babel-tangle-file [9.2.4 (9.2.4-3-g7bc6f8-elpaplus @ /home/stettberger/.emacs.d/elpa/org-plus-contrib-20190701/)] Christian Dietrich
2019-08-22  7:51 ` Nicolas Goaziou

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