From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#66825: last-coding-system-used in basic-save-buffer Date: Mon, 30 Oct 2023 19:20:19 +0200 Organization: LINKOV.NET Message-ID: <86pm0wb47g.fsf@mail.linkov.net> References: <86v8apv3m7.fsf_-_@mail.linkov.net> <8334xtb560.fsf@gnu.org> <86bkcgy1oc.fsf@mail.linkov.net> <83wmv49uib.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18330"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) Cc: 66825@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 30 18:29:09 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qxW4a-0004cj-Ot for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 30 Oct 2023 18:29:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qxW3z-00084s-HJ; Mon, 30 Oct 2023 13:28:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qxW3x-00084k-E6 for bug-gnu-emacs@gnu.org; Mon, 30 Oct 2023 13:28:29 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qxW3x-0006II-5p for bug-gnu-emacs@gnu.org; Mon, 30 Oct 2023 13:28:29 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qxW4U-00034Z-5T for bug-gnu-emacs@gnu.org; Mon, 30 Oct 2023 13:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 30 Oct 2023 17:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66825 X-GNU-PR-Package: emacs Original-Received: via spool by 66825-submit@debbugs.gnu.org id=B66825.169868689911752 (code B ref 66825); Mon, 30 Oct 2023 17:29:02 +0000 Original-Received: (at 66825) by debbugs.gnu.org; 30 Oct 2023 17:28:19 +0000 Original-Received: from localhost ([127.0.0.1]:46649 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qxW3m-00033T-QC for submit@debbugs.gnu.org; Mon, 30 Oct 2023 13:28:19 -0400 Original-Received: from relay8-d.mail.gandi.net ([217.70.183.201]:57995) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qxW3g-00033B-Ls for 66825@debbugs.gnu.org; Mon, 30 Oct 2023 13:28:17 -0400 Original-Received: by mail.gandi.net (Postfix) with ESMTPSA id 011FB1BF20B; Mon, 30 Oct 2023 17:27:31 +0000 (UTC) In-Reply-To: <83wmv49uib.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 30 Oct 2023 14:15:08 +0200") X-GND-Sasl: juri@linkov.net X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:273552 Archived-At: >> I don't understand this alternative. The mode line updating >> that uses 'project-mode-line-format' that unintentionally >> changes 'last-coding-system-used' is called from this line >> in 'basic-save-buffer-2': >> >> (write-region nil nil >> buffer-file-name nil t buffer-file-truename) >> >> because this call in 'write_region' updates the mode line: >> >> message_with_string ((NUMBERP (append) >> ? "Updated %s" >> : ! NILP (append) >> ? "Added to %s" >> : "Wrote %s"), >> visit_file, 1); > > How does message_with_string update the mode line? I'm not know, some deeper function needs to update the mode line when the multi-line message resizes the echo area. > And why does last-coding-system-used get set to raw-text-unix in this > scenario anyway? Because send_process needs to set it to raw-text-unix for ispell: send_process (Lisp_Object proc, const char *buf, ptrdiff_t len, Lisp_Object object) { Vlast_coding_system_used = CODING_ID_NAME (coding->id); Here is a backtrace: send_process process-send-string ispell-send-string ispell-buffer-local-parsing ispell-accept-buffer-local-defs flyspell-accept-buffer-local-defs flyspell--mode-on flyspell-mode hack-one-local-variable(mode flyspell) hack-local-variables-apply hack-dir-local-variables-non-file-buffer project--value-in-dir project-name project-mode-line-format eval((project-mode-line-format)) write-region basic-save-buffer-2 basic-save-buffer-1 basic-save-buffer save-buffer