GNU bug report logs - #64164
29.0.92; buffer-file-coding-system changes unexpectedly after saving

Previous Next

Package: emacs;

Reported by: miranda <at> pulusound.fi

Date: Mon, 19 Jun 2023 11:22:01 UTC

Severity: normal

Found in version 29.0.92

Fixed in version 29.2

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


Message #17 received at 64164 <at> debbugs.gnu.org (full text, mbox):

From: miranda kastemaa <miranda <at> pulusound.fi>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 64164 <at> debbugs.gnu.org
Subject: Re: bug#64164: 29.0.92; buffer-file-coding-system changes
 unexpectedly after saving
Date: Tue, 20 Jun 2023 01:29:37 +0300 (GMT+03:00)
19 Jun 2023 20.36.06 Michael Albinus <michael.albinus <at> gmx.de>:

> miranda <at> pulusound.fi writes:
>
> Hi Miranda,
>
>> i am trying to edit remote files on another macOS system, using
>> Tramp's ssh: method. i am running `emacs -Q`.
>>
>> when i open any file on this remote system, the initial value of
>> `buffer-file-coding-system` is what i would expect,
>> i.e. undecided-unix or utf-8-unix, depending on whether the file
>> contains non-ASCII characters.
>>
>> however, after saving the file, `buffer-file-coding-system` suddenly
>> changes to utf-8-hfs-mac. any subsequent save then changes all the
>> line endings to CR, which i have not actively used since 2001 or
>> so... :-)
>
> Well, if Tramp detects a remote macOS system, it converts the coding
> system to `utf-8-hfs-mac', see function
> `tramp-open-connection-setup-interactive-shell'. This heuristic works
> for many years w/o complaints from users.

thank you for pointing me towards this function. it is late here but this will help me do some more digging tomorrow.

> We could suppress this. However, Tramp needs an indication when to
> suppress. Do you have somthing like this?

without knowing anything about how the current logic came to be, it seems to me that -mac should never be the default on Darwin-based macOS, as the CR file endings fell out of use with the discontinuation of the "classic" Mac OS that predated Darwin.

it is perhaps worth reiterating that the files i have been editing already contain LF file endings exclusively (and thus far Emacs has always created these by default, both locally and over Tramp), so the sudden unprompted change to CR is quite disruptive. even if CR were a reasonable default, i believe Emacs is meant to respect the existing coding system of files, so this definitely seems like a bug.

>> Emacs 28.2 works as expected.
>
> This surprises me. I don't remember we have changed something here in
> Tramp (but I might be wrong).
>
>> best,
>> miranda
> > Best regards, Michael.

best,
miranda




This bug report was last modified 1 year and 267 days ago.

Previous Next


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