emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Christian Dietrich <dietrich@sra.uni-hannover.de>
To: emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <s7bd0h918gz.fsf@dokucode.de> (raw)

[-- 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


             reply	other threads:[~2019-08-13 13:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-13 13:49 Christian Dietrich [this message]
2019-08-22  7:51 ` Bug: org-babel-tangle-file [9.2.4 (9.2.4-3-g7bc6f8-elpaplus @ /home/stettberger/.emacs.d/elpa/org-plus-contrib-20190701/)] Nicolas Goaziou

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=s7bd0h918gz.fsf@dokucode.de \
    --to=dietrich@sra.uni-hannover.de \
    --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).