From unknown Mon Jun 23 20:18:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15535: 24.3.50; basic-save-buffer should update buffer-file-coding-system value if the contents were written using different coding system Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Oct 2013 22:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15535 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 15535@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.138101307530740 (code B ref -1); Sat, 05 Oct 2013 22:45:02 +0000 Received: (at submit) by debbugs.gnu.org; 5 Oct 2013 22:44:35 +0000 Received: from localhost ([127.0.0.1]:56729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSaaR-0007zk-Fx for submit@debbugs.gnu.org; Sat, 05 Oct 2013 18:44:35 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43590) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSaaP-0007zb-A7 for submit@debbugs.gnu.org; Sat, 05 Oct 2013 18:44:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VSaaK-0007xB-5X for submit@debbugs.gnu.org; Sat, 05 Oct 2013 18:44:32 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:56568) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSaaK-0007x7-2Q for submit@debbugs.gnu.org; Sat, 05 Oct 2013 18:44:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSaaF-0005m7-5B for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2013 18:44:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VSaaA-0007w6-Cu for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2013 18:44:23 -0400 Received: from mail-ea0-x235.google.com ([2a00:1450:4013:c01::235]:37789) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSaaA-0007vw-64 for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2013 18:44:18 -0400 Received: by mail-ea0-f181.google.com with SMTP id d10so2509590eaj.12 for ; Sat, 05 Oct 2013 15:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=klksB+TgSip7108KEwHDDInKDbcJJJhDywA2hrnmI84=; b=s1GUERKlLQcKRDr+4LkjgARha8nux7TNKTrF1lyMlLxi4b7gouoMvNwdKYV/6omknP wPrDAoj86g9Sy0KC78FjYFV/1P6cu25hOIuq1L0JQpy5iaKCT+Ts6DhwkMGL5wdAIubp MojSYgArtpIaj7O7SJqUVwzP+rrN/nlookVOHGJJRAlLbclR81MaGZLsSaWbt5Z2cfSu 7KcGm8Aqm5bYfzRKlbLvv7m13jRzIiLzJzXlrMO7IvlsJO9p4Ab/Z3kcF1iIkwZEDEX9 8s5s9h0SUH7dpcA9HxUBA7n0/cDyBgclNwE7Zuz5RHG/HwsbVrB0uhdLrg459f977Eoi 3QcQ== X-Received: by 10.14.218.197 with SMTP id k45mr34635199eep.32.1381013057146; Sat, 05 Oct 2013 15:44:17 -0700 (PDT) Received: from axl (93-113-74.netrun.cytanet.com.cy. [93.109.113.74]) by mx.google.com with ESMTPSA id r48sm44305343eev.14.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 05 Oct 2013 15:44:16 -0700 (PDT) From: Dmitry Gutov Date: Sun, 06 Oct 2013 01:44:09 +0300 Message-ID: <871u3z49ty.fsf@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Otherwise it's hard to find out which coding system was used, after all. See here why it's useful: http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00129.html The following test passes in Emacs 24.3 but fails on trunk: (ert-deftest save-buffer-updates-buffer-file-coding-system () (let ((file (expand-file-name "foo" temporary-file-directory)) (default-buffer-file-coding-system 'utf-8-unix)) (unwind-protect (with-temp-buffer (insert "abcdef\n") (write-file file)) (with-current-buffer (find-file-noselect file) (should (eq 'undecided (coding-system-change-eol-conversion buffer-file-coding-system nil))) (insert "=D0=B2=D0=BE=D0=B4=D0=BA=D0=B0 =D0=BC=D0=B0=D1=82=D1=80=D1= =91=D1=88=D0=BA=D0=B0 =D1=81=D0=B5=D0=BB=D1=91=D0=B4=D0=BA=D0=B0") (save-buffer) ;; Fails here: (should (eq 'utf-8-unix buffer-file-coding-system))) (delete-file file)))) In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.6.4) of 2013-10-04 on axl Bzr revision: 114513 eggert@cs.ucla.edu-20131003161631-vox3mdtalfjg13ed Windowing system distributor `The X.Org Foundation', version 11.0.11303000 System Description: Ubuntu 13.04 From unknown Mon Jun 23 20:18:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15535: Acknowledgement (24.3.50; basic-save-buffer should update buffer-file-coding-system value if the contents were written using different coding system) Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 05 Oct 2013 23:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15535 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 15535@debbugs.gnu.org Received: via spool by 15535-submit@debbugs.gnu.org id=B15535.1381014550554 (code B ref 15535); Sat, 05 Oct 2013 23:10:02 +0000 Received: (at 15535) by debbugs.gnu.org; 5 Oct 2013 23:09:10 +0000 Received: from localhost ([127.0.0.1]:56756 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSayD-00008r-IY for submit@debbugs.gnu.org; Sat, 05 Oct 2013 19:09:10 -0400 Received: from mail-ea0-f180.google.com ([209.85.215.180]:49839) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSay9-00008g-Lo for 15535@debbugs.gnu.org; Sat, 05 Oct 2013 19:09:06 -0400 Received: by mail-ea0-f180.google.com with SMTP id h10so2445364eaj.39 for <15535@debbugs.gnu.org>; Sat, 05 Oct 2013 16:09:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=fcoRCV0pM4FkVU+f4oX8mY3ZbRCWka76UtT2rqH2L9U=; b=Ffc5WO6DZbhN+JpBXux9s6YyE+uyuws2kxtJyBlTGXIZGsz1rBIjMlDxJV2bSDZJOX bCZk9HuTPtrPGINLlBhyZ9Dm9WXao7rUwlwSBuYqyLgPPOAG59uXJq0CoU4Xr817uwqY F/7hHOEQGFd/jSPAD0pxFVM9UVYV9IWVcE4D2LNpmYFu6Cs5Sl7dcCnrDJgxmp9wdSnK 0+n47GOFNyjU+t0Mib0E7ttOlS07L5yvvXt9J1hVctutiW3aYnt6101hO7YlokdkypRj +Z5hWuRxZNzpjjUP5HO878DLZA73VbiJSDwoe24sT/EtYhnj3FRa2MMCyV+VEmuWIN0I nxvQ== X-Received: by 10.14.45.70 with SMTP id o46mr34682423eeb.19.1381014544779; Sat, 05 Oct 2013 16:09:04 -0700 (PDT) Received: from [192.168.10.2] (93-113-74.netrun.cytanet.com.cy. [93.109.113.74]) by mx.google.com with ESMTPSA id d8sm44495163eeh.8.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 05 Oct 2013 16:09:04 -0700 (PDT) Message-ID: <52509C0D.1000600@yandex.ru> Date: Sun, 06 Oct 2013 02:09:01 +0300 From: Dmitry Gutov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 References: <871u3z49ty.fsf@yandex.ru> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Sorry, here's a better test: (ert-deftest save-buffer-updates-buffer-file-coding-system () (let ((file (expand-file-name "foo" temporary-file-directory)) (default-buffer-file-coding-system 'utf-8-unix)) (find-file file) (insert "abcdef\n") (save-buffer) (kill-buffer) (unwind-protect (with-current-buffer (find-file-noselect file) (should (eq 'undecided (coding-system-change-eol-conversion buffer-file-coding-system nil))) (insert "водка матрёшка селёдка") (save-buffer) (let ((coding-system buffer-file-coding-system)) (kill-buffer) (should (eq 'utf-8-unix coding-system)))) (delete-file file)))) Likewise, succeeds on 24.3, fails on trunk. From unknown Mon Jun 23 20:18:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15535: Acknowledgement (24.3.50; basic-save-buffer should update buffer-file-coding-system value if the contents were written using different coding system) Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Oct 2013 16:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15535 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov , Kenichi Handa Cc: 15535@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 15535-submit@debbugs.gnu.org id=B15535.13810783076278 (code B ref 15535); Sun, 06 Oct 2013 16:52:02 +0000 Received: (at 15535) by debbugs.gnu.org; 6 Oct 2013 16:51:47 +0000 Received: from localhost ([127.0.0.1]:57859 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSrYZ-0001dB-3r for submit@debbugs.gnu.org; Sun, 06 Oct 2013 12:51:47 -0400 Received: from mtaout23.012.net.il ([80.179.55.175]:62012) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSrYV-0001d1-A6 for 15535@debbugs.gnu.org; Sun, 06 Oct 2013 12:51:44 -0400 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0MU900G00AM71Z00@a-mtaout23.012.net.il> for 15535@debbugs.gnu.org; Sun, 06 Oct 2013 19:51:41 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MU900FH8AU4XK60@a-mtaout23.012.net.il>; Sun, 06 Oct 2013 19:51:41 +0300 (IDT) Date: Sun, 06 Oct 2013 19:51:34 +0300 From: Eli Zaretskii In-reply-to: <52509C0D.1000600@yandex.ru> X-012-Sender: halo1@inter.net.il Message-id: <83vc1a5omh.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 8BIT References: <871u3z49ty.fsf@yandex.ru> <52509C0D.1000600@yandex.ru> X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) (I've added Handa-san to this discussion, as I'm not sure I didn't miss anything in looking into this.) > Date: Sun, 06 Oct 2013 02:09:01 +0300 > From: Dmitry Gutov > > Sorry, here's a better test: > > (ert-deftest save-buffer-updates-buffer-file-coding-system () > (let ((file (expand-file-name "foo" temporary-file-directory)) > (default-buffer-file-coding-system 'utf-8-unix)) > (find-file file) > (insert "abcdef\n") > (save-buffer) > (kill-buffer) > (unwind-protect > (with-current-buffer (find-file-noselect file) > (should (eq 'undecided (coding-system-change-eol-conversion > buffer-file-coding-system nil))) > (insert "водка матрёшка селёдка") > (save-buffer) > (let ((coding-system buffer-file-coding-system)) > (kill-buffer) > (should (eq 'utf-8-unix coding-system)))) > (delete-file file)))) > > Likewise, succeeds on 24.3, fails on trunk. Thanks. For the record, a simpler test case is this: emacs -Q C-x C-f foo RET Insert some ASCII text, then save the buffer, kill it, and visit the file again: C-x C-s C-x k RET C-x C-f foo RET You now have foo with `undecided' as its buffer-file-coding-system. Then: C-u C-\ cyrillic-translit RET abvgde C-\ C-x C-s The file is saved (as UTF-8, as can be seen by examining it on disk), but without asking for encoding, and without changing buffer-file-coding-system to reflect the actual encoding. What happens is that `undecided' silently encodes the buffer in UTF-8, but never communicates that fact back to its callers. So write-region thinks it used `undecided', as does select-safe-coding-system. The latter is actually equipped to DTRT when the `prefer-utf-8' variant of `undecided' is used, but that is not the case here. Is this what was supposed to happen, or is something misbehaving here? If the former, we could perhaps add some flag to struct undecided_spec and set it whenever the encoder used by `undecided' sees a non-ASCII character, and then use that flag to set last-coding-system-used to UTF-8. Does this make sense? From unknown Mon Jun 23 20:18:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15535: Acknowledgement (24.3.50; basic-save-buffer should update buffer-file-coding-system value if the contents were written using different coding system) Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 06 Oct 2013 21:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15535 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii , Kenichi Handa Cc: 15535@debbugs.gnu.org Received: via spool by 15535-submit@debbugs.gnu.org id=B15535.138109315329048 (code B ref 15535); Sun, 06 Oct 2013 21:00:03 +0000 Received: (at 15535) by debbugs.gnu.org; 6 Oct 2013 20:59:13 +0000 Received: from localhost ([127.0.0.1]:58244 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSvQ0-0007YR-5t for submit@debbugs.gnu.org; Sun, 06 Oct 2013 16:59:12 -0400 Received: from mail-ee0-f45.google.com ([74.125.83.45]:36149) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSvPt-0007YB-5C for 15535@debbugs.gnu.org; Sun, 06 Oct 2013 16:59:10 -0400 Received: by mail-ee0-f45.google.com with SMTP id c50so2840723eek.18 for <15535@debbugs.gnu.org>; Sun, 06 Oct 2013 13:59:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=HXlZERPXKIhiD0IYbhaoyqVzu5j1RzKn8pwuQkhVEZw=; b=ubNAaqmBHQYAORc4uwjq6M00SzlqmBVzE/1qmVLKhaJRF5Y1ov4aMlS6sIjwc3V002 dxeSzI5rtuNy9f8DXR6AvooRmAIdMmI5WgTtw+tI/hwhyxcyMc8Axnjy+kQW5kxgN9P1 5ruVNm7FJGcZKlPIPS36+o/puVFaI8B+H/AiGtEnaa5Ieo8VqTKPuIzq2UsYgSHh47aE LA2gLrUPUKszaL+EVQFAPdAXWYA7UY9NWDWoLYOptkCXW+n09c/i0zSSdHbojhro04xP OMjSIRw6nA7P8wkA/iDycVWafuOE54AGjPgR7a93ilFkbQOXuVv7JDbQ6g7U8I4QeWVE LDwg== X-Received: by 10.14.122.132 with SMTP id t4mr43565941eeh.20.1381093143604; Sun, 06 Oct 2013 13:59:03 -0700 (PDT) Received: from [192.168.10.2] (93-113-74.netrun.cytanet.com.cy. [93.109.113.74]) by mx.google.com with ESMTPSA id n48sm55106727eeg.17.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 06 Oct 2013 13:59:02 -0700 (PDT) Message-ID: <5251CF11.8080301@yandex.ru> Date: Sun, 06 Oct 2013 23:58:57 +0300 From: Dmitry Gutov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 References: <871u3z49ty.fsf@yandex.ru> <52509C0D.1000600@yandex.ru> <83vc1a5omh.fsf@gnu.org> In-Reply-To: <83vc1a5omh.fsf@gnu.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 06.10.2013 19:51, Eli Zaretskii wrote: > If the former, we could perhaps add some flag to struct undecided_spec > and set it whenever the encoder used by `undecided' sees a non-ASCII > character, and then use that flag to set last-coding-system-used to > UTF-8. That already happens (last-coding-system-used has the right value right after the file is written), but I don't think I can use it: even if `ruby-mode-set-encoding' is moved to after-save-hook, as long as it's not the first function in this hook (and I can't ensure that it is), the previous functions can also do some I/O and thus change last-coding-system-used's value. And that the reason I reverted 114527 in 114533, which in turn sparked the discussion in emacs-devel. From unknown Mon Jun 23 20:18:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15535: Acknowledgement (24.3.50; basic-save-buffer should update buffer-file-coding-system value if the contents were written using different coding system) Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Oct 2013 02:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15535 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Dmitry Gutov Cc: 15535@debbugs.gnu.org, handa@gnu.org Reply-To: Eli Zaretskii Received: via spool by 15535-submit@debbugs.gnu.org id=B15535.138111437425666 (code B ref 15535); Mon, 07 Oct 2013 02:53:02 +0000 Received: (at 15535) by debbugs.gnu.org; 7 Oct 2013 02:52:54 +0000 Received: from localhost ([127.0.0.1]:58793 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VT0wI-0006fu-HK for submit@debbugs.gnu.org; Sun, 06 Oct 2013 22:52:54 -0400 Received: from mtaout21.012.net.il ([80.179.55.169]:51097) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VT0w9-0006fe-0i for 15535@debbugs.gnu.org; Sun, 06 Oct 2013 22:52:52 -0400 Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MUA003002II1O00@a-mtaout21.012.net.il> for 15535@debbugs.gnu.org; Mon, 07 Oct 2013 05:52:43 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MUA002LD2NVP3B0@a-mtaout21.012.net.il>; Mon, 07 Oct 2013 05:52:43 +0300 (IDT) Date: Mon, 07 Oct 2013 05:52:38 +0300 From: Eli Zaretskii In-reply-to: <5251CF11.8080301@yandex.ru> X-012-Sender: halo1@inter.net.il Message-id: <83mwml6bd5.fsf@gnu.org> References: <871u3z49ty.fsf@yandex.ru> <52509C0D.1000600@yandex.ru> <83vc1a5omh.fsf@gnu.org> <5251CF11.8080301@yandex.ru> X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > Date: Sun, 06 Oct 2013 23:58:57 +0300 > From: Dmitry Gutov > CC: 15535@debbugs.gnu.org > > On 06.10.2013 19:51, Eli Zaretskii wrote: > > If the former, we could perhaps add some flag to struct undecided_spec > > and set it whenever the encoder used by `undecided' sees a non-ASCII > > character, and then use that flag to set last-coding-system-used to > > UTF-8. > > That already happens (last-coding-system-used has the right value right > after the file is written) Not here, it doesn't. I see 'undecided'. And that is part of the problem. > but I don't think I can use it: even if > `ruby-mode-set-encoding' is moved to after-save-hook, as long as it's > not the first function in this hook (and I can't ensure that it is), the > previous functions can also do some I/O and thus change > last-coding-system-used's value. You can always take the value of last-coding-system-used as the first thing you do. The problem is that the value is wrong, at least in the scenario I used to reproduce the problem. From unknown Mon Jun 23 20:18:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15535: Acknowledgement (24.3.50; basic-save-buffer should update buffer-file-coding-system value if the contents were written using different coding system) Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Oct 2013 04:01:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15535 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 15535@debbugs.gnu.org, handa@gnu.org Received: via spool by 15535-submit@debbugs.gnu.org id=B15535.13811184533576 (code B ref 15535); Mon, 07 Oct 2013 04:01:01 +0000 Received: (at 15535) by debbugs.gnu.org; 7 Oct 2013 04:00:53 +0000 Received: from localhost ([127.0.0.1]:58880 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VT204-0000vb-8C for submit@debbugs.gnu.org; Mon, 07 Oct 2013 00:00:52 -0400 Received: from mail-ea0-f171.google.com ([209.85.215.171]:34485) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VT200-0000vR-F1 for 15535@debbugs.gnu.org; Mon, 07 Oct 2013 00:00:49 -0400 Received: by mail-ea0-f171.google.com with SMTP id n15so2903750ead.2 for <15535@debbugs.gnu.org>; Sun, 06 Oct 2013 21:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=WesNAzQowz2i5TGvKMf+Xdw5IRPPdlPJOdG89pVWBCM=; b=EBub8MgFDJOcZ9ICp4ca8moAg+fEon5TXeRxTI7/mOtO5Gshv6AimVogC90uBw+3Hx m3bbyzXLCzIVHSofl+6VhaVu6OB2ZNUvtNMLYoCJCBZToAA58Rilr520hnZFuGnJjFrZ ahzO5vR6MegqdJcgDf6tL1+IACiW3inbybaRJqR11MMA7E/Yq7McPxDGM1B6MD7RF4W8 33TZTV6lFuc3oD/BAw2d9noL1mrvvWtd3YyUU1n9iASu7ROiXUw0Vr4+nCPMrVkTHyd7 UM69LGkBFUnOhMjrz2YRwqXX33RDcfKzJ/c/FW2ZpGd378li365C3/T3seCydwDxodGN v+cg== X-Received: by 10.15.99.72 with SMTP id bk48mr46171089eeb.22.1381118447555; Sun, 06 Oct 2013 21:00:47 -0700 (PDT) Received: from [192.168.10.2] (93-113-74.netrun.cytanet.com.cy. [93.109.113.74]) by mx.google.com with ESMTPSA id f49sm58174810eec.7.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 06 Oct 2013 21:00:46 -0700 (PDT) Message-ID: <525231EA.3040900@yandex.ru> Date: Mon, 07 Oct 2013 07:00:42 +0300 From: Dmitry Gutov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 References: <871u3z49ty.fsf@yandex.ru> <52509C0D.1000600@yandex.ru> <83vc1a5omh.fsf@gnu.org> <5251CF11.8080301@yandex.ru> <83mwml6bd5.fsf@gnu.org> In-Reply-To: <83mwml6bd5.fsf@gnu.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 07.10.2013 05:52, Eli Zaretskii wrote: > Not here, it doesn't. I see 'undecided'. And that is part of the > problem. True, sorry. It worked for me previously, but I guess the value was similarly spoiled by some other function in after-save-hook. >> `ruby-mode-set-encoding' is moved to after-save-hook, as long as it's >> not the first function in this hook (and I can't ensure that it is), the >> previous functions can also do some I/O and thus change >> last-coding-system-used's value. > > You can always take the value of last-coding-system-used as the first > thing you do. If "I" am a function inside after-save-hook, I don't control the "first thing". But now I see that `basic-save-buffer' does save the value of `last-coding-system-used' to either `save-buffer-coding-system' or `buffer-file-coding-system', depending on whether the former is non-nil. So I can use those, and the problem is reduced to having the right `last-coding-system-used' value set. From unknown Mon Jun 23 20:18:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15535: Acknowledgement (24.3.50; basic-save-buffer should update buffer-file-coding-system value if the contents were written using different coding system) References: <871u3z49ty.fsf@yandex.ru> Resent-From: Kenichi Handa Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 07 Oct 2013 15:00:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15535 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Eli Zaretskii Cc: 15535@debbugs.gnu.org, dgutov@yandex.ru Received: via spool by 15535-submit@debbugs.gnu.org id=B15535.13811579769072 (code B ref 15535); Mon, 07 Oct 2013 15:00:04 +0000 Received: (at 15535) by debbugs.gnu.org; 7 Oct 2013 14:59:36 +0000 Received: from localhost ([127.0.0.1]:60444 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VTCHX-0002MF-HT for submit@debbugs.gnu.org; Mon, 07 Oct 2013 10:59:35 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:38443) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VTCHV-0002M7-Ke for 15535@debbugs.gnu.org; Mon, 07 Oct 2013 10:59:34 -0400 Received: from fl1-119-240-85-246.iba.mesh.ad.jp ([119.240.85.246]:53870 helo=shatin) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1VTCHU-0003xS-7T; Mon, 07 Oct 2013 10:59:32 -0400 Received: from handa by shatin with local (Exim 4.80) (envelope-from ) id 1VTCHO-000268-4D; Mon, 07 Oct 2013 23:59:26 +0900 From: Kenichi Handa In-Reply-To: <83vc1a5omh.fsf@gnu.org> (message from Eli Zaretskii on Sun, 06 Oct 2013 19:51:34 +0300) Date: Mon, 07 Oct 2013 23:59:25 +0900 Message-ID: <87siwd9lf6.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.2 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.2 (-----) In article <83vc1a5omh.fsf@gnu.org>, Eli Zaretskii writes: [...] > You now have foo with `undecided' as its buffer-file-coding-system. > Then: > C-u C-\ cyrillic-translit RET > abvgde > C-\ > C-x C-s > The file is saved (as UTF-8, as can be seen by examining it on disk), > but without asking for encoding, and without changing > buffer-file-coding-system to reflect the actual encoding. > What happens is that `undecided' silently encodes the buffer in UTF-8, > but never communicates that fact back to its callers. So write-region > thinks it used `undecided', as does select-safe-coding-system. The > latter is actually equipped to DTRT when the `prefer-utf-8' variant of > `undecided' is used, but that is not the case here. > Is this what was supposed to happen No. I think the behavior of 24.3 is correct. So, some change in trunk has a problem. But, as far as I remember I have not touched any codes that relate to this misbehavior. I'm now investigating what has been changed from 24.3. --- Kenichi Handa handa@gnu.org From unknown Mon Jun 23 20:18:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15535: Acknowledgement (24.3.50; basic-save-buffer should update buffer-file-coding-system value if the contents were written using different coding system) References: <871u3z49ty.fsf@yandex.ru> Resent-From: Kenichi Handa Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Oct 2013 12:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15535 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Kenichi Handa Cc: 15535@debbugs.gnu.org, eliz@gnu.org, dgutov@yandex.ru Received: via spool by 15535-submit@debbugs.gnu.org id=B15535.138166603113393 (code B ref 15535); Sun, 13 Oct 2013 12:08:01 +0000 Received: (at 15535) by debbugs.gnu.org; 13 Oct 2013 12:07:11 +0000 Received: from localhost ([127.0.0.1]:45483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVKRy-0003Tx-74 for submit@debbugs.gnu.org; Sun, 13 Oct 2013 08:07:10 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:54711 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVKRu-0003Tl-WB for 15535@debbugs.gnu.org; Sun, 13 Oct 2013 08:07:07 -0400 Received: from fl1-119-240-85-246.iba.mesh.ad.jp ([119.240.85.246]:61224 helo=shatin) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1VVKRt-0003iW-CR; Sun, 13 Oct 2013 08:07:05 -0400 Received: from handa by shatin with local (Exim 4.80) (envelope-from ) id 1VVKRn-0001c6-Ie; Sun, 13 Oct 2013 21:06:59 +0900 From: Kenichi Handa In-Reply-To: <87siwd9lf6.fsf@gnu.org> (message from Kenichi Handa on Mon, 07 Oct 2013 23:59:25 +0900) Date: Sun, 13 Oct 2013 21:06:59 +0900 Message-ID: <87eh7p9xy4.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -5.5 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.5 (-----) In article <87siwd9lf6.fsf@gnu.org>, Kenichi Handa writes: > No. I think the behavior of 24.3 is correct. So, some > change in trunk has a problem. But, as far as I remember I > have not touched any codes that relate to this misbehavior. > I'm now investigating what has been changed from 24.3. Oops, it was me who enbugged...I had fixed the bug of 24.3 in a wrong way. I've just committed the fix to trunk. --- Kenichi Handa handa@gnu.org From unknown Mon Jun 23 20:18:33 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15535: Acknowledgement (24.3.50; basic-save-buffer should update buffer-file-coding-system value if the contents were written using different coding system) Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 13 Oct 2013 16:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15535 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Kenichi Handa Cc: 15535@debbugs.gnu.org, dgutov@yandex.ru Reply-To: Eli Zaretskii Received: via spool by 15535-submit@debbugs.gnu.org id=B15535.13816829048640 (code B ref 15535); Sun, 13 Oct 2013 16:49:02 +0000 Received: (at 15535) by debbugs.gnu.org; 13 Oct 2013 16:48:24 +0000 Received: from localhost ([127.0.0.1]:46116 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVOq8-0002FI-18 for submit@debbugs.gnu.org; Sun, 13 Oct 2013 12:48:24 -0400 Received: from mtaout21.012.net.il ([80.179.55.169]:58446) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVOq4-0002Ez-5b for 15535@debbugs.gnu.org; Sun, 13 Oct 2013 12:48:22 -0400 Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MUM00C009302P00@a-mtaout21.012.net.il> for 15535@debbugs.gnu.org; Sun, 13 Oct 2013 19:48:13 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MUM00CDH9CC2720@a-mtaout21.012.net.il>; Sun, 13 Oct 2013 19:48:13 +0300 (IDT) Date: Sun, 13 Oct 2013 19:48:05 +0300 From: Eli Zaretskii In-reply-to: <87eh7p9xy4.fsf@gnu.org> X-012-Sender: halo1@inter.net.il Message-id: <8338o5qfqy.fsf@gnu.org> References: <87eh7p9xy4.fsf@gnu.org> X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > From: Kenichi Handa > Cc: eliz@gnu.org, 15535@debbugs.gnu.org, dgutov@yandex.ru > Date: Sun, 13 Oct 2013 21:06:59 +0900 > > In article <87siwd9lf6.fsf@gnu.org>, Kenichi Handa writes: > > > No. I think the behavior of 24.3 is correct. So, some > > change in trunk has a problem. But, as far as I remember I > > have not touched any codes that relate to this misbehavior. > > I'm now investigating what has been changed from 24.3. > > Oops, it was me who enbugged...I had fixed the bug of 24.3 > in a wrong way. I've just committed the fix to trunk. Thanks, it works. From unknown Mon Jun 23 20:18:33 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Dmitry Gutov Subject: bug#15535: closed (Re: bug#15535: Acknowledgement (24.3.50; basic-save-buffer should update buffer-file-coding-system value if the contents were written using different coding system)) Message-ID: References: <525B05F1.2030006@yandex.ru> <871u3z49ty.fsf@yandex.ru> X-Gnu-PR-Message: they-closed 15535 X-Gnu-PR-Package: emacs Reply-To: 15535@debbugs.gnu.org Date: Sun, 13 Oct 2013 20:44:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1381697042-30979-1" This is a multi-part message in MIME format... ------------=_1381697042-30979-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #15535: 24.3.50; basic-save-buffer should update buffer-file-coding-system = value if the contents were written using different coding system which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 15535@debbugs.gnu.org. --=20 15535: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D15535 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1381697042-30979-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 15535-done) by debbugs.gnu.org; 13 Oct 2013 20:43:41 +0000 Received: from localhost ([127.0.0.1]:46508 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVSVp-00082u-72 for submit@debbugs.gnu.org; Sun, 13 Oct 2013 16:43:41 -0400 Received: from mail-ee0-f51.google.com ([74.125.83.51]:60293) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VVSVm-00082g-O3 for 15535-done@debbugs.gnu.org; Sun, 13 Oct 2013 16:43:39 -0400 Received: by mail-ee0-f51.google.com with SMTP id c1so2983425eek.10 for <15535-done@debbugs.gnu.org>; Sun, 13 Oct 2013 13:43:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=CNZn0sucZJEdkg9v53c8RPnA2EIvUuRr3I4mKns8U8w=; b=KgeD3NOF6yv9W+R3+qkE2ANRR/2UVAcuU5fvBaVAbIkAxPZen5fM1ZZBoiBlwWgAxj rbGmGuFdH9po0E9Ma5GaU0Ockvpgygj0g4MffNb3cWUPcI2s8HdsjoplyjQ4iYxJHQAC 3ggeoohfq/vaGvxFFeeb9QAtcDsh1tmg0Etd7Hd60nhs4H4SwztdyhxWNwsvRUtdnCUT 3JEBQDkWZpE6B9EGJ4rfd8bSkH14u0QNpEce6nd/FUVBzYKyEG6aRWmJuUwu07gJkVIZ JppNYMy7MfKxjK9x7I11d9BzhAKnWp5U2OhdNL4K4ryksY51F3AZGCDVDmPvoHSqGAbO OKQQ== X-Received: by 10.14.5.3 with SMTP id 3mr6905194eek.49.1381697012941; Sun, 13 Oct 2013 13:43:32 -0700 (PDT) Received: from [192.168.10.2] (93-113-74.netrun.cytanet.com.cy. [93.109.113.74]) by mx.google.com with ESMTPSA id m54sm144535552eex.2.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 13 Oct 2013 13:43:32 -0700 (PDT) Message-ID: <525B05F1.2030006@yandex.ru> Date: Sun, 13 Oct 2013 23:43:29 +0300 From: Dmitry Gutov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.0 MIME-Version: 1.0 To: Eli Zaretskii , Kenichi Handa Subject: Re: bug#15535: Acknowledgement (24.3.50; basic-save-buffer should update buffer-file-coding-system value if the contents were written using different coding system) References: <87eh7p9xy4.fsf@gnu.org> <8338o5qfqy.fsf@gnu.org> In-Reply-To: <8338o5qfqy.fsf@gnu.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 15535-done Cc: 15535-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Version: 24.4 Fixed for me too, thanks. ------------=_1381697042-30979-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 5 Oct 2013 22:44:35 +0000 Received: from localhost ([127.0.0.1]:56729 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSaaR-0007zk-Fx for submit@debbugs.gnu.org; Sat, 05 Oct 2013 18:44:35 -0400 Received: from eggs.gnu.org ([208.118.235.92]:43590) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSaaP-0007zb-A7 for submit@debbugs.gnu.org; Sat, 05 Oct 2013 18:44:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VSaaK-0007xB-5X for submit@debbugs.gnu.org; Sat, 05 Oct 2013 18:44:32 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:56568) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSaaK-0007x7-2Q for submit@debbugs.gnu.org; Sat, 05 Oct 2013 18:44:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45292) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSaaF-0005m7-5B for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2013 18:44:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VSaaA-0007w6-Cu for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2013 18:44:23 -0400 Received: from mail-ea0-x235.google.com ([2a00:1450:4013:c01::235]:37789) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSaaA-0007vw-64 for bug-gnu-emacs@gnu.org; Sat, 05 Oct 2013 18:44:18 -0400 Received: by mail-ea0-f181.google.com with SMTP id d10so2509590eaj.12 for ; Sat, 05 Oct 2013 15:44:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=klksB+TgSip7108KEwHDDInKDbcJJJhDywA2hrnmI84=; b=s1GUERKlLQcKRDr+4LkjgARha8nux7TNKTrF1lyMlLxi4b7gouoMvNwdKYV/6omknP wPrDAoj86g9Sy0KC78FjYFV/1P6cu25hOIuq1L0JQpy5iaKCT+Ts6DhwkMGL5wdAIubp MojSYgArtpIaj7O7SJqUVwzP+rrN/nlookVOHGJJRAlLbclR81MaGZLsSaWbt5Z2cfSu 7KcGm8Aqm5bYfzRKlbLvv7m13jRzIiLzJzXlrMO7IvlsJO9p4Ab/Z3kcF1iIkwZEDEX9 8s5s9h0SUH7dpcA9HxUBA7n0/cDyBgclNwE7Zuz5RHG/HwsbVrB0uhdLrg459f977Eoi 3QcQ== X-Received: by 10.14.218.197 with SMTP id k45mr34635199eep.32.1381013057146; Sat, 05 Oct 2013 15:44:17 -0700 (PDT) Received: from axl (93-113-74.netrun.cytanet.com.cy. [93.109.113.74]) by mx.google.com with ESMTPSA id r48sm44305343eev.14.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 05 Oct 2013 15:44:16 -0700 (PDT) From: Dmitry Gutov To: bug-gnu-emacs@gnu.org Subject: 24.3.50; basic-save-buffer should update buffer-file-coding-system value if the contents were written using different coding system Date: Sun, 06 Oct 2013 01:44:09 +0300 Message-ID: <871u3z49ty.fsf@yandex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) Otherwise it's hard to find out which coding system was used, after all. See here why it's useful: http://lists.gnu.org/archive/html/emacs-devel/2013-10/msg00129.html The following test passes in Emacs 24.3 but fails on trunk: (ert-deftest save-buffer-updates-buffer-file-coding-system () (let ((file (expand-file-name "foo" temporary-file-directory)) (default-buffer-file-coding-system 'utf-8-unix)) (unwind-protect (with-temp-buffer (insert "abcdef\n") (write-file file)) (with-current-buffer (find-file-noselect file) (should (eq 'undecided (coding-system-change-eol-conversion buffer-file-coding-system nil))) (insert "=D0=B2=D0=BE=D0=B4=D0=BA=D0=B0 =D0=BC=D0=B0=D1=82=D1=80=D1= =91=D1=88=D0=BA=D0=B0 =D1=81=D0=B5=D0=BB=D1=91=D0=B4=D0=BA=D0=B0") (save-buffer) ;; Fails here: (should (eq 'utf-8-unix buffer-file-coding-system))) (delete-file file)))) In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.6.4) of 2013-10-04 on axl Bzr revision: 114513 eggert@cs.ucla.edu-20131003161631-vox3mdtalfjg13ed Windowing system distributor `The X.Org Foundation', version 11.0.11303000 System Description: Ubuntu 13.04 ------------=_1381697042-30979-1--