GNU bug report logs - #18141
24.4.50; saving .gz file breaks file coding

Previous Next

Package: emacs;

Reported by: Katsumi Yamaoka <yamaoka <at> jpl.org>

Date: Tue, 29 Jul 2014 07:01:02 UTC

Severity: important

Found in version 24.4.50

Fixed in version 24.3.93

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Glenn Morris <rgm <at> gnu.org>, 18141 <at> debbugs.gnu.org, Vincent Lefevre <vincent <at> vinc17.net>, yamaoka <at> jpl.org
Subject: bug#18141: 24.4.50; saving .gz file breaks file coding
Date: Wed, 06 Aug 2014 13:48:27 -0400
> --- lisp/files.el~0	2014-06-29 06:54:20 +0300
> +++ lisp/files.el	2014-08-06 17:26:42 +0300
> @@ -4835,13 +4835,17 @@
>  						   (nth 1 setmodes)))
>  		 (set-file-modes buffer-file-name
>  				 (logior (car setmodes) 128))))))
> -	(let (success)
> +	(let ((filename-is-magic (find-file-name-handler buffer-file-name
> +							 'write-region))
> +	      success)
>  	  (unwind-protect
>                  ;; Pass in nil&nil rather than point-min&max to indicate
>                  ;; we're saving the buffer rather than just a region.
>                  ;; write-region-annotate-functions may make us of it.
> -	      (let ((coding-system-for-write writecoding)
> -		    (coding-system-require-warning nil))
> +	      (let ((coding-system-for-write
> +		     (if filename-is-magic coding-system-for-write writecoding))
> +		    (coding-system-require-warning
> +		     (if filename-is-magic coding-system-require-warning)))
>  		(write-region nil nil
>  			      buffer-file-name nil t buffer-file-truename)
>  		(setq success t))

I can vaguely guess why that avoids the problem, but I'm having a hard
time seeing why the above is "right".  IOW it seems like an ugly
workaround which may itself come with unintended consequences.


        Stefan




This bug report was last modified 10 years and 345 days ago.

Previous Next


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