Re: [O] 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-22 Thread Nicolas Goaziou
Hello,

Christian Dietrich  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



[O] 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-19 Thread Christian Dietrich
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/)

>From 7901afc9c9b535cf2b5a523c4610ada37a468dfb Mon Sep 17 00:00:00 2001
From: Christian Dietrich 
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