GNU bug report logs - #19865
tar-untar-buffer: should honor default-directory

Previous Next

Package: emacs;

Reported by: Ivan Shmakov <ivan <at> siamics.net>

Date: Sat, 14 Feb 2015 11:32:01 UTC

Severity: minor

Tags: fixed, patch

Fixed in version 27.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ivan Shmakov <ivan <at> siamics.net>
To: 19865 <at> debbugs.gnu.org
Subject: bug#19865: tar-untar-buffer: should honor default-directory 
Date: Tue, 17 Feb 2015 05:25:47 +0000
>>>>> Eli Zaretskii <eliz <at> gnu.org> writes:
>>>>> From: Stefan Monnier  Date: Mon, 16 Feb 2015 14:34:02 -0500

[…]

 >> I agree that having to be careful in which buffer we are when we
 >> read a given variable because it might be buffer-local is a source
 >> of maintenance headaches, but we have that all over the place in
 >> Elisp, and we don't really have any "better solution".

 > I don't really see a problem here that needs a solution.

	Yet at least two other Emacs users do.

 > A year from now no one will remember or understand why we use
 > with-current-buffer in that place.  Doing so for such a weak reason
 > is unwise, and no amount of cruft we have elsewhere can justify
 > adding to that.

	We’re using with-current-buffer there for the sole reason that
	write-region operates strictly on the current buffer.  It is so
	without this change, and it remains so with it; the change
	maintains this status quo just perfectly.  And as long as such
	use /is/ acceptable in the current code, I fail to see why it
	wouldn’t be in the replacement being discussed.

	What /is/ changed is that with-current-buffer will now go
	immediately before write-region:

   (with-current-buffer data-buffer
     (write-region …))

	Cf. the former:

   (with-current-buffer data-buffer
     … lots of code to make sure the reader’s lost…
             (write-region …))

	And at the same time:

   (let ((name (expand-file-name (the-name-of-the-archive-member))))
     …)

	Versus the current:

   (let ((name (the-name-of-the-archive-member)))
     …)

	Please also note that the use of expand-file-name will still be
	necessary if we decide to add an extra optional target-directory
	argument to the function later, – and the /new/ code could
	easily be changed to that effect, like:

   (unless target-directory
     (setq target-directory default-directory))
   (let ((name (expand-file-name (the-name-of-the-archive-member)
                                 target-directory)))
     …)

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A




This bug report was last modified 5 years and 331 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.