From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Dietrich Subject: Bug: org-babel-tangle-file [9.2.4 (9.2.4-3-g7bc6f8-elpaplus @ /home/stettberger/.emacs.d/elpa/org-plus-contrib-20190701/)] Date: Tue, 13 Aug 2019 15:49:16 +0200 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:34428) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hxXB4-0006HQ-HP for emacs-orgmode@gnu.org; Tue, 13 Aug 2019 09:49:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hxXB3-0005p2-F3 for emacs-orgmode@gnu.org; Tue, 13 Aug 2019 09:49:30 -0400 Received: from mailgate2.uni-hannover.de ([130.75.2.114]:58384) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hxXB3-0005eA-7g for emacs-orgmode@gnu.org; Tue, 13 Aug 2019 09:49:29 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain 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/) --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=0001-Fix-bug-in-org-babel-tangle-file-with-symlinked-file.patch >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 --=-=-=--