* [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
@ 2002-02-23 20:19 Richard Stallman
0 siblings, 0 replies; 22+ messages in thread
From: Richard Stallman @ 2002-02-23 20:19 UTC (permalink / raw)
I tend to think he is right. What do you think?
------- Start of forwarded message -------
X-VirusChecked: Checked
From: "Marshall, Simon" <simon.marshall@misys.com>
To: "'Emacs Pretest Bug'" <emacs-pretest-bug@gnu.org>
Subject: FW: [21.1.90]: should coding be recalculated on revert-buffer?
Date: Fri, 22 Feb 2002 15:09:45 -0000
In GNU Emacs 21.1.90.1 (sparc-sun-solaris2.6, GNU/LessTif Version 2.1
Release 0.93.3)
of 2002-02-04 on ashanti
configured using `configure --prefix=/rvcarma/marshals/slash/usr/local
- --x-includes=/usr/openwin/include:/rvcarma/marshals/slash/usr/local/incl
ude:/rvcarma/marshals/slash/usr/local/include/X11
- --x-libraries=/usr/openwin/lib:/rvcarma/marshals/slash/usr/local/lib:/rv
carma/marshals/slash/usr/local/lib/X11 --with-x-toolkit=motif'
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: en_UK
value of $LC_CTYPE: en_UK
value of $LC_MESSAGES: C
value of $LC_MONETARY: en_UK
value of $LC_NUMERIC: en_UK
value of $LC_TIME: en_UK
value of $LANG: en_UK
locale-coding-system: iso-latin-1
default-enable-multibyte-characters: t
If I visit a DOS-format file in Emacs on a Unix box, Emacs helpfully
tells me the coding system is DOS in the modeline. If I use dos2unix
in a shell to convert it and M-x revert-buffer in Emacs, Emacs still
tells me the coding system is DOS.
Shouldn't it revert the coding system as appropriate too?
------- End of forwarded message -------
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
@ 2002-02-25 7:01 Kenichi Handa
2002-02-25 7:24 ` Stefan Monnier
2002-02-25 7:25 ` Miles Bader
0 siblings, 2 replies; 22+ messages in thread
From: Kenichi Handa @ 2002-02-25 7:01 UTC (permalink / raw)
Cc: emacs-devel
Richard Stallman <rms@gnu.org> writes:
> I tend to think he is right. What do you think?
[...]
> From: "Marshall, Simon" <simon.marshall@misys.com>
> To: "'Emacs Pretest Bug'" <emacs-pretest-bug@gnu.org>
> Subject: FW: [21.1.90]: should coding be recalculated on revert-buffer?
> Date: Fri, 22 Feb 2002 15:09:45 -0000
[...]
> If I visit a DOS-format file in Emacs on a Unix box, Emacs helpfully
> tells me the coding system is DOS in the modeline. If I use dos2unix
> in a shell to convert it and M-x revert-buffer in Emacs, Emacs still
> tells me the coding system is DOS.
> Shouldn't it revert the coding system as appropriate too?
In the above specific case, I agree he is right.
But, if one visited a file with C-x RET c CODING RET C-x C-f
FILENAME RET, it usually means that the file encoding is
different from what Emacs automatically detects. Thus, in
such a case, we had better read the file with the same
coding system (i.e. CODING).
And, it's difficult to distinguish the above two cases.
---
Ken'ichi HANDA
handa@etl.go.jp
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-25 7:01 [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?] Kenichi Handa
@ 2002-02-25 7:24 ` Stefan Monnier
2002-02-25 10:03 ` Eli Zaretskii
2002-02-25 7:25 ` Miles Bader
1 sibling, 1 reply; 22+ messages in thread
From: Stefan Monnier @ 2002-02-25 7:24 UTC (permalink / raw)
Cc: rms, emacs-devel
> Richard Stallman <rms@gnu.org> writes:
> > I tend to think he is right. What do you think?
> [...]
> > From: "Marshall, Simon" <simon.marshall@misys.com>
> > To: "'Emacs Pretest Bug'" <emacs-pretest-bug@gnu.org>
> > Subject: FW: [21.1.90]: should coding be recalculated on revert-buffer?
> > Date: Fri, 22 Feb 2002 15:09:45 -0000
> [...]
> > If I visit a DOS-format file in Emacs on a Unix box, Emacs helpfully
> > tells me the coding system is DOS in the modeline. If I use dos2unix
> > in a shell to convert it and M-x revert-buffer in Emacs, Emacs still
> > tells me the coding system is DOS.
>
> > Shouldn't it revert the coding system as appropriate too?
>
> In the above specific case, I agree he is right.
>
> But, if one visited a file with C-x RET c CODING RET C-x C-f
> FILENAME RET, it usually means that the file encoding is
> different from what Emacs automatically detects. Thus, in
> such a case, we had better read the file with the same
> coding system (i.e. CODING).
>
> And, it's difficult to distinguish the above two cases.
Looks like we should remember whether the current coding-system was
automatically inferred or whether it was explicitly specified.
Of course, we need to remember it separatly for the line-ending part
of the coding-system.
Stefan
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-25 7:01 [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?] Kenichi Handa
2002-02-25 7:24 ` Stefan Monnier
@ 2002-02-25 7:25 ` Miles Bader
2002-02-25 9:56 ` Eli Zaretskii
1 sibling, 1 reply; 22+ messages in thread
From: Miles Bader @ 2002-02-25 7:25 UTC (permalink / raw)
Cc: rms, emacs-devel
Kenichi Handa <handa@etl.go.jp> writes:
> But, if one visited a file with C-x RET c CODING RET C-x C-f
> FILENAME RET, it usually means that the file encoding is
> different from what Emacs automatically detects. Thus, in
> such a case, we had better read the file with the same
> coding system (i.e. CODING).
>
> And, it's difficult to distinguish the above two cases.
Couldn't you set a buffer-local flag to true if the coding is
auto-detected (which `C-x C-m c' & friends would then set to false),
and then only re-detect the coding system upon rever if the flag was true?
-Miles
--
Run away! Run away!
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-25 7:25 ` Miles Bader
@ 2002-02-25 9:56 ` Eli Zaretskii
2002-02-26 20:13 ` Richard Stallman
0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2002-02-25 9:56 UTC (permalink / raw)
Cc: Kenichi Handa, rms, emacs-devel
On 25 Feb 2002, Miles Bader wrote:
> > And, it's difficult to distinguish the above two cases.
>
> Couldn't you set a buffer-local flag to true if the coding is
> auto-detected (which `C-x C-m c' & friends would then set to false),
> and then only re-detect the coding system upon rever if the flag was true?
Are you suggesting to do this inside insert-file-contents? If so, I'd
advise against it: insert-file-contents is used in many commands, each
one with its special expectations about what's The Right Thing to do in
this situation, so changing that on the primitive level runs a high risk
of breaking something.
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.
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-25 7:24 ` Stefan Monnier
@ 2002-02-25 10:03 ` Eli Zaretskii
2002-02-25 10:31 ` Andreas Schwab
` (2 more replies)
0 siblings, 3 replies; 22+ messages in thread
From: Eli Zaretskii @ 2002-02-25 10:03 UTC (permalink / raw)
Cc: Kenichi Handa, rms, emacs-devel
On Mon, 25 Feb 2002, Stefan Monnier wrote:
> Looks like we should remember whether the current coding-system was
> automatically inferred or whether it was explicitly specified.
I'm not sure it's enough. Imagine the following sequence of commands:
C-x RET c latin-2 RET C-x C-f some-file RET
M-! cat some-file | recode latin-2..utf-8 > some-file RET
M-x revert-buffer RET
Here the user visited the file with Latin-2, then changed the file's
encoding on disk into UTF-8, then reverted the buffer. Should Emacs
autodetect in this case or not?
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-25 10:03 ` Eli Zaretskii
@ 2002-02-25 10:31 ` Andreas Schwab
2002-02-25 11:04 ` Eli Zaretskii
2002-02-25 14:59 ` Stefan Monnier
2002-02-26 20:13 ` Richard Stallman
2 siblings, 1 reply; 22+ messages in thread
From: Andreas Schwab @ 2002-02-25 10:31 UTC (permalink / raw)
Cc: Stefan Monnier, Kenichi Handa, rms, emacs-devel
Eli Zaretskii <eliz@is.elta.co.il> writes:
|> On Mon, 25 Feb 2002, Stefan Monnier wrote:
|>
|> > Looks like we should remember whether the current coding-system was
|> > automatically inferred or whether it was explicitly specified.
|>
|> I'm not sure it's enough. Imagine the following sequence of commands:
|>
|> C-x RET c latin-2 RET C-x C-f some-file RET
|> M-! cat some-file | recode latin-2..utf-8 > some-file RET
|> M-x revert-buffer RET
|>
|> Here the user visited the file with Latin-2, then changed the file's
|> encoding on disk into UTF-8, then reverted the buffer. Should Emacs
|> autodetect in this case or not?
I don't think that revert-buffer should autodetect at all. For the few
cases where it matters, find-alternate-file with the same file name is
probably an acceptable replacement. Or even better, set the
buffer-file-coding-system to the desired coding system and save the file
from within Emacs, instead of reencoding it outside of Emacs.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
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."
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-25 10:31 ` Andreas Schwab
@ 2002-02-25 11:04 ` Eli Zaretskii
0 siblings, 0 replies; 22+ messages in thread
From: Eli Zaretskii @ 2002-02-25 11:04 UTC (permalink / raw)
Cc: Stefan Monnier, Kenichi Handa, rms, emacs-devel
On Mon, 25 Feb 2002, Andreas Schwab wrote:
> I don't think that revert-buffer should autodetect at all.
IIRC, that's what it does now: it uses the value of
buffer-file-coding-system to decode the file. Am I wrong?
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
@ 2002-02-25 11:58 Kenichi Handa
2002-02-25 12:07 ` Eli Zaretskii
0 siblings, 1 reply; 22+ messages in thread
From: Kenichi Handa @ 2002-02-25 11:58 UTC (permalink / raw)
Cc: schwab, monnier+gnu/emacs, rms, emacs-devel
Eli Zaretskii <eliz@is.elta.co.il> writes:
> On Mon, 25 Feb 2002, Andreas Schwab wrote:
>> I don't think that revert-buffer should autodetect at all.
> IIRC, that's what it does now: it uses the value of
> buffer-file-coding-system to decode the file.
??? The words after ":" is correct, thus the words before
":" is wrong.
It uses the value of buffer-file-coding-system, thus it does
NOT autodetect the encoding.
Of course, C-x RET c undecided M-x revert-buffer will force
Emacs autodetection.
---
Ken'ichi HANDA
handa@etl.go.jp
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-25 11:58 Kenichi Handa
@ 2002-02-25 12:07 ` Eli Zaretskii
0 siblings, 0 replies; 22+ messages in thread
From: Eli Zaretskii @ 2002-02-25 12:07 UTC (permalink / raw)
Cc: schwab, monnier+gnu/emacs, rms, emacs-devel
On Mon, 25 Feb 2002, Kenichi Handa wrote:
> Eli Zaretskii <eliz@is.elta.co.il> writes:
> > On Mon, 25 Feb 2002, Andreas Schwab wrote:
>
> >> I don't think that revert-buffer should autodetect at all.
>
> > IIRC, that's what it does now: it uses the value of
> > buffer-file-coding-system to decode the file.
>
> ??? The words after ":" is correct, thus the words before
> ":" is wrong.
Andreas says Emacs should not autodetect in revert-buffer. What I meant
to say is that it doesn't autodetect right now: it uses whatever
buffer-file-coding-system says.
> It uses the value of buffer-file-coding-system, thus it does
> NOT autodetect the encoding.
Exactly. That's what I wanted to say. I believe Andreas said that this
is how it should stay. However, this thread started when Simon asked
that it _did_ autodetect, at least the EOL format.
> Of course, C-x RET c undecided M-x revert-buffer will force
> Emacs autodetection.
It does auto-detect, but it doesn't change buffer-file-coding-system. So
if you visit a DOS file, then run dos2unix on it, and the revert-buffer with
"C-x RET c unix RET", and edit and save the buffer, it gets saved with
DOS EOL format.
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-25 10:03 ` Eli Zaretskii
2002-02-25 10:31 ` Andreas Schwab
@ 2002-02-25 14:59 ` Stefan Monnier
2002-02-25 15:11 ` Eli Zaretskii
2002-02-26 20:13 ` Richard Stallman
2 siblings, 1 reply; 22+ messages in thread
From: Stefan Monnier @ 2002-02-25 14:59 UTC (permalink / raw)
Cc: Stefan Monnier, Kenichi Handa, rms, emacs-devel
> > Looks like we should remember whether the current coding-system was
> > automatically inferred or whether it was explicitly specified.
>
> I'm not sure it's enough. Imagine the following sequence of commands:
>
> C-x RET c latin-2 RET C-x C-f some-file RET
> M-! cat some-file | recode latin-2..utf-8 > some-file RET
> M-x revert-buffer RET
>
> Here the user visited the file with Latin-2, then changed the file's
> encoding on disk into UTF-8, then reverted the buffer. Should Emacs
> autodetect in this case or not?
I don't think it matters since both options can make sense depending
on the context. Prompting the user is another option.
Stefan
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-25 14:59 ` Stefan Monnier
@ 2002-02-25 15:11 ` Eli Zaretskii
0 siblings, 0 replies; 22+ messages in thread
From: Eli Zaretskii @ 2002-02-25 15:11 UTC (permalink / raw)
Cc: Kenichi Handa, rms, emacs-devel
On Mon, 25 Feb 2002, Stefan Monnier wrote:
> > Here the user visited the file with Latin-2, then changed the file's
> > encoding on disk into UTF-8, then reverted the buffer. Should Emacs
> > autodetect in this case or not?
>
> I don't think it matters since both options can make sense depending
> on the context.
Yes, that was my point. We've been around these issues more than once,
and the conclusion always was that the current default is no worse than
the other possibilities. So we decided not to change the current
behavior.
> Prompting the user is another option.
Perhaps as an option, and only in interactive invocation of
revert-buffer; otherwise I'm afraid some VC-related commands will become
a nuisance.
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-25 9:56 ` Eli Zaretskii
@ 2002-02-26 20:13 ` Richard Stallman
2002-02-26 20:44 ` Eli Zaretskii
0 siblings, 1 reply; 22+ messages in thread
From: Richard Stallman @ 2002-02-26 20:13 UTC (permalink / raw)
Cc: miles, handa, emacs-devel
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?
That seems right to me.
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-25 10:03 ` Eli Zaretskii
2002-02-25 10:31 ` Andreas Schwab
2002-02-25 14:59 ` Stefan Monnier
@ 2002-02-26 20:13 ` Richard Stallman
2002-02-26 20:42 ` Eli Zaretskii
2 siblings, 1 reply; 22+ messages in thread
From: Richard Stallman @ 2002-02-26 20:13 UTC (permalink / raw)
Cc: monnier+gnu/emacs, handa, emacs-devel
Here the user visited the file with Latin-2, then changed the file's
encoding on disk into UTF-8, then reverted the buffer. Should Emacs
autodetect in this case or not?
I tend to think it should do so. revert-buffer recalculates the file
modes based on changes in the -*- line, and that suggests it is
consistent for revert-buffer to recalculate everything based on the
file's new contents.
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-26 20:13 ` Richard Stallman
@ 2002-02-26 20:42 ` Eli Zaretskii
2002-02-27 5:50 ` Richard Stallman
0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2002-02-26 20:42 UTC (permalink / raw)
Cc: monnier+gnu/emacs, handa, emacs-devel
> Date: Tue, 26 Feb 2002 13:13:54 -0700 (MST)
> From: Richard Stallman <rms@gnu.org>
>
> Here the user visited the file with Latin-2, then changed the file's
> encoding on disk into UTF-8, then reverted the buffer. Should Emacs
> autodetect in this case or not?
>
> I tend to think it should do so. revert-buffer recalculates the file
> modes based on changes in the -*- line, and that suggests it is
> consistent for revert-buffer to recalculate everything based on the
> file's new contents.
One could argue that, since the original visit was with "C-x RET c",
the user wants to force Emacs to use that coding system. A situation
where that would make sense is if instead of running `recode', the
file would be modified on disk in some other way that doesn't change
its encoding, just the contents.
In other words, the Right Thing depends on how was the file changed
behind Emacs's back; obviously, Emacs cannot know that by itself,
given that autodetection is not reliable enough in many cases.
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-26 20:13 ` Richard Stallman
@ 2002-02-26 20:44 ` Eli Zaretskii
2002-02-26 22:44 ` Andreas Schwab
0 siblings, 1 reply; 22+ messages in thread
From: Eli Zaretskii @ 2002-02-26 20:44 UTC (permalink / raw)
Cc: miles, handa, emacs-devel
> Date: Tue, 26 Feb 2002 13:13:50 -0700 (MST)
> From: Richard Stallman <rms@gnu.org>
>
> 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.
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-26 20:44 ` Eli Zaretskii
@ 2002-02-26 22:44 ` Andreas Schwab
2002-02-27 5:50 ` Richard Stallman
2002-02-27 10:19 ` Eli Zaretskii
0 siblings, 2 replies; 22+ messages in thread
From: Andreas Schwab @ 2002-02-26 22:44 UTC (permalink / raw)
Cc: rms, miles, handa, emacs-devel
"Eli Zaretskii" <eliz@is.elta.co.il> writes:
|> > Date: Tue, 26 Feb 2002 13:13:50 -0700 (MST)
|> > From: Richard Stallman <rms@gnu.org>
|> >
|> > 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 <schwab@suse.de>
* 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, schwab@suse.de
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."
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-26 20:42 ` Eli Zaretskii
@ 2002-02-27 5:50 ` Richard Stallman
0 siblings, 0 replies; 22+ messages in thread
From: Richard Stallman @ 2002-02-27 5:50 UTC (permalink / raw)
Cc: monnier+gnu/emacs, handa, emacs-devel
One could argue that, since the original visit was with "C-x RET c",
the user wants to force Emacs to use that coding system.
Maybe yes, maybe no. Since it isn't conclusive what the user wanted,
it is best for revert-buffer to be consistent with its handling of
other issues, and reexamine everything.
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-26 22:44 ` Andreas Schwab
@ 2002-02-27 5:50 ` Richard Stallman
2002-02-27 15:08 ` Andreas Schwab
2002-02-27 10:19 ` Eli Zaretskii
1 sibling, 1 reply; 22+ messages in thread
From: Richard Stallman @ 2002-02-27 5:50 UTC (permalink / raw)
Cc: eliz, miles, handa, emacs-devel
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.
I think your change should be made, but revert-file should autodetect
when you do not specify a coding system in this way.
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-26 22:44 ` Andreas Schwab
2002-02-27 5:50 ` Richard Stallman
@ 2002-02-27 10:19 ` Eli Zaretskii
1 sibling, 0 replies; 22+ messages in thread
From: Eli Zaretskii @ 2002-02-27 10:19 UTC (permalink / raw)
Cc: rms, miles, handa, emacs-devel
On Tue, 26 Feb 2002, Andreas Schwab wrote:
> 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.
This might be something to which we could give a try.
> +Sets `buffer-file-coding-system' to the atually used coding system if
There's a typo here.
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-27 5:50 ` Richard Stallman
@ 2002-02-27 15:08 ` Andreas Schwab
2002-02-28 4:08 ` Richard Stallman
0 siblings, 1 reply; 22+ messages in thread
From: Andreas Schwab @ 2002-02-27 15:08 UTC (permalink / raw)
Cc: eliz, miles, handa, emacs-devel
Richard Stallman <rms@gnu.org> writes:
|> 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.
|>
|> I think your change should be made, but revert-file should autodetect
|> when you do not specify a coding system in this way.
In replace mode insert-file-contents uses buffer-file-coding-system when
coding-system-for-read is nil, so no autodection is done.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
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."
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
* Re: [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?]
2002-02-27 15:08 ` Andreas Schwab
@ 2002-02-28 4:08 ` Richard Stallman
0 siblings, 0 replies; 22+ messages in thread
From: Richard Stallman @ 2002-02-28 4:08 UTC (permalink / raw)
Cc: eliz, miles, handa, emacs-devel
|> I think your change should be made, but revert-file should autodetect
|> when you do not specify a coding system in this way.
In replace mode insert-file-contents uses buffer-file-coding-system when
coding-system-for-read is nil, so no autodection is done.
Yes, I understand. I think should change that.
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 22+ messages in thread
end of thread, other threads:[~2002-02-28 4:08 UTC | newest]
Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-02-25 7:01 [simon.marshall@misys.com: FW: [21.1.90]: should coding be recalculated on revert-buffer?] Kenichi Handa
2002-02-25 7:24 ` Stefan Monnier
2002-02-25 10:03 ` Eli Zaretskii
2002-02-25 10:31 ` Andreas Schwab
2002-02-25 11:04 ` Eli Zaretskii
2002-02-25 14:59 ` Stefan Monnier
2002-02-25 15:11 ` Eli Zaretskii
2002-02-26 20:13 ` Richard Stallman
2002-02-26 20:42 ` Eli Zaretskii
2002-02-27 5:50 ` Richard Stallman
2002-02-25 7:25 ` Miles Bader
2002-02-25 9:56 ` Eli Zaretskii
2002-02-26 20:13 ` Richard Stallman
2002-02-26 20:44 ` Eli Zaretskii
2002-02-26 22:44 ` Andreas Schwab
2002-02-27 5:50 ` Richard Stallman
2002-02-27 15:08 ` Andreas Schwab
2002-02-28 4:08 ` Richard Stallman
2002-02-27 10:19 ` Eli Zaretskii
-- strict thread matches above, loose matches on Subject: below --
2002-02-25 11:58 Kenichi Handa
2002-02-25 12:07 ` Eli Zaretskii
2002-02-23 20:19 Richard Stallman
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.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).