From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier 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 08:58:32 -0500 Message-ID: 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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="129573"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 39190@debbugs.gnu.org, felician.nemeth@gmail.com, juri@linkov.net To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 28 14:59:16 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 1iwROZ-000XYE-Ei for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 Jan 2020 14:59:16 +0100 Original-Received: from localhost ([::1]:59566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwROY-000744-LQ for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 Jan 2020 08:59:10 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40995) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwROR-00073l-HN for bug-gnu-emacs@gnu.org; Tue, 28 Jan 2020 08:59:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iwROQ-0006mz-Ch for bug-gnu-emacs@gnu.org; Tue, 28 Jan 2020 08:59:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53753) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iwROQ-0006mv-9x for bug-gnu-emacs@gnu.org; Tue, 28 Jan 2020 08:59:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iwROQ-0000BK-CU for bug-gnu-emacs@gnu.org; Tue, 28 Jan 2020 08:59:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Jan 2020 13:59: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.1580219924672 (code B ref 39190); Tue, 28 Jan 2020 13:59:02 +0000 Original-Received: (at 39190) by debbugs.gnu.org; 28 Jan 2020 13:58:44 +0000 Original-Received: from localhost ([127.0.0.1]:59726 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwRO7-0000Am-Qn for submit@debbugs.gnu.org; Tue, 28 Jan 2020 08:58:44 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:56668) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwRO6-0000AZ-03 for 39190@debbugs.gnu.org; Tue, 28 Jan 2020 08:58:42 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 42916100ED0; Tue, 28 Jan 2020 08:58:36 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 42154101347; Tue, 28 Jan 2020 08:58:34 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1580219914; bh=NBdqG1S92eP317/eP2ply7Sj6wr0QaiMLwldr50Kj/s=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=b77W75GFh6z8OFjqR1gCPgROR8Aycq+4Y0NJJ8q0+G0/4AAwTH4abTmYDF7zsOxJd Cw2h+z9xVFcbvgpFK+rr+Q/iXt57vD3V45m159XITE2nyNZICk/PIElIG7KRNYrgQP HgouArDLzM3woWcv4jnmhAhIlaPU7GD9K9ddgrcjWKItBCkuGeeFJEldQbcEt3HIRN ccsmY74mpIN7G+8mOYEZhnNN9yHgEGvncelSXmGv4tFEpN6OUDb3Ql8uIHocLU4a54 p5mY2mFBB0xYDB2lWDFvA8yXQglnOU07aI2op124eAz0lJVA3/Tae191V6ZLm1RhIY JDbsNokv+aGNQ== Original-Received: from pastel (unknown [45.72.213.248]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 5C42F12087E; Tue, 28 Jan 2020 08:58:33 -0500 (EST) In-Reply-To: <83blqontlu.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 28 Jan 2020 05:32:45 +0200") 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:175354 Archived-At: > I wasn't following this thread closely, so I don't have a clear idea > what problems does this change try to solve. Could you humor me with > a summary, please? Why isn't buffer-file-name enough? 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`. Stefan