From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#39190: 28.0.50; two buffers with same buffer-file-name (diff-syntax-fontify-props) Date: Thu, 06 Feb 2020 00:39:19 +0200 Organization: LINKOV.NET Message-ID: <87a75wek14.fsf@mail.linkov.net> References: <875zh73dg8.fsf@betli.tmit.bme.hu> <8736c921s6.fsf@mail.linkov.net> <875zh13e5d.fsf@mail.linkov.net> <87h80iqafm.fsf@betli.tmit.bme.hu> <87ftg0fnyb.fsf@mail.linkov.net> <87d0b3qz3m.fsf@betli.tmit.bme.hu> <871rrhkgkm.fsf@mail.linkov.net> <87v9os914e.fsf@betli.tmit.bme.hu> <87a764y35u.fsf@mail.linkov.net> <87r1zd8gvx.fsf@betli.tmit.bme.hu> <87imknqogu.fsf@mail.linkov.net> <87lfpi548j.fsf@mail.linkov.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="63689"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) Cc: 39190@debbugs.gnu.org, Felician Nemeth To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 05 23:42:29 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 1izTNN-000GTm-E9 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 05 Feb 2020 23:42:29 +0100 Original-Received: from localhost ([::1]:57858 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izTNM-00071B-H2 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 05 Feb 2020 17:42:28 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56438) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1izTMy-0006bs-MQ for bug-gnu-emacs@gnu.org; Wed, 05 Feb 2020 17:42:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1izTMx-0005IF-2p for bug-gnu-emacs@gnu.org; Wed, 05 Feb 2020 17:42:04 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:40954) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1izTMw-0005GZ-TT for bug-gnu-emacs@gnu.org; Wed, 05 Feb 2020 17:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1izTMw-00026T-Rz for bug-gnu-emacs@gnu.org; Wed, 05 Feb 2020 17:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 Feb 2020 22:42: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.15809424748008 (code B ref 39190); Wed, 05 Feb 2020 22:42:02 +0000 Original-Received: (at 39190) by debbugs.gnu.org; 5 Feb 2020 22:41:14 +0000 Original-Received: from localhost ([127.0.0.1]:46924 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1izTM9-000256-Po for submit@debbugs.gnu.org; Wed, 05 Feb 2020 17:41:13 -0500 Original-Received: from dog.birch.relay.mailchannels.net ([23.83.209.48]:57781) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1izTM8-00024y-Cy for 39190@debbugs.gnu.org; Wed, 05 Feb 2020 17:41:12 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 340C3501C0B; Wed, 5 Feb 2020 22:41:11 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a97.g.dreamhost.com (100-96-217-5.trex.outbound.svc.cluster.local [100.96.217.5]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id B5A0A50188B; Wed, 5 Feb 2020 22:41:10 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a97.g.dreamhost.com ([TEMPUNAVAIL]. [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.5); Wed, 05 Feb 2020 22:41:11 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Macabre-Tart: 76fdee9e501fc663_1580942470992_3398944339 X-MC-Loop-Signature: 1580942470992:1567279887 X-MC-Ingress-Time: 1580942470991 Original-Received: from pdx1-sub0-mail-a97.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a97.g.dreamhost.com (Postfix) with ESMTP id BEECF7F10B; Wed, 5 Feb 2020 14:41:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=linkov.net; bh=xx0yxtYMGkdzmtLqVtT5Pw7VeRM=; b= lo2khOGTY/LTkkqyg7EJW79JZ8+MlIX0HyRxFxNxu2LrtCRqJiPTwSe41V1xFwDS dFKwXhLTJg6stznpV8spxscRXlYd3MZX32/ga6ldvKzddyRoD7ftqxbft9jawWbc acjmV9udhK3VrmKwniIkTtWERk7wypGXAQOqV/3t26Q= Original-Received: from mail.jurta.org (m91-129-105-126.cust.tele2.ee [91.129.105.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a97.g.dreamhost.com (Postfix) with ESMTPSA id BF0D77F109; Wed, 5 Feb 2020 14:41:02 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a97 In-Reply-To: <87lfpi548j.fsf@mail.linkov.net> (Juri Linkov's message of "Wed, 05 Feb 2020 01:20:44 +0200") X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrhedvgddtudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg 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:175718 Archived-At: >> That's the problem with the current approach: we end up making decisions >> which can't be justified. Whether mode hooks should be run or not >> depends on the hook and various other things. What we *do* know, OTOH >> is that `vc-find-revision-no-save`s buffer is not associated with >> a file, so setting `buffer-file-name` can result in bugs. > > delay-mode-hooks was intended as the safest workaround to install in emacs-27. delay-mode-hooks is now in emacs-27. > Using alternatives of buffer-file-name are not straightforward > and need more testing in emacs-28. I don't know how to handle this more properly because some hooks should be run with buffer-file-name, e.g. generic-mode-find-file-hook that uses buffer-file-name to add more font-lock highlighting. But some hooks like in Eglot assume that buffer-file-name associates the buffer with a file. Also I tried to use indirect buffers: (let ((buffer (make-indirect-buffer (current-buffer) (generate-new-buffer-name (buffer-name))))) (funcall (unwind-protect (with-current-buffer buffer (let ((buffer-file-name "/tmp/foo.el")) (set-auto-mode) major-mode)) (kill-buffer buffer)))) but not sure if it's enough to just set its deduced mode.