From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#39190: 28.0.50; two buffers with same buffer-file-name (diff-syntax-fontify-props) Date: Tue, 28 Jan 2020 19:54:58 +0200 Message-ID: <837e1bo499.fsf@gnu.org> References: <875zh73dg8.fsf@betli.tmit.bme.hu> <8736c921s6.fsf@mail.linkov.net> <875zh13e5d.fsf@mail.linkov.net> <87imkwfnyv.fsf@mail.linkov.net> <83blqontlu.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="101568"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 39190@debbugs.gnu.org, felician.nemeth@gmail.com, juri@linkov.net To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 28 19:39:56 2020 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 1iwVmG-000QNp-Tq for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 Jan 2020 19:39:56 +0100 Original-Received: from localhost ([::1]:35326 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwVmF-0001m2-RI for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 Jan 2020 13:39:55 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60932) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwV5o-0000gt-BD for bug-gnu-emacs@gnu.org; Tue, 28 Jan 2020 12:56:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iwV5m-0003IU-Ru for bug-gnu-emacs@gnu.org; Tue, 28 Jan 2020 12:56:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55093) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iwV5m-0003HY-Bf for bug-gnu-emacs@gnu.org; Tue, 28 Jan 2020 12:56:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iwV5m-0006ML-A8 for bug-gnu-emacs@gnu.org; Tue, 28 Jan 2020 12:56:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Jan 2020 17:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39190 X-GNU-PR-Package: emacs Original-Received: via spool by 39190-submit@debbugs.gnu.org id=B39190.158023411724384 (code B ref 39190); Tue, 28 Jan 2020 17:56:02 +0000 Original-Received: (at 39190) by debbugs.gnu.org; 28 Jan 2020 17:55:17 +0000 Original-Received: from localhost ([127.0.0.1]:32833 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwV53-0006LE-4A for submit@debbugs.gnu.org; Tue, 28 Jan 2020 12:55:17 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50321) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwV51-0006Ky-GT for 39190@debbugs.gnu.org; Tue, 28 Jan 2020 12:55:15 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:60320) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iwV4v-0001QM-Ho; Tue, 28 Jan 2020 12:55:09 -0500 Original-Received: from [176.228.60.248] (port=2193 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1iwV4q-0001ZX-8m; Tue, 28 Jan 2020 12:55:06 -0500 In-reply-to: (message from Stefan Monnier on Tue, 28 Jan 2020 08:58:32 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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" Xref: news.gmane.io gmane.emacs.bugs:175360 Archived-At: > From: Stefan Monnier > Cc: juri@linkov.net, 39190@debbugs.gnu.org, felician.nemeth@gmail.com > Date: Tue, 28 Jan 2020 08:58:32 -0500 > > Some packages set `buffer-file-name` in temp-buffers in order to > activate the major mode of the corresponding file. As you can see in > the patch it's used in various circumstances. > > Most of the time this is harmless because it's transient, but it is > fundamentally a lie (it more or less claims that this temp buffer holds > the content of that file, even though it's not the case (not only > because the content doesn't match, but the buffer is usually not fully > set up as a proper file buffer, it can lead to get-file-buffer returning > the wrong buffer, ...) and even though it's transient it can cause > problems because hooks are run during this time (e.g. major mode hooks) > which may take action under the mistaken assumption that this buffer > really correspond to the file. > > In the original bug report the problem was that the major mode activated > `eglot-mode` in this temp buffer. There are many ways for this to > create problems. The immediate error can be avoided in eglot of course, > but I think the problem goes deeper and we should fix it by making it > possible to set the major mode without having to lie about > `buffer-file-name`. Thanks. So this is because those modes set buffer-file-name instead of activating the major mode directly? And by setting buffer-file-name they by side effect tell unrelated features that this buffer is associated with a file? If so, then I'm not sure I understand the solution. The offending modes will have to be modified to use this new variable instead of buffer-file-name, no? And if we have to modify them, then why not do TRT while at that, i.e. call the major mode directly instead of setting some variable? Or what am I missing?