emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: address@hidden: FW: [21.1.90]: should coding be recalculated on reve


From: Andreas Schwab
Subject: Re: address@hidden: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
Date: Tue, 26 Feb 2002 23:44:39 +0100
User-agent: Gnus/5.090005 (Oort Gnus v0.05) Emacs/21.2.50 (ia64-suse-linux)

"Eli Zaretskii" <address@hidden> writes:

|> > Date: Tue, 26 Feb 2002 13:13:50 -0700 (MST)
|> > From: Richard Stallman <address@hidden>
|> > 
|> >     It might be okay to do that inside revert-buffer, but even then I'd 
|> >     suggest to do it only for the EOL format, not for the base of the 
coding 
|> >     system, to keep the possible unintended consequences to a minimum.
|> > 
|> > Why not do it for both aspects of the coding system, in revert?
|> 
|> In principle, the two should go together, but in practice, the EOL
|> issue is much more simple and has less complications.  So risky
|> decisions run lower risk with EOLs.

How about just setting buffer-file-coding-system to
last-coding-system-used in revert-buffer if coding-system-for-read is
non-nil?  This way you can use `C-x RET c undecided' to force
re-detection.

2002-02-26  Andreas Schwab  <address@hidden>

        * files.el (revert-buffer): Set `buffer-file-coding-system' if an
        explicit coding system was requested.

--- files.el.~1.550.~   Thu Feb  7 11:22:19 2002
+++ files.el    Tue Feb 26 23:42:23 2002
@@ -3006,7 +3006,11 @@
 do all the work for this command.  Otherwise, the hooks
 `before-revert-hook' and `after-revert-hook' are run at the beginning
 and the end, and if `revert-buffer-insert-file-contents-function' is
-non-nil, it is called instead of rereading visited file contents."
+non-nil, it is called instead of rereading visited file contents.
+
+Sets `buffer-file-coding-system' to the atually used coding system if
+`coding-system-for-read' is non-nil, unless reverting from the auto-save
+file."
 
   ;; I admit it's odd to reverse the sense of the prefix argument, but
   ;; there is a lot of code out there which assumes that the first
@@ -3075,7 +3079,12 @@
                            coding-system-for-read)))
                     ;; Note that this preserves point in an intelligent way.
                     (insert-file-contents file-name (not auto-save-p)
-                                          nil nil t))))
+                                          nil nil t))
+                  ;; When a coding system was explicitly requested set
+                  ;; the file coding system to what was actually used.
+                  (if (and coding-system-for-read (not auto-save-p))
+                      (setq buffer-file-coding-system
+                            last-coding-system-used))))
               ;; Recompute the truename in case changes in symlinks
               ;; have changed the truename.
               (setq buffer-file-truename

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 N├╝rnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]