GNU bug report logs - #39190
28.0.50; two buffers with same buffer-file-name (diff-syntax-fontify-props)

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Felician Nemeth <felician.nemeth@HIDDEN>; dated Sun, 19 Jan 2020 11:15:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 20 Feb 2020 00:59:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 19 19:59:14 2020
Received: from localhost ([127.0.0.1]:43618 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j4aBO-0003He-9d
	for submit <at> debbugs.gnu.org; Wed, 19 Feb 2020 19:59:14 -0500
Received: from fossa.birch.relay.mailchannels.net ([23.83.209.62]:20119)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1j4aBM-0003HT-Hk
 for 39190 <at> debbugs.gnu.org; Wed, 19 Feb 2020 19:59:13 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 1B46F3417ED;
 Thu, 20 Feb 2020 00:59:11 +0000 (UTC)
Received: from pdx1-sub0-mail-a76.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 911B53416AE;
 Thu, 20 Feb 2020 00:59:10 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a76.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); Thu, 20 Feb 2020 00:59:11 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Gusty-Irritate: 06edf4115642bad5_1582160350832_3138149028
X-MC-Loop-Signature: 1582160350832:1253166760
X-MC-Ingress-Time: 1582160350832
Received: from pdx1-sub0-mail-a76.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a76.g.dreamhost.com (Postfix) with ESMTP id 0EDD0B071D;
 Wed, 19 Feb 2020 16:59:06 -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=tXEvO9PQFuYX3pTaNFq/q1laCFU=; b=
 VtYIvjafSCeenVxAvB1Z1oDylq0lp4PXix6D75AYVX0fKKJinNX6gzALq6FK30YX
 l6Urj7HOZECy+ilXotvPVpsjwhrCIk0KMqPOIYp+hCx3jF2s+Wr3ZguZALWM2qYl
 K+YL9qeW2aJZvptUXh/CSjUb3u2s7xuZiQ4yGqFhUTA=
Received: from localhost.linkov.net (m91-129-103-27.cust.tele2.ee
 [91.129.103.27])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a76.g.dreamhost.com (Postfix) with ESMTPSA id A3311B071E;
 Wed, 19 Feb 2020 16:59:03 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a76
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <87imknqogu.fsf@HIDDEN>
 <jwvzhdy5vdx.fsf-monnier+emacs@HIDDEN>
 <87lfpi548j.fsf@HIDDEN> <87a75wek14.fsf@HIDDEN>
 <87sgjj7njt.fsf@HIDDEN> <87o8twep2f.fsf@HIDDEN>
 <jwvwo8kggvu.fsf-monnier+emacs@HIDDEN>
 <87sgj78q2o.fsf@HIDDEN>
 <jwvimk3fqeq.fsf-monnier+emacs@HIDDEN>
 <jwvd0abfpag.fsf-monnier+emacs@HIDDEN>
 <87r1yr2yge.fsf@HIDDEN>
 <jwvv9o2emw9.fsf-monnier+emacs@HIDDEN>
Date: Thu, 20 Feb 2020 02:58:20 +0200
In-Reply-To: <jwvv9o2emw9.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Wed, 19 Feb 2020 08:20:11 -0500")
Message-ID: <87wo8ioz0z.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrkedugddvlecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddtfedrvdejnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhppdhhvghloheplhhotggrlhhhohhsthdrlhhinhhkohhvrdhnvghtpdhinhgvthepledurdduvdelrddutdefrddvjedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> I tested this with additional patch that replaces `conf-mode` calls with
>> `conf-guess-mode`, and see that syntax font-lock now is fixed in diff-mode
>> on some conf files (not tested on all possible conf submodes).
>
> This said.  Using delay-mode-hooks in the diff-syntax driver is an ugly
> hack and is the real source of the problem, so splitting conf-mode into
> two is basically a way to work around the breakage introduced by the hack.

Indeed, but it seems it's too late to redesign this in the release
branch.  So unfontified conf-mode files in diff hunks is a trade-off
for not breaking the release.

As for changes in master, I tried something like this to use in
diff-syntax-fontify-props instead of direct set-auto-mode call:

(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))))

It calls set-auto-mode in a temporary buffer.

Do you think this is the right direction?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 19 Feb 2020 13:20:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 19 08:20:30 2020
Received: from localhost ([127.0.0.1]:41763 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j4PHB-0007Cc-OY
	for submit <at> debbugs.gnu.org; Wed, 19 Feb 2020 08:20:30 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:19812)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1j4PHA-0007CP-7l
 for 39190 <at> debbugs.gnu.org; Wed, 19 Feb 2020 08:20:29 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 946D844EA4F;
 Wed, 19 Feb 2020 08:20:22 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id C4FF944EA4D;
 Wed, 19 Feb 2020 08:20:13 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1582118413;
 bh=RKtMjJbp2ZBv51N1QKvOJ6EXBL5Qo+Okm8jy1Q1GY64=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=k7GzervhmQj7KGT1FtzWNCgzI4oCM2Zt1gsEvMDuG6R/dO6c3CwltH6ncCeExaAEL
 RHsgoE1Kou8gnZbI7wmFuNLCG/mYvGa7bUBuM4XLE8H6LDpKYxUkbMhKPDIKGMTb7O
 6yw5qfjCOyys5TONq35Vl+t4pZGNnCuAAeIC0cckaL8g2YjUrKL4Mssk965M1VLIKw
 6YSySQLNhT+FFObWeEn1KLCBZT/FAmHT5j33OTl/w4yfBzH2V3DBxRKD5pAjezdCsx
 uKYOMBV7oL4Ar3k4E5fry6s8CIrYrLfbAzr0hLx5tmqvtn5K95tqDOEV9vo+IUWEfc
 D9basDgMYD7rw==
Received: from pastel (unknown [157.52.14.222])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 5DFFC1204AE;
 Wed, 19 Feb 2020 08:20:12 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwvv9o2emw9.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <87imknqogu.fsf@HIDDEN>
 <jwvzhdy5vdx.fsf-monnier+emacs@HIDDEN>
 <87lfpi548j.fsf@HIDDEN> <87a75wek14.fsf@HIDDEN>
 <87sgjj7njt.fsf@HIDDEN> <87o8twep2f.fsf@HIDDEN>
 <jwvwo8kggvu.fsf-monnier+emacs@HIDDEN>
 <87sgj78q2o.fsf@HIDDEN>
 <jwvimk3fqeq.fsf-monnier+emacs@HIDDEN>
 <jwvd0abfpag.fsf-monnier+emacs@HIDDEN>
 <87r1yr2yge.fsf@HIDDEN>
Date: Wed, 19 Feb 2020 08:20:11 -0500
In-Reply-To: <87r1yr2yge.fsf@HIDDEN> (Juri Linkov's message of "Wed, 
 19 Feb 2020 02:49:21 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.024 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> I tested this with additional patch that replaces `conf-mode` calls with
> `conf-guess-mode`, and see that syntax font-lock now is fixed in diff-mode
> on some conf files (not tested on all possible conf submodes).

This said.  Using delay-mode-hooks in the diff-syntax driver is an ugly
hack and is the real source of the problem, so splitting conf-mode into
two is basically a way to work around the breakage introduced by the hack.


        Stefan


> diff --git a/lisp/files.el b/lisp/files.el
> index 683f4a8ce7..3e1cf5e526 100644
> --- a/lisp/files.el
> +++ b/lisp/files.el
> @@ -2813,7 +2813,7 @@ auto-mode-alist
>       ("/config\\.\\(?:bat\\|log\\)\\'" . fundamental-mode)
>       ("/\\.\\(authinfo\\|netrc\\)\\'" . authinfo-mode)
>       ;; Windows candidates may be opened case sensitively on Unix
> -     ("\\.\\(?:[iI][nN][iI]\\|[lL][sS][tT]\\|[rR][eE][gG]\\|[sS][yY][sS]\\)\\'" . conf-mode)
> +     ("\\.\\(?:[iI][nN][iI]\\|[lL][sS][tT]\\|[rR][eE][gG]\\|[sS][yY][sS]\\)\\'" . conf-guess-mode)
>       ("\\.la\\'" . conf-unix-mode)
>       ("\\.ppd\\'" . conf-ppd-mode)
>       ("java.+\\.conf\\'" . conf-javaprop-mode)
> @@ -2822,15 +2822,15 @@ auto-mode-alist
>       ("\\.desktop\\'" . conf-desktop-mode)
>       ("/\\.redshift.conf\\'" . conf-windows-mode)
>       ("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|pam\\.d/.*\\|permissions\\(?:\\.d/.+\\)?\\|protocols\\|rpc\\|services\\)\\'" . conf-space-mode)
> -     ("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'" . conf-mode)
> +     ("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'" . conf-guess-mode)
>       ;; ChangeLog.old etc.  Other change-log-mode entries are above;
>       ;; this has lower priority to avoid matching changelog.sgml etc.
>       ("[cC]hange[lL]og[-.][-0-9a-z]+\\'" . change-log-mode)
>       ;; either user's dot-files or under /etc or some such
> -     ("/\\.?\\(?:gitconfig\\|gnokiirc\\|hgrc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'" . conf-mode)
> +     ("/\\.?\\(?:gitconfig\\|gnokiirc\\|hgrc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'" . conf-guess-mode)
>       ;; alas not all ~/.*rc files are like this
> -     ("/\\.\\(?:asound\\|enigma\\|fetchmail\\|gltron\\|gtk\\|hxplayer\\|mairix\\|mbsync\\|msmtp\\|net\\|neverball\\|nvidia-settings-\\|offlineimap\\|qt/.+\\|realplayer\\|reportbug\\|rtorrent\\.\\|screen\\|scummvm\\|sversion\\|sylpheed/.+\\|xmp\\)rc\\'" . conf-mode)
> -     ("/\\.\\(?:gdbtkinit\\|grip\\|mpdconf\\|notmuch-config\\|orbital/.+txt\\|rhosts\\|tuxracer/options\\)\\'" . conf-mode)
> +     ("/\\.\\(?:asound\\|enigma\\|fetchmail\\|gltron\\|gtk\\|hxplayer\\|mairix\\|mbsync\\|msmtp\\|net\\|neverball\\|nvidia-settings-\\|offlineimap\\|qt/.+\\|realplayer\\|reportbug\\|rtorrent\\.\\|screen\\|scummvm\\|sversion\\|sylpheed/.+\\|xmp\\)rc\\'" . conf-guess-mode)
> +     ("/\\.\\(?:gdbtkinit\\|grip\\|mpdconf\\|notmuch-config\\|orbital/.+txt\\|rhosts\\|tuxracer/options\\)\\'" . conf-guess-mode)
>       ("/\\.?X\\(?:default\\|resource\\|re\\)s\\>" . conf-xdefaults-mode)
>       ("/X11.+app-defaults/\\|\\.ad\\'" . conf-xdefaults-mode)
>       ("/X11.+locale/.+/Compose\\'" . conf-colon-mode)
> @@ -2920,7 +2920,7 @@ conf-mode-maybe
>  	  (goto-char (point-min))
>  	  (looking-at "<\\?xml \\|<!-- \\|<!DOCTYPE ")))
>        (xml-mode)
> -    (conf-mode)))
> +    (conf-guess-mode)))
>  
>  (defvar interpreter-mode-alist
>    ;; Note: The entries for the modes defined in cc-mode.el (awk-mode





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 19 Feb 2020 00:51:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 18 19:51:22 2020
Received: from localhost ([127.0.0.1]:41484 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j4DaE-0001Y8-58
	for submit <at> debbugs.gnu.org; Tue, 18 Feb 2020 19:51:22 -0500
Received: from bumble.birch.relay.mailchannels.net ([23.83.209.25]:43689)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1j4DaC-0001Y0-57
 for 39190 <at> debbugs.gnu.org; Tue, 18 Feb 2020 19:51:20 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id E209A340978;
 Wed, 19 Feb 2020 00:51:18 +0000 (UTC)
Received: from pdx1-sub0-mail-a86.g.dreamhost.com
 (100-96-0-6.trex.outbound.svc.cluster.local [100.96.0.6])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 76DEF3408FB;
 Wed, 19 Feb 2020 00:51:18 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a86.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, 19 Feb 2020 00:51:18 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Abortive-Squirrel: 289d15575373896c_1582073478714_2440147367
X-MC-Loop-Signature: 1582073478714:1425273395
X-MC-Ingress-Time: 1582073478714
Received: from pdx1-sub0-mail-a86.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a86.g.dreamhost.com (Postfix) with ESMTP id 572627F04E;
 Tue, 18 Feb 2020 16:51:15 -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=5M23XJa/NPK24o/8elSt8A9hly0=; b=
 21b0m6lujnyCQM+pr5PvojiYiQWEcL9pf4hbPeq+chgFdrNvNmojZ9hxnvwBR86A
 XhJreMGtzRmbTk56VpucJC+WDzHMY+x1oS7FZAFnnd+bWEsTy4YGTQfEsJQVXoCF
 kst8BRnoqb3tIqVvc/4mrA6E5Rlrq74Z7RSkUrJyvaI=
Received: from localhost.linkov.net (m91-129-103-27.cust.tele2.ee
 [91.129.103.27])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a86.g.dreamhost.com (Postfix) with ESMTPSA id 123077F027;
 Tue, 18 Feb 2020 16:51:12 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a86
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <87imknqogu.fsf@HIDDEN>
 <jwvzhdy5vdx.fsf-monnier+emacs@HIDDEN>
 <87lfpi548j.fsf@HIDDEN> <87a75wek14.fsf@HIDDEN>
 <87sgjj7njt.fsf@HIDDEN> <87o8twep2f.fsf@HIDDEN>
 <jwvwo8kggvu.fsf-monnier+emacs@HIDDEN>
 <87sgj78q2o.fsf@HIDDEN>
 <jwvimk3fqeq.fsf-monnier+emacs@HIDDEN>
 <jwvd0abfpag.fsf-monnier+emacs@HIDDEN>
Date: Wed, 19 Feb 2020 02:49:21 +0200
In-Reply-To: <jwvd0abfpag.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Tue, 18 Feb 2020 18:31:38 -0500")
Message-ID: <87r1yr2yge.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrjeelgddvhecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddtfedrvdejnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehmohguvgepshhmthhppdhhvghloheplhhotggrlhhhohhsthdrlhhinhhkohhvrdhnvghtpdhinhgvthepledurdduvdelrddutdefrddvjedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> That's kinda hard if you want to use define-derived-mode and we do: when
>> we call `conf-foo-mode` the first things it does is: bind
>> `delay-mode-hooks` and call the parent (`conf-mode`), so the only
>> difference between this call to the parent and a direct call to the
>> generic entry point is the binding of `delay-mode-hooks`.
>
> IOW, I think we should start with something like the patch below which
> makes `conf-guess-mode` available, after which we can start fixing the
> various callers to call `conf-guess-mode` instead.

I tested this with additional patch that replaces `conf-mode` calls with
`conf-guess-mode`, and see that syntax font-lock now is fixed in diff-mode
on some conf files (not tested on all possible conf submodes).

diff --git a/lisp/files.el b/lisp/files.el
index 683f4a8ce7..3e1cf5e526 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2813,7 +2813,7 @@ auto-mode-alist
      ("/config\\.\\(?:bat\\|log\\)\\'" . fundamental-mode)
      ("/\\.\\(authinfo\\|netrc\\)\\'" . authinfo-mode)
      ;; Windows candidates may be opened case sensitively on Unix
-     ("\\.\\(?:[iI][nN][iI]\\|[lL][sS][tT]\\|[rR][eE][gG]\\|[sS][yY][sS]\\)\\'" . conf-mode)
+     ("\\.\\(?:[iI][nN][iI]\\|[lL][sS][tT]\\|[rR][eE][gG]\\|[sS][yY][sS]\\)\\'" . conf-guess-mode)
      ("\\.la\\'" . conf-unix-mode)
      ("\\.ppd\\'" . conf-ppd-mode)
      ("java.+\\.conf\\'" . conf-javaprop-mode)
@@ -2822,15 +2822,15 @@ auto-mode-alist
      ("\\.desktop\\'" . conf-desktop-mode)
      ("/\\.redshift.conf\\'" . conf-windows-mode)
      ("\\`/etc/\\(?:DIR_COLORS\\|ethers\\|.?fstab\\|.*hosts\\|lesskey\\|login\\.?de\\(?:fs\\|vperm\\)\\|magic\\|mtab\\|pam\\.d/.*\\|permissions\\(?:\\.d/.+\\)?\\|protocols\\|rpc\\|services\\)\\'" . conf-space-mode)
-     ("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'" . conf-mode)
+     ("\\`/etc/\\(?:acpid?/.+\\|aliases\\(?:\\.d/.+\\)?\\|default/.+\\|group-?\\|hosts\\..+\\|inittab\\|ksysguarddrc\\|opera6rc\\|passwd-?\\|shadow-?\\|sysconfig/.+\\)\\'" . conf-guess-mode)
      ;; ChangeLog.old etc.  Other change-log-mode entries are above;
      ;; this has lower priority to avoid matching changelog.sgml etc.
      ("[cC]hange[lL]og[-.][-0-9a-z]+\\'" . change-log-mode)
      ;; either user's dot-files or under /etc or some such
-     ("/\\.?\\(?:gitconfig\\|gnokiirc\\|hgrc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'" . conf-mode)
+     ("/\\.?\\(?:gitconfig\\|gnokiirc\\|hgrc\\|kde.*rc\\|mime\\.types\\|wgetrc\\)\\'" . conf-guess-mode)
      ;; alas not all ~/.*rc files are like this
-     ("/\\.\\(?:asound\\|enigma\\|fetchmail\\|gltron\\|gtk\\|hxplayer\\|mairix\\|mbsync\\|msmtp\\|net\\|neverball\\|nvidia-settings-\\|offlineimap\\|qt/.+\\|realplayer\\|reportbug\\|rtorrent\\.\\|screen\\|scummvm\\|sversion\\|sylpheed/.+\\|xmp\\)rc\\'" . conf-mode)
-     ("/\\.\\(?:gdbtkinit\\|grip\\|mpdconf\\|notmuch-config\\|orbital/.+txt\\|rhosts\\|tuxracer/options\\)\\'" . conf-mode)
+     ("/\\.\\(?:asound\\|enigma\\|fetchmail\\|gltron\\|gtk\\|hxplayer\\|mairix\\|mbsync\\|msmtp\\|net\\|neverball\\|nvidia-settings-\\|offlineimap\\|qt/.+\\|realplayer\\|reportbug\\|rtorrent\\.\\|screen\\|scummvm\\|sversion\\|sylpheed/.+\\|xmp\\)rc\\'" . conf-guess-mode)
+     ("/\\.\\(?:gdbtkinit\\|grip\\|mpdconf\\|notmuch-config\\|orbital/.+txt\\|rhosts\\|tuxracer/options\\)\\'" . conf-guess-mode)
      ("/\\.?X\\(?:default\\|resource\\|re\\)s\\>" . conf-xdefaults-mode)
      ("/X11.+app-defaults/\\|\\.ad\\'" . conf-xdefaults-mode)
      ("/X11.+locale/.+/Compose\\'" . conf-colon-mode)
@@ -2920,7 +2920,7 @@ conf-mode-maybe
 	  (goto-char (point-min))
 	  (looking-at "<\\?xml \\|<!-- \\|<!DOCTYPE ")))
       (xml-mode)
-    (conf-mode)))
+    (conf-guess-mode)))
 
 (defvar interpreter-mode-alist
   ;; Note: The entries for the modes defined in cc-mode.el (awk-mode




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 18 Feb 2020 23:31:54 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 18 18:31:54 2020
Received: from localhost ([127.0.0.1]:41466 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j4CLJ-000863-LN
	for submit <at> debbugs.gnu.org; Tue, 18 Feb 2020 18:31:54 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:16464)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1j4CLH-00085p-54
 for 39190 <at> debbugs.gnu.org; Tue, 18 Feb 2020 18:31:51 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 73C8344E719;
 Tue, 18 Feb 2020 18:31:45 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 9B16244E70E;
 Tue, 18 Feb 2020 18:31:39 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1582068699;
 bh=YT+WlnZSoQpiefxfZAjHlUYtFPKNOEjohfBwGyG3cRU=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=AskAn7MYM3oyaqAIKmH9M+qG+2o5jZ/5Wu5A/MjJ1g2X5vudVKJhPg04ZEJXvpoaR
 j3DwVdpAwRDpcR0YOkc5QtXZm53h+XDQLuIjQ+FZ55R2+KcgKnQ8Otx8BJws7s+EVG
 T3SCc/lg3wYYl28aRnGCjql7PsnnrP8V5c0iGWriToV7N+CGTlSBvQWI/26fLiLzZy
 TD0tkg2VIw53qzxlIFs7J5ygeMZKOlSo8+ujHRmuq8pzZ/cH9kwPFq5Uoh+FiFxYLo
 8FRElwouXw9UgutNI+YLXSfDvVvBLAq2dHaW+O9M6kUsLoJJnYH0a0h46zEgedEfQw
 6sCRjSDFigdTw==
Received: from pastel (unknown [157.52.14.222])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2534A1202F3;
 Tue, 18 Feb 2020 18:31:39 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwvd0abfpag.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <87imknqogu.fsf@HIDDEN>
 <jwvzhdy5vdx.fsf-monnier+emacs@HIDDEN>
 <87lfpi548j.fsf@HIDDEN> <87a75wek14.fsf@HIDDEN>
 <87sgjj7njt.fsf@HIDDEN> <87o8twep2f.fsf@HIDDEN>
 <jwvwo8kggvu.fsf-monnier+emacs@HIDDEN>
 <87sgj78q2o.fsf@HIDDEN>
 <jwvimk3fqeq.fsf-monnier+emacs@HIDDEN>
Date: Tue, 18 Feb 2020 18:31:38 -0500
In-Reply-To: <jwvimk3fqeq.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Tue, 18 Feb 2020 18:07:02 -0500")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.029 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> Maybe a simpler variant would be to use some other variable to distinguish
>> sub-mode and its parent, instead of relying on delay-mode-hooks?
>
> That's kinda hard if you want to use define-derived-mode and we do: when
> we call `conf-foo-mode` the first things it does is: bind
> `delay-mode-hooks` and call the parent (`conf-mode`), so the only
> difference between this call to the parent and a direct call to the
> generic entry point is the binding of `delay-mode-hooks`.

IOW, I think we should start with something like the patch below which
makes `conf-guess-mode` available, after which we can start fixing the
various callers to call `conf-guess-mode` instead.


        Stefan


diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el
index 86db698043..b3325eeff6 100644
--- a/lisp/textmodes/conf-mode.el
+++ b/lisp/textmodes/conf-mode.el
@@ -351,7 +351,37 @@ conf-outline-level
 
 
 ;;;###autoload
-(defun conf-mode ()
+(defun conf-guess-mode ()
+  "Enable the conf-*-mode that seems most appropriate."
+  (let ((unix 0) (win 0) (equal 0) (colon 0) (space 0) (jp 0))
+    (save-excursion
+      (goto-char (point-min))
+      (while (not (eobp))
+	(skip-chars-forward " \t\f")
+	(cond ((eq (char-after) ?\#) (setq unix (1+ unix)))
+	      ((eq (char-after) ?\;) (setq win (1+ win)))
+	      ((eq (char-after) ?\[))	; nop
+	      ((eolp))			; nop
+	      ((eq (char-after) ?}))	; nop
+	      ;; recognize at most double spaces within names
+	      ((looking-at "[^ \t\n=:]+\\(?:  ?[^ \t\n=:]+\\)*[ \t]*[=:]")
+	       (if (eq (char-before (match-end 0)) ?=)
+		   (setq equal (1+ equal))
+		 (setq colon (1+ colon))))
+	      ((looking-at "/[/*]") (setq jp (1+ jp)))
+	      ((looking-at ".*{"))		; nop
+	      ((setq space (1+ space))))
+	(forward-line)))
+    (cond
+     ((> jp (max unix win 3)) (conf-javaprop-mode))
+     ((> colon (max equal space)) (conf-colon-mode))
+     ((> space (max equal colon)) (conf-space-mode))
+     ((or (> win unix) (and (= win unix) (eq system-type 'windows-nt)))
+      (conf-windows-mode))
+     (t (conf-unix-mode)))))
+
+;;;###autoload
+(define-derived-mode conf-mode nil "Conf[?]"
   "Mode for Unix and Windows Conf files and Java properties.
 Most conf files know only three kinds of constructs: parameter
 assignments optionally grouped into sections and comments.  Yet
@@ -372,7 +402,7 @@ conf-mode
 quite right.  Patches that clearly identify some special case,
 without breaking the general ones, are welcome.
 
-If instead you start this mode with the generic `conf-mode'
+If instead you start this mode with the generic `conf-guess-mode'
 command, it will parse the buffer.  It will generally well
 identify the first four cases listed below.  If the buffer
 doesn't have enough contents to decide, this is identical to
@@ -381,46 +411,13 @@ conf-mode
 `conf-ppd-mode' and `conf-xdefaults-mode'.
 
 \\{conf-mode-map}"
-
-  (interactive)
-  ;; `conf-mode' plays two roles: it's the parent of several sub-modes
-  ;; but it's also the function that chooses between those submodes.
-  ;; To tell the difference between those two cases where the function
-  ;; might be called, we check `delay-mode-hooks'.
-  ;; (adopted from tex-mode.el)
+  ;; `conf-mode' is the parent of several sub-modes but it's also sometimes
+  ;; abused as the function that chooses between those submodes.  They should
+  ;; call `conf-guess-mode' directly, but for historical reasons, we try to
+  ;; accommodate those misuses with this ugly hack.
   (if (not delay-mode-hooks)
-      ;; try to guess sub-mode of conf-mode based on buffer content
-      (let ((unix 0) (win 0) (equal 0) (colon 0) (space 0) (jp 0))
-	(save-excursion
-	  (goto-char (point-min))
-	  (while (not (eobp))
-	    (skip-chars-forward " \t\f")
-	    (cond ((eq (char-after) ?\#) (setq unix (1+ unix)))
-		  ((eq (char-after) ?\;) (setq win (1+ win)))
-		  ((eq (char-after) ?\[))	; nop
-		  ((eolp))			; nop
-		  ((eq (char-after) ?}))	; nop
-		  ;; recognize at most double spaces within names
-		  ((looking-at "[^ \t\n=:]+\\(?:  ?[^ \t\n=:]+\\)*[ \t]*[=:]")
-		   (if (eq (char-before (match-end 0)) ?=)
-		       (setq equal (1+ equal))
-		     (setq colon (1+ colon))))
-		  ((looking-at "/[/*]") (setq jp (1+ jp)))
-		  ((looking-at ".*{"))		; nop
-		  ((setq space (1+ space))))
-	    (forward-line)))
-	(cond
-         ((> jp (max unix win 3)) (conf-javaprop-mode))
-         ((> colon (max equal space)) (conf-colon-mode))
-         ((> space (max equal colon)) (conf-space-mode))
-         ((or (> win unix) (and (= win unix) (eq system-type 'windows-nt)))
-          (conf-windows-mode))
-         (t (conf-unix-mode))))
-
-    (kill-all-local-variables)
-    (use-local-map conf-mode-map)
-    (setq major-mode 'conf-mode
-	  mode-name "Conf[?]")
+      ;; Try to guess sub-mode of conf-mode based on buffer content.
+      (conf-guess-mode)
     (set (make-local-variable 'font-lock-defaults)
          '(conf-font-lock-keywords nil t nil nil))
     ;; Let newcomment.el decide this for itself.
@@ -438,8 +435,7 @@ conf-mode
 	    ;; [section]
 	    (nil "^[ \t]*\\[[ \t]*\\(.+\\)[ \t]*\\]" 1)
 	    ;; section { ... }
-	    (nil "^[ \t]*\\([^=:{} \t\n][^=:{}\n]+\\)[ \t\n]*{" 1)))
-    (run-mode-hooks 'conf-mode-hook)))
+	    (nil "^[ \t]*\\([^=:{} \t\n][^=:{}\n]+\\)[ \t\n]*{" 1)))))
 
 (defun conf-mode-initialize (comment &optional font-lock)
   "Initializations for sub-modes of `conf-mode'.





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 18 Feb 2020 23:07:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 18 18:07:14 2020
Received: from localhost ([127.0.0.1]:41451 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j4BxR-0007Uk-Oi
	for submit <at> debbugs.gnu.org; Tue, 18 Feb 2020 18:07:13 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:7864)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1j4BxO-0007UV-U1
 for 39190 <at> debbugs.gnu.org; Tue, 18 Feb 2020 18:07:11 -0500
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 2775E100609;
 Tue, 18 Feb 2020 18:07:05 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0C42710031E;
 Tue, 18 Feb 2020 18:07:03 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1582067223;
 bh=VxezVM4AOcrz9QfrLOaphht6vUQdlgCuTjq5D2tRvY0=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=RsVMn0MEjY/yndi0wx7DsRtLH00EMWE6L5A17J8Suoi77wAKbp9Dr+HireRFOMNcS
 ug8jpGT9C97ZarRSM+TqRLcrjFwq9UM+TbJItYR/h3+wwcKahUcsAdstu/jLlphTlS
 KfaXeqDb0+PlVHUFZX2qaVsjzSL7dHPoxIM4NRBCAiCeaLQ5g4Sp4sZSDaf/4h5rAF
 f/N+BKlI0hmc64XWE26pFfjvhVyxcX1OnyHXWMPlsZtAWNWEAn4U2auiRybspsYz+0
 mHgf8cR3vwJL/BzRqm4KCZygo3ZMoCgqIWX96ZiLTbCQ0JS3iL+owPrvGi5V7ioDu+
 m5Eak9Sd/EP0w==
Received: from pastel (unknown [157.52.14.222])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C308112062C;
 Tue, 18 Feb 2020 18:07:02 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwvimk3fqeq.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <87imknqogu.fsf@HIDDEN>
 <jwvzhdy5vdx.fsf-monnier+emacs@HIDDEN>
 <87lfpi548j.fsf@HIDDEN> <87a75wek14.fsf@HIDDEN>
 <87sgjj7njt.fsf@HIDDEN> <87o8twep2f.fsf@HIDDEN>
 <jwvwo8kggvu.fsf-monnier+emacs@HIDDEN>
 <87sgj78q2o.fsf@HIDDEN>
Date: Tue, 18 Feb 2020 18:07:02 -0500
In-Reply-To: <87sgj78q2o.fsf@HIDDEN> (Juri Linkov's message of "Wed, 
 19 Feb 2020 00:53:51 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.009 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Maybe a simpler variant would be to use some other variable to distinguish
> sub-mode and its parent, instead of relying on delay-mode-hooks?

That's kinda hard if you want to use define-derived-mode and we do: when
we call `conf-foo-mode` the first things it does is: bind
`delay-mode-hooks` and call the parent (`conf-mode`), so the only
difference between this call to the parent and a direct call to the
generic entry point is the binding of `delay-mode-hooks`.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 18 Feb 2020 22:56:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 18 17:56:30 2020
Received: from localhost ([127.0.0.1]:41444 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j4Bn3-0007E7-MS
	for submit <at> debbugs.gnu.org; Tue, 18 Feb 2020 17:56:29 -0500
Received: from beige.elm.relay.mailchannels.net ([23.83.212.16]:45801)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1j4Bn1-0007Dy-EY
 for 39190 <at> debbugs.gnu.org; Tue, 18 Feb 2020 17:56:27 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 35F36217F2;
 Tue, 18 Feb 2020 22:56:26 +0000 (UTC)
Received: from pdx1-sub0-mail-a86.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 B725521507;
 Tue, 18 Feb 2020 22:56:25 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a86.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); Tue, 18 Feb 2020 22:56:26 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Belong-Cellar: 0aa7f08c137ba586_1582066585972_3439453576
X-MC-Loop-Signature: 1582066585972:3603370356
X-MC-Ingress-Time: 1582066585971
Received: from pdx1-sub0-mail-a86.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a86.g.dreamhost.com (Postfix) with ESMTP id 45B9E7EF5F;
 Tue, 18 Feb 2020 14:56:24 -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:content-transfer-encoding; s=linkov.net; bh=WN9KH/
 fHT0ZFVbfC6/WeHAm/Bmk=; b=M3MCZ2hiahnxrHYC/WWsYZw/y6359/93Og1YVR
 jbyKpZ1ReKQ84mKByMDYO4Vk2M6IoUbA4Cc0OKDzD9Wa+1d0j3xvtApyMqP0KYVA
 jp30poco5FP56w5kjhHKFB+tQyjLEghurXaMFn1kbT9hQUHhzHwvu15FRlPDbrL8
 xOr/U=
Received: from localhost.linkov.net (m91-129-103-27.cust.tele2.ee
 [91.129.103.27])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a86.g.dreamhost.com (Postfix) with ESMTPSA id C5F147EF5D;
 Tue, 18 Feb 2020 14:56:21 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a86
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <87imknqogu.fsf@HIDDEN>
 <jwvzhdy5vdx.fsf-monnier+emacs@HIDDEN>
 <87lfpi548j.fsf@HIDDEN> <87a75wek14.fsf@HIDDEN>
 <87sgjj7njt.fsf@HIDDEN> <87o8twep2f.fsf@HIDDEN>
 <jwvwo8kggvu.fsf-monnier+emacs@HIDDEN>
Date: Wed, 19 Feb 2020 00:53:51 +0200
In-Reply-To: <jwvwo8kggvu.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Tue, 18 Feb 2020 08:33:48 -0500")
Message-ID: <87sgj78q2o.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrjeelgddtudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtgfesthekredttderjeenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdefrddvjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehlohgtrghlhhhoshhtrdhlihhnkhhovhdrnhgvthdpihhnvghtpeeluddruddvledruddtfedrvdejpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepmhhonhhnihgvrhesihhrohdruhhmohhnthhrvggrlhdrtggr
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> (defun conf-mode ()
>>   ...
>>   ;; `conf-mode' plays two roles: it's the parent of several sub-modes
>>   ;; but it's also the function that chooses between those submodes.
>>   ;; To tell the difference between those two cases where the function
>>   ;; might be called, we check `delay-mode-hooks'.
>>   ;; (adopted from tex-mode.el)
>>   (if (not delay-mode-hooks)
>>       ;; try to guess sub-mode of conf-mode based on buffer content
>
> The Right Thing=E2=84=A2 to do is of course to split `conf-mode` into t=
wo
> functions, one for the generic entry point and the other for the shared
> parent mode.

Maybe a simpler variant would be to use some other variable to distinguis=
h
sub-mode and its parent, instead of relying on delay-mode-hooks?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 18 Feb 2020 13:33:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 18 08:33:58 2020
Received: from localhost ([127.0.0.1]:39661 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j430g-0007ti-CA
	for submit <at> debbugs.gnu.org; Tue, 18 Feb 2020 08:33:58 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:43546)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1j430e-0007tV-Ll
 for 39190 <at> debbugs.gnu.org; Tue, 18 Feb 2020 08:33:57 -0500
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0501F100473;
 Tue, 18 Feb 2020 08:33:51 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 59A1A1002CF;
 Tue, 18 Feb 2020 08:33:49 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1582032829;
 bh=vpRs1CSxcJpm0xtOYdrwBJXCNu3kmk72KJm2FzKBgzk=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=CfkCfT+AUR5uXHtHpv0aq2eFlMwawevh09uk3irxAOUwj0RX63s7ne1ot1pMzhgpB
 TnjfI4kn1mcgBHj6A3R0sJ+W2R18djEP6QPjODK0Px1Ezcf3k7IQCL7c7nNjpxLV8B
 FYGfMOB4Yyx2eK0F1oC6moUuB6GhhfV0niJ1tIEr6XBTmkTNwig6cr5qEG40Mgde47
 XNT1aFdWKY/trCkP3akKqpMaXyp2u98XVTLx4ArIVHGcMgdkBw+eDQZ1Q/Z4uQQzqp
 +7FG/Nv6/ZvcHPUBCDC/Nr/2tjHko9oavqijUCPLLSL470V6u24WCH/hRUMxdxwmKe
 KI1F32q1HvaZA==
Received: from pastel (unknown [157.52.14.222])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 21A3112020D;
 Tue, 18 Feb 2020 08:33:49 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwvwo8kggvu.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <87imknqogu.fsf@HIDDEN>
 <jwvzhdy5vdx.fsf-monnier+emacs@HIDDEN>
 <87lfpi548j.fsf@HIDDEN> <87a75wek14.fsf@HIDDEN>
 <87sgjj7njt.fsf@HIDDEN> <87o8twep2f.fsf@HIDDEN>
Date: Tue, 18 Feb 2020 08:33:48 -0500
In-Reply-To: <87o8twep2f.fsf@HIDDEN> (Juri Linkov's message of "Tue, 
 18 Feb 2020 02:06:48 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.009 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> (defun conf-mode ()
>   ...
>   ;; `conf-mode' plays two roles: it's the parent of several sub-modes
>   ;; but it's also the function that chooses between those submodes.
>   ;; To tell the difference between those two cases where the function
>   ;; might be called, we check `delay-mode-hooks'.
>   ;; (adopted from tex-mode.el)
>   (if (not delay-mode-hooks)
>       ;; try to guess sub-mode of conf-mode based on buffer content

The Right Thing=E2=84=A2 to do is of course to split `conf-mode` into two
functions, one for the generic entry point and the other for the shared
parent mode.

How easy/realistic this is, I don't know.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 18 Feb 2020 00:15:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 17 19:15:13 2020
Received: from localhost ([127.0.0.1]:39383 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j3qXh-0000rm-7Y
	for submit <at> debbugs.gnu.org; Mon, 17 Feb 2020 19:15:13 -0500
Received: from aye.elm.relay.mailchannels.net ([23.83.212.6]:59050)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1j3qXf-0000rc-2l
 for 39190 <at> debbugs.gnu.org; Mon, 17 Feb 2020 19:15:12 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 9E3F4502768;
 Tue, 18 Feb 2020 00:15:09 +0000 (UTC)
Received: from pdx1-sub0-mail-a38.g.dreamhost.com
 (100-96-215-16.trex.outbound.svc.cluster.local [100.96.215.16])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 239A3501CA1;
 Tue, 18 Feb 2020 00:15:09 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a38.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); Tue, 18 Feb 2020 00:15:09 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Madly-Madly: 5d3b3af3508a6a91_1581984909464_2333617828
X-MC-Loop-Signature: 1581984909464:3569247042
X-MC-Ingress-Time: 1581984909463
Received: from pdx1-sub0-mail-a38.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a38.g.dreamhost.com (Postfix) with ESMTP id DB3BEB27A0;
 Mon, 17 Feb 2020 16:15:03 -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=jqub7Im429NW7TDB7EKiyk1t8G0=; b=
 C8SO5Op7SghZBCVJKO07TWgU8mdmEs2y3NhF3dMGMb5lo7BUYPuYc2FrhUzneFOe
 BXFi1JAaWHt0hvKDFPfvSkyo1Nf/AlrA3j2B8iOD3C/ryhk+OF1LCqy14jBR3kk3
 6A0cAQ8s035rhm8pqtFpqUT15Rqa/os42bewl+Ao/gw=
Received: from localhost.linkov.net (m91-129-103-27.cust.tele2.ee
 [91.129.103.27])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a38.g.dreamhost.com (Postfix) with ESMTPSA id A346CB2700;
 Mon, 17 Feb 2020 16:15:00 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a38
From: Juri Linkov <juri@HIDDEN>
To: Felician Nemeth <felician.nemeth@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <87imknqogu.fsf@HIDDEN>
 <jwvzhdy5vdx.fsf-monnier+emacs@HIDDEN>
 <87lfpi548j.fsf@HIDDEN> <87a75wek14.fsf@HIDDEN>
 <87sgjj7njt.fsf@HIDDEN>
Date: Tue, 18 Feb 2020 02:06:48 +0200
In-Reply-To: <87sgjj7njt.fsf@HIDDEN> (Felician Nemeth's message of
 "Sun, 09 Feb 2020 17:06:30 +0100")
Message-ID: <87o8twep2f.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrjeejgddulecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffufhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdefrddvjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehlohgtrghlhhhoshhtrdhlihhnkhhovhdrnhgvthdpihhnvghtpeeluddruddvledruddtfedrvdejpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepfhgvlhhitghirghnrdhnvghmvghthhesghhmrghilhdrtghomh
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>>> delay-mode-hooks was intended as the safest workaround to install in emacs-27.
>>
>> delay-mode-hooks is now in emacs-27.
>
> This makes the original problem disappear.  Thank you.

Unfortunately, this change broke diff-syntax font-lock of conf-space-mode -
font-lock from files in conf-space-mode is not displayed in diffs anymore.

First, these steps show how it used to work when set-auto-mode was called
from diff-syntax-fontify-props without wrapping in delay-mode-hooks macro:

- diff-syntax-fontify-props calls set-auto-mode
- in auto-mode-alist a file extension is associated with conf-mode-maybe
- conf-mode-maybe calls conf-mode
- conf-mode checks for the variable 'delay-mode-hooks':
- initially delay-mode-hooks is nil, so call conf-space-mode
- conf-space-mode calls its parent mode conf-mode again
- when conf-mode is called again, its delay-mode-hooks is t
  and it sets its mode variables.

Now the failure caused by wrapping (delay-mode-hooks (set-auto-mode))
in diff-syntax-fontify-props is because on the first call of conf-mode,
the variable 'delay-mode-hooks' is already t, not nil as it was before
the change.

All this due to such trick used in conf-mode with these comments:

(defun conf-mode ()
  ...
  ;; `conf-mode' plays two roles: it's the parent of several sub-modes
  ;; but it's also the function that chooses between those submodes.
  ;; To tell the difference between those two cases where the function
  ;; might be called, we check `delay-mode-hooks'.
  ;; (adopted from tex-mode.el)
  (if (not delay-mode-hooks)
      ;; try to guess sub-mode of conf-mode based on buffer content

So it detects the situation when define-derived-mode runs the parent
with delay-mode-hooks.

I have no idea what to do in this case.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 9 Feb 2020 16:06:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 09 11:06:41 2020
Received: from localhost ([127.0.0.1]:53114 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1j0p6X-0006f0-IU
	for submit <at> debbugs.gnu.org; Sun, 09 Feb 2020 11:06:41 -0500
Received: from mail-wm1-f43.google.com ([209.85.128.43]:35464)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felician.nemeth@HIDDEN>) id 1j0p6V-0006ek-FY
 for 39190 <at> debbugs.gnu.org; Sun, 09 Feb 2020 11:06:40 -0500
Received: by mail-wm1-f43.google.com with SMTP id b17so7846289wmb.0
 for <39190 <at> debbugs.gnu.org>; Sun, 09 Feb 2020 08:06:39 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:face:mime-version;
 bh=NzNpL/Xg99M18onAJ89cHWHuDcxP1My7YVM9kGkEusA=;
 b=VMQ8TrMJWg4LL3IxyOuQBWa8ScSigH3mS4bxnhtiIkVsHgNDPaWyLLqBB5GDoUlkV4
 LxmV6K7pQy30kv3VEThmHRE7//A37ASQM7j1ovjK3mDPLijNJx6H7wCMWTKNxGtIRDki
 B5j17Y5IQoOe4fh9pOPBPD/gyjbuQNzMChODhw7ue0OkiO2t90ma17s7ddmU/CMBSqkH
 bXD/iLYX2Zgg71P5RCOfNvFLQo3//49U81m3HERbQv38MlCslwbsiE/TNnQZtxu2svDu
 2Lnl91z1uV/1EaWqRGBOQm21t24OUQtiywDsnE/qV4YHoFq3DLyfrhSVsBrJhgAQ7MSW
 fIFQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:face:mime-version;
 bh=NzNpL/Xg99M18onAJ89cHWHuDcxP1My7YVM9kGkEusA=;
 b=Gk2fbKEo9NhLgMVBkwj/9xN8A0hFGiGmIR07sVXsVbMWgyPtIWsI3LiukVfyot1Mro
 NbzepIVIyruXvLojAs/HqDqqakuYovQkKs7fJ85CE603JXmd+J8gNN1L1dYa+89/GmKL
 T7goTmR8Q7W7um4ruLsA1zTtfeOaaOSy67QV4cGY27fjVIfvsZcaMZzt17f4Z5t6CR+9
 U31+Pr1zO54QuK6LwEJ/wIRUvrY9jOxJ4YLKLu583kQXjTsZ9kFGz7mD0CwXGVO6DiRs
 1bq1kWMFz91SYuKpmyYN88+4pFrZswjeTw8s4UMzuIvtNvVJb+j7QpL4w4glouCdJjAt
 Er1A==
X-Gm-Message-State: APjAAAViyUHyqKj6bi+Aq+oqRHwak2UGsrQ7tBkYq5+1oTX2M9hZQcWl
 /Wbuq8jYLeTg/hshWHiVR9qsGSPU
X-Google-Smtp-Source: APXvYqwQ4nWqOOnwk49niMrX8vnNj6w90Laq8IV2rTlzhSj41PnSjgydmY6leFDmZ7r2yLnoxYOUQw==
X-Received: by 2002:a1c:9c87:: with SMTP id f129mr10647604wme.26.1581264393439; 
 Sun, 09 Feb 2020 08:06:33 -0800 (PST)
Received: from betli.gmail.com (catv-178-48-82-41.catv.broadband.hu.
 [178.48.82.41])
 by smtp.gmail.com with ESMTPSA id g21sm11386690wmh.17.2020.02.09.08.06.31
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 09 Feb 2020 08:06:32 -0800 (PST)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#39190: 28.0.50;
 two buffers with same buffer-file-name (diff-syntax-fontify-props)
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <87imknqogu.fsf@HIDDEN>
 <jwvzhdy5vdx.fsf-monnier+emacs@HIDDEN>
 <87lfpi548j.fsf@HIDDEN> <87a75wek14.fsf@HIDDEN>
Date: Sun, 09 Feb 2020 17:06:30 +0100
In-Reply-To: <87a75wek14.fsf@HIDDEN> (Juri Linkov's message of "Thu, 
 06 Feb 2020 00:39:19 +0200")
Message-ID: <87sgjj7njt.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEUMBwgHAgMFAAGPjY7/
 //80MDHq6eqJt3pKAAABr0lEQVQ4jX2UzZKDIAzHqR177q7TPbtx2HMr6guQcrbY9txZ0fd/hA0f
 onXazcEJ/CD8E4Js8/HS9mwjXtqeMRxHXJkakTEm4b4GPVQW8PU8ov4fQCqeThlF60MBWdo1IXzd
 2nEEZE7CEAZLwI0N/gJAhTj7ESQAX4gPgO8lyI+cvgViSVPlNomAj2M9gW40eg7VWY3cATjUcyiO
 Z+i03cFruGLYoUR7VyU3HihdmCEVhoDN65FXkpbSxkomOzsTQN/gySaodGb9Gdi1oSRXP46gdBWh
 LcUKJNdeGCWac74GKakmne0aHCFvyqJPYLsCFAVlhRTvGdzMdLHqtgRyUulyXIAH7CYQ3AB0Nody
 JQhAkq/qtOnbjhxdzYDkXPxlH5y4WdUAeUcX1NVJ6GR7UQEYPGWoAnA36OQNn5lRRp38vHTAp9Br
 LoTmvlPPDoRCKzpjG1SXT89AaT5l456BamJuMcs+NIOMzJ/s5dI6yUVcrARlruwOebfdv6gunTn4
 ww3+QjGBEn5suVyLHoSGvAqREuDLN+iqZ+VcFg+HBbsJUU9+FZthbez9T+bdb+kPv2Ls6ct3hTkA
 AAAASUVORK5CYII=
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> delay-mode-hooks was intended as the safest workaround to install in emacs-27.
>
> delay-mode-hooks is now in emacs-27.

This makes the original problem disappear.  Thank you.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 5 Feb 2020 22:41:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Feb 05 17:41:14 2020
Received: from localhost ([127.0.0.1]:46924 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1izTM9-000256-Po
	for submit <at> debbugs.gnu.org; Wed, 05 Feb 2020 17:41:13 -0500
Received: from dog.birch.relay.mailchannels.net ([23.83.209.48]:57781)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1izTM8-00024y-Cy
 for 39190 <at> debbugs.gnu.org; Wed, 05 Feb 2020 17:41:12 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
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)
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@HIDDEN
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@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Macabre-Tart: 76fdee9e501fc663_1580942470992_3398944339
X-MC-Loop-Signature: 1580942470992:1567279887
X-MC-Ingress-Time: 1580942470991
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=
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@HIDDEN)
 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
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <87imknqogu.fsf@HIDDEN>
 <jwvzhdy5vdx.fsf-monnier+emacs@HIDDEN>
 <87lfpi548j.fsf@HIDDEN>
Date: Thu, 06 Feb 2020 00:39:19 +0200
In-Reply-To: <87lfpi548j.fsf@HIDDEN> (Juri Linkov's message of "Wed, 
 05 Feb 2020 01:20:44 +0200")
Message-ID: <87a75wek14.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrhedvgddtudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> 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.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 4 Feb 2020 23:29:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 04 18:29:41 2020
Received: from localhost ([127.0.0.1]:44927 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iz7dV-0007M9-4J
	for submit <at> debbugs.gnu.org; Tue, 04 Feb 2020 18:29:41 -0500
Received: from butterfly.birch.relay.mailchannels.net ([23.83.209.27]:4332)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1iz7dS-0007Lx-GS
 for 39190 <at> debbugs.gnu.org; Tue, 04 Feb 2020 18:29:39 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 339C0501360;
 Tue,  4 Feb 2020 23:29:37 +0000 (UTC)
Received: from pdx1-sub0-mail-a54.g.dreamhost.com
 (100-96-217-4.trex.outbound.svc.cluster.local [100.96.217.4])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id BABD850149D;
 Tue,  4 Feb 2020 23:29:36 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a54.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); Tue, 04 Feb 2020 23:29:37 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Ski-Rock: 278860c5411643e4_1580858976994_1242607141
X-MC-Loop-Signature: 1580858976994:688000382
X-MC-Ingress-Time: 1580858976994
Received: from pdx1-sub0-mail-a54.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a54.g.dreamhost.com (Postfix) with ESMTP id A0D407F400;
 Tue,  4 Feb 2020 15:29:32 -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=mwydk3N8+zHeWHWC+KA+kNWSFsw=; b=
 DqhgQSgoLym38ZQ5ksdB2aUJ6gw4XXrVLwmXWbyOr17q1nw4wCK6YgqAamiQfTh0
 7dDURwhciULzZDxQEcZ9IQyRSaBV+LC292Skx19c55d1flvxkDYnvouiQ2FHENTr
 SqSI70QHm7bIWdTLjg966YnHKBO/o2CLWE0feEVOBIo=
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@HIDDEN)
 by pdx1-sub0-mail-a54.g.dreamhost.com (Postfix) with ESMTPSA id 444927F0A0;
 Tue,  4 Feb 2020 15:29:29 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a54
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <87imknqogu.fsf@HIDDEN>
 <jwvzhdy5vdx.fsf-monnier+emacs@HIDDEN>
Date: Wed, 05 Feb 2020 01:20:44 +0200
In-Reply-To: <jwvzhdy5vdx.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Tue, 04 Feb 2020 08:36:15 -0500")
Message-ID: <87lfpi548j.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrhedtgdduudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> vc-find-revision-no-save should not use delay-mode-hooks when called as
>> a command.
>
> 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.

Using alternatives of buffer-file-name are not straightforward
and need more testing in emacs-28.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 4 Feb 2020 13:36:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 04 08:36:26 2020
Received: from localhost ([127.0.0.1]:42819 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iyyNO-0007er-A4
	for submit <at> debbugs.gnu.org; Tue, 04 Feb 2020 08:36:26 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:48590)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1iyyNM-0007ed-M2
 for 39190 <at> debbugs.gnu.org; Tue, 04 Feb 2020 08:36:25 -0500
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id A178280D74;
 Tue,  4 Feb 2020 08:36:18 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id EBFB580B94;
 Tue,  4 Feb 2020 08:36:16 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1580823376;
 bh=0Bu0jFCa3/qJJS4B8w9D5f+7LSs9Y7qvj/KK2wQqNSA=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=Ya5pU1kydIS7ci10ZVFyroOCaSV3am/gAIgSXO9kyU9WjFDLjcaSDBjT0hd7etPwa
 kK8mdgZuKPT2yue3E3t9+svMGOQYBcP1yocB3rIsp1+br6HdNcpeC/kVeypGqGNBsM
 p9IJFhVzsQ9ZKxoqCIDL3Y0FM+Gn65ON+FZejiF1MQCXny5os/7MuXyiLQrpdf9juO
 gReCmm8TzqWniahgMOUAlNcHHFVaIgM7pOoy3INDCXS1226BkX66fh4C4+7CG7r05v
 bxTfOFDTMCJ/sZr6v9b3yaNtnr2pyIcK/3QuESwsUhGx3lssQmh8SioNGqYBwExQrR
 XXyMkoKsCMKIQ==
Received: from pastel (unknown [216.154.34.88])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 8CE2A1202C2;
 Tue,  4 Feb 2020 08:36:16 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwvzhdy5vdx.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <87imknqogu.fsf@HIDDEN>
Date: Tue, 04 Feb 2020 08:36:15 -0500
In-Reply-To: <87imknqogu.fsf@HIDDEN> (Juri Linkov's message of "Tue, 
 04 Feb 2020 00:45:53 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.051 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> vc-find-revision-no-save should not use delay-mode-hooks when called as
> a command.

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.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 4 Feb 2020 13:08:37 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Feb 04 08:08:37 2020
Received: from localhost ([127.0.0.1]:42786 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iyxwT-0006wD-5p
	for submit <at> debbugs.gnu.org; Tue, 04 Feb 2020 08:08:37 -0500
Received: from mail-lf1-f48.google.com ([209.85.167.48]:37147)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1iyxwR-0006vz-Bq
 for 39190 <at> debbugs.gnu.org; Tue, 04 Feb 2020 08:08:36 -0500
Received: by mail-lf1-f48.google.com with SMTP id b15so12153627lfc.4
 for <39190 <at> debbugs.gnu.org>; Tue, 04 Feb 2020 05:08:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=xmbQzlP4rzZadarJCpp1FDLi1nbDKonyQ36Nkdn0qU0=;
 b=lnanX4X3cCuOv1X0BWKgpt8+gToRtOy76yx1BCGnKm23diRg8OmQJoRImTYZcd0okT
 EjSrP52tOCauGKV3FAz8Tm1oHztO8p+qFMxTVBYXrAEygbimCsK/5+WmjZOwDMrU0aKw
 PYs2T2sRDahijD5PtkAjP0/QEGnPvgt5/gfDBUE3Ugfh6jwax2YsQl5lIcW9/FugZ2Wb
 YZ6Uu7MKZjgTBbivQ0ORo34q6rs3hHracnclPRutqSxHjYEZ3/eoLDXDaUU/t8u+YgvT
 XTvC3xjhGPbFaEyYAXjSrHP9oDqUNRvbVYQwykgz4bdW3/kHGp0WTZRNOQB+UejU3oWH
 We6Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=xmbQzlP4rzZadarJCpp1FDLi1nbDKonyQ36Nkdn0qU0=;
 b=r+rVpkEy6eW9nOUwO2fBeZ3vQ0t2DEj4bjOdkF7rJlR8DKeF7Yx8xOFeT7I8QM2htw
 FRnKVoFA46W3bO4xuRwDjApv9civwEgyQJTXlx/gTKyCaj0HgUERwOoXbtL4w9LGDejk
 qkgc8B7MuvzzxMeXLy1jSKCSzZ9sGDpL0Aaeu4uESgRUkEWUY0B8+9sTfJFFX9/pLlBY
 JKviBoMisK6qIkav6B4OJPu13d7e5+FS8Jhva2jHC0r92FsFom0KsRyS9MKFXFbGHC/g
 9+1v8oeE5P6TFdlDmUIMJoxJ33mLi4Lk0zqUTBFPu0w/dGSmrLXcDcAU+hQQwbg6cSvf
 Us0A==
X-Gm-Message-State: APjAAAXBwObSQoLvCsbMqhJm8x96dBiwlHWpj+OSvVaTAT8FRKHx3JSe
 h908BthuSBciFkbBbyJXI3Y=
X-Google-Smtp-Source: APXvYqxqOQm6YsGz8rWYyBK8M+Jl6WqLQgBKPVHZ+1pxotcinyj7r4d+JIvdsBwcMdcoofRYAkUyoA==
X-Received: by 2002:ac2:592e:: with SMTP id v14mr14838467lfi.73.1580821709332; 
 Tue, 04 Feb 2020 05:08:29 -0800 (PST)
Received: from [192.168.1.142] ([178.252.127.239])
 by smtp.googlemail.com with ESMTPSA id i4sm11581959ljg.102.2020.02.04.05.08.28
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 04 Feb 2020 05:08:28 -0800 (PST)
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
To: Juri Linkov <juri@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN>
 <8736c921s6.fsf@HIDDEN> <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <jwvftft85i6.fsf-monnier+emacs@HIDDEN> <87v9ooeev8.fsf@HIDDEN>
 <82cec8a7-7e17-607e-e93e-c848c8b6a56b@HIDDEN>
 <87sgjrqois.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <b0d80a4a-0733-4397-3df4-3b4a90c3dccc@HIDDEN>
Date: Tue, 4 Feb 2020 16:08:27 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.9.0
MIME-Version: 1.0
In-Reply-To: <87sgjrqois.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  On 04.02.2020 1:44, Juri Linkov wrote: > I hoped that maybe
 this was solved somehow already. > But if there is no problem in using xref
 with Eglot, > then let's leave it unchanged. There is a related bug report.
 As long as we support syntax-propertize-via-font-lock, let's not change it
 (unless some related bug reports come). 
 Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level
 mail domains are different
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (raaahh[at]gmail.com)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.167.48 listed in list.dnswl.org]
 1.5 RCVD_IN_SORBS_WEB      RBL: SORBS: sender is an abusable web server
 [178.252.127.239 listed in dnsbl.sorbs.net]
 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and
 EnvelopeFrom freemail headers are different
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

On 04.02.2020 1:44, Juri Linkov wrote:
> I hoped that maybe this was solved somehow already.
> But if there is no problem in using xref with Eglot,
> then let's leave it unchanged.

There is a related bug report. As long as we support 
syntax-propertize-via-font-lock, let's not change it (unless some 
related bug reports come).

Eglot should have its own xref backend, maybe that's why it doesn't 
trigger it.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 3 Feb 2020 22:52:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 03 17:52:00 2020
Received: from localhost ([127.0.0.1]:42299 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iykZT-0003pZ-QP
	for submit <at> debbugs.gnu.org; Mon, 03 Feb 2020 17:52:00 -0500
Received: from dog.birch.relay.mailchannels.net ([23.83.209.48]:23201)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1iykZR-0003pP-NB
 for 39190 <at> debbugs.gnu.org; Mon, 03 Feb 2020 17:51:58 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 9E3AF40083E;
 Mon,  3 Feb 2020 22:51:56 +0000 (UTC)
Received: from pdx1-sub0-mail-a11.g.dreamhost.com
 (100-96-13-15.trex.outbound.svc.cluster.local [100.96.13.15])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 166874009AB;
 Mon,  3 Feb 2020 22:51:56 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a11.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); Mon, 03 Feb 2020 22:51:56 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Dime-Snatch: 1f424eca4427e38b_1580770316377_3619272983
X-MC-Loop-Signature: 1580770316377:957607064
X-MC-Ingress-Time: 1580770316376
Received: from pdx1-sub0-mail-a11.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a11.g.dreamhost.com (Postfix) with ESMTP id 4204584D4D;
 Mon,  3 Feb 2020 14:51:51 -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=xNeGoP/9fFoSpZphFLVnuPU5et4=; b=
 f+D1Fk/K+32J3PhTq+YCDxM0J0enZTTJeUsr6Sg5gbuFeTzAIXDIEufwg0/Hm1QO
 hy6iyWF0wB46kdxjxTNi3cicdF2U/dEsh3T+xwv5qlY/1bCs5rTQUlVnOs6ItzKr
 GlSAkr4KWxP/zIzS4QKBDwGRy0e04yFWiYDBwLvryYU=
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@HIDDEN)
 by pdx1-sub0-mail-a11.g.dreamhost.com (Postfix) with ESMTPSA id 24EBF84D4B;
 Mon,  3 Feb 2020 14:51:47 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a11
From: Juri Linkov <juri@HIDDEN>
To: Felician Nemeth <felician.nemeth@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
Date: Tue, 04 Feb 2020 00:45:53 +0200
In-Reply-To: <87r1zd8gvx.fsf@HIDDEN> (Felician Nemeth's message of
 "Sun, 02 Feb 2020 10:42:26 +0100")
Message-ID: <87imknqogu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrgeekgddtvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehfvghlihgtihgrnhdrnhgvmhgvthhhsehgmhgrihhlrdgtohhm
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> Maybe I wasn't clear enough.  I got no errors, but flymake incorrectly
> fontified the buffer.  Anyway, I tried to look into why this happened
> even after applying your patch and it turned out that
> vc-find-revision-no-save also calls set-auto-mode.  So, I don't know if
> the following patch is correct, but together with your patch it does
> solve the original issue.
>
> diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
> index f64b6c0631..c50ba132e7 100644
> --- a/lisp/vc/vc.el
> +++ b/lisp/vc/vc.el
> @@ -2098,7 +2098,7 @@ vc-find-revision-no-save
>                      ;; For non-interactive, skip any questions
>                      (let ((enable-local-variables :safe) ;; to find `mode:'
>                            (buffer-file-name file))
> -                      (ignore-errors (set-auto-mode)))
> +                      (ignore-errors (delay-mode-hooks (set-auto-mode))))
>                    (normal-mode))
>  	        (set-buffer-modified-p nil)
>                  (setq buffer-read-only t))

vc-find-revision-no-save should not use delay-mode-hooks when called as
a command.  Could you please try again with the following patch:

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 2dbab80208..9cdd732923 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2635,11 +2635,11 @@ diff-syntax-fontify-hunk
                          ;; Don't re-initialize the buffer (which would throw
                          ;; away the previous fontification work).
                          (setq file nil)
-                       (setq buffer (ignore-errors
+                       (setq buffer (ignore-errors (delay-mode-hooks
                                       (vc-find-revision-no-save
                                        file revision
                                        diff-vc-backend
-                                       (get-buffer-create buffer-name)))))
+                                       (get-buffer-create buffer-name))))))
                      (when buffer
                        (with-current-buffer buffer
                          (diff-syntax-fontify-props file text line-nb))))))))
@@ -2719,7 +2719,7 @@ diff-syntax-fontify-props
     (cl-assert (null buffer-file-name))
     (let ((enable-local-variables :safe) ;; to find `mode:'
           (buffer-file-name file))
-      (set-auto-mode)
+      (delay-mode-hooks (set-auto-mode))
       ;; FIXME: Is this really worth the trouble?
       (when (and (fboundp 'generic-mode-find-file-hook)
                  (memq #'generic-mode-find-file-hook




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 3 Feb 2020 22:51:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 03 17:51:51 2020
Received: from localhost ([127.0.0.1]:42296 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iykZK-0003pB-O3
	for submit <at> debbugs.gnu.org; Mon, 03 Feb 2020 17:51:51 -0500
Received: from bumble.birch.relay.mailchannels.net ([23.83.209.25]:64954)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1iykZH-0003oz-NT
 for 39190 <at> debbugs.gnu.org; Mon, 03 Feb 2020 17:51:49 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 41274540BBB;
 Mon,  3 Feb 2020 22:51:46 +0000 (UTC)
Received: from pdx1-sub0-mail-a11.g.dreamhost.com
 (100-96-18-5.trex.outbound.svc.cluster.local [100.96.18.5])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 69E95540256;
 Mon,  3 Feb 2020 22:51:45 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a11.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); Mon, 03 Feb 2020 22:51:45 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Shelf-Slimy: 082d875e422ff26f_1580770305676_2316425444
X-MC-Loop-Signature: 1580770305676:3199971174
X-MC-Ingress-Time: 1580770305676
Received: from pdx1-sub0-mail-a11.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a11.g.dreamhost.com (Postfix) with ESMTP id 1113F84D4A;
 Mon,  3 Feb 2020 14:51:42 -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=Xz8UlenF5dT6SlslNswJjp34Gas=; b=
 HctAmKd3DlPMhZOPtcVuX5I5NHhGy7ue716ht+Yp5E/p+2wMke88+zev1106M3aB
 J+M/Dy/sJGoWvjKPGNhLJQ50LsFb4BeJGgI/0DKL3a6qr56Y0SSTumX0NodIQA1i
 ebH/11yUKj08N2f+e1/b7xGr2xOc0qtSSqq/2dqCf/M=
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@HIDDEN)
 by pdx1-sub0-mail-a11.g.dreamhost.com (Postfix) with ESMTPSA id F296184D4B;
 Mon,  3 Feb 2020 14:51:35 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a11
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <jwvftft85i6.fsf-monnier+emacs@HIDDEN>
 <87v9ooeev8.fsf@HIDDEN>
 <82cec8a7-7e17-607e-e93e-c848c8b6a56b@HIDDEN>
Date: Tue, 04 Feb 2020 00:44:43 +0200
In-Reply-To: <82cec8a7-7e17-607e-e93e-c848c8b6a56b@HIDDEN> (Dmitry Gutov's
 message of "Mon, 3 Feb 2020 16:14:02 +0300")
Message-ID: <87sgjrqois.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrgeekgddtvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopegughhuthhovheshigrnhguvgigrdhruh
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> @@ -1395,7 +1395,7 @@ xref--collect-matches
>>                   (inhibit-message t)
>>                   message-log-max)
>>               (ignore-errors
>> -              (set-auto-mode t)))
>> +              (delay-mode-hooks (set-auto-mode t))))
>
> Nope.
>
> There's even a comment above these lines explaining why I didn't use
> delay-mode-hooks there.
>
> I've even mentioned it in this thread already.

I hoped that maybe this was solved somehow already.
But if there is no problem in using xref with Eglot,
then let's leave it unchanged.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 3 Feb 2020 13:14:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Feb 03 08:14:11 2020
Received: from localhost ([127.0.0.1]:40981 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iybYJ-0004mz-O2
	for submit <at> debbugs.gnu.org; Mon, 03 Feb 2020 08:14:11 -0500
Received: from mail-lj1-f171.google.com ([209.85.208.171]:41550)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1iybYI-0004ml-JB
 for 39190 <at> debbugs.gnu.org; Mon, 03 Feb 2020 08:14:10 -0500
Received: by mail-lj1-f171.google.com with SMTP id h23so14571631ljc.8
 for <39190 <at> debbugs.gnu.org>; Mon, 03 Feb 2020 05:14:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=2BesVw/cuQsP4RjW4/oFI4P367O6UeGulbuH2jdcvkk=;
 b=O99RjpnZoL7Zwh0xjQja7GYGefB4TGSPhAJuoGugqp+gVTt2aWyUglXhTx+qCztCfk
 dcWw3wMYVpOQS8L+xHxzJXxEtA5Jw/biy7Qk74fwSipSZ+AZdPQg4gEjS9lBccey9AHn
 KqYukSnYwd8Mo6M+AOJ28RyLDTddIT0Om6KXEoOcjxscv3BOJSP13XXYuDklcPG8Yx59
 Y6EJDT4OagY71MQF6O3cz8nJtwKjC4+Dk6wEIAI84w6lvx1u1l74MK1k03pxCtzlvIrR
 DNSEO+KRcNaT4W4+STLP8xuUmvjm7appI8EMgrm7agPRWpwbaIZ6TdxxTXw6KHdkb+U+
 303Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=2BesVw/cuQsP4RjW4/oFI4P367O6UeGulbuH2jdcvkk=;
 b=VObYiLleEANmE3tENTzXEK98jGbtlqc4fLoQbnkJMsi1/Ul/q6XX8JYORht2wizvgZ
 5UBoRi4f7marwO6GEeyuw9YxQTDsMCh+XesgGor7OaeBZt8d1LZm1kUt6g+xFFmlr9xt
 I/+s/GjqQUPUVbR5XFNzHZyIxzuKEnsQh8Y+UzONYZfbItDVfZ9F8OydIotJcbK7mryZ
 EdguXdVNH+jsXVkf9fDvyaQuvauaQgtTod4QMO+ApLI3wQ4oE+q1AegmZkyfminQKNpt
 zLP+CJKGRAzu1+rmZULmI7CUxMhVDFbVzB1Ol4WWfRBtSM/ZTraXYrVSQPlBnMWWHAHg
 Rj0w==
X-Gm-Message-State: APjAAAVgnwfes9oe4fKHlM0urfEe3zc8p1ucuyrnsnYYYndpk+IPj+3U
 NQCWgFXtg1rqkjrpdPCo+prykrA6w9U=
X-Google-Smtp-Source: APXvYqzbC//B69y1IpuVgrgfNU2h5K6jGKGmkJxH2uCqRdP2hyXPexYThsZxa6tTf5IPzTEeABMFFQ==
X-Received: by 2002:a2e:b530:: with SMTP id z16mr13325631ljm.216.1580735643720; 
 Mon, 03 Feb 2020 05:14:03 -0800 (PST)
Received: from [192.168.1.142] ([178.252.127.239])
 by smtp.googlemail.com with ESMTPSA id a10sm8946461lfr.94.2020.02.03.05.14.02
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 03 Feb 2020 05:14:03 -0800 (PST)
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
To: Juri Linkov <juri@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN>
 <8736c921s6.fsf@HIDDEN> <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <jwvftft85i6.fsf-monnier+emacs@HIDDEN> <87v9ooeev8.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <82cec8a7-7e17-607e-e93e-c848c8b6a56b@HIDDEN>
Date: Mon, 3 Feb 2020 16:14:02 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.9.0
MIME-Version: 1.0
In-Reply-To: <87v9ooeev8.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  On 03.02.2020 2:41,
 Juri Linkov wrote: > --- a/lisp/progmodes/xref.el
 > +++ b/lisp/progmodes/xref.el > @@ -1395,7 +1395,7 @@ xref--collect-matches
 > (inhibit-message t) > message-log-max) > (ignore-er [...] 
 Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 1.5 RCVD_IN_SORBS_WEB      RBL: SORBS: sender is an abusable web server
 [178.252.127.239 listed in dnsbl.sorbs.net]
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level
 mail domains are different
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (raaahh[at]gmail.com)
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.208.171 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.85.208.171 listed in wl.mailspike.net]
 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and
 EnvelopeFrom freemail headers are different
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

On 03.02.2020 2:41, Juri Linkov wrote:
> --- a/lisp/progmodes/xref.el
> +++ b/lisp/progmodes/xref.el
> @@ -1395,7 +1395,7 @@ xref--collect-matches
>                   (inhibit-message t)
>                   message-log-max)
>               (ignore-errors
> -              (set-auto-mode t)))
> +              (delay-mode-hooks (set-auto-mode t))))

Nope.

There's even a comment above these lines explaining why I didn't use 
delay-mode-hooks there.

I've even mentioned it in this thread already.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 2 Feb 2020 23:44:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 02 18:44:50 2020
Received: from localhost ([127.0.0.1]:40741 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iyOv4-0008Tz-7N
	for submit <at> debbugs.gnu.org; Sun, 02 Feb 2020 18:44:50 -0500
Received: from caracal.birch.relay.mailchannels.net ([23.83.209.30]:34491)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1iyOv1-0008Tq-Ra
 for 39190 <at> debbugs.gnu.org; Sun, 02 Feb 2020 18:44:49 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 5BF2C600912;
 Sun,  2 Feb 2020 23:44:46 +0000 (UTC)
Received: from pdx1-sub0-mail-a46.g.dreamhost.com
 (100-96-217-4.trex.outbound.svc.cluster.local [100.96.217.4])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id DC85A600840;
 Sun,  2 Feb 2020 23:44:45 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a46.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); Sun, 02 Feb 2020 23:44:46 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Exultant-Irritate: 2e3ec9f63a86942c_1580687086146_1927022480
X-MC-Loop-Signature: 1580687086146:2162772103
X-MC-Ingress-Time: 1580687086146
Received: from pdx1-sub0-mail-a46.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a46.g.dreamhost.com (Postfix) with ESMTP id 98AC780004;
 Sun,  2 Feb 2020 15:44:40 -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=ag0qfTPl7YbhBeC9Du/NjiF5Ve0=; b=
 Z2Gvdpk+xwGOuqjg2dzdbLSXw4RV6c16mGe5WkDQUiCVbaETfG6E62aKkCmkhKIg
 yalam+92CJvOz96I1yITYA7aknCHT8s6mX6njU5ME40PwiYJCMPF2hQhemA0KbIY
 b8xYEiru6JL75EBGKfjd/dClgWWGwshOdrXSjLhr88M=
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@HIDDEN)
 by pdx1-sub0-mail-a46.g.dreamhost.com (Postfix) with ESMTPSA id 117E380024;
 Sun,  2 Feb 2020 15:44:37 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a46
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
 <jwvftft85i6.fsf-monnier+emacs@HIDDEN>
Date: Mon, 03 Feb 2020 01:41:47 +0200
In-Reply-To: <jwvftft85i6.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Sun, 02 Feb 2020 08:50:07 -0500")
Message-ID: <87v9ooeev8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrgeeigdduvdcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehmtderredtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

>> vc-find-revision-no-save also calls set-auto-mode.  So, I don't know if
>> the following patch is correct, but together with your patch it does
>> solve the original issue.
>>
>> diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
>> index f64b6c0631..c50ba132e7 100644
>> --- a/lisp/vc/vc.el
>> +++ b/lisp/vc/vc.el
>> @@ -2098,7 +2098,7 @@ vc-find-revision-no-save
>>                      ;; For non-interactive, skip any questions
>>                      (let ((enable-local-variables :safe) ;; to find `mode:'
>>                            (buffer-file-name file))
>> -                      (ignore-errors (set-auto-mode)))
>> +                      (ignore-errors (delay-mode-hooks (set-auto-mode))))
>>                    (normal-mode))
>>  	        (set-buffer-modified-p nil)
>>                  (setq buffer-read-only t))
>
> How 'bout we first consolidate the two cases into one by introducing
> a new function `set-auto-mode-for-filename` that both
> vc-find-revision-no-save and diff-mode can use?

Actually vc-find-revision-no-save when called as a command (e.g. by the
key 'f' from log-view) still should run hooks because the buffer it creates
is not internal.

Only its call from diff-syntax-fontify-hunk should not run hooks:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=delay-mode-hooks.patch

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 2dbab80208..9cdd732923 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2635,11 +2635,11 @@ diff-syntax-fontify-hunk
                          ;; Don't re-initialize the buffer (which would throw
                          ;; away the previous fontification work).
                          (setq file nil)
-                       (setq buffer (ignore-errors
+                       (setq buffer (ignore-errors (delay-mode-hooks
                                       (vc-find-revision-no-save
                                        file revision
                                        diff-vc-backend
-                                       (get-buffer-create buffer-name)))))
+                                       (get-buffer-create buffer-name))))))
                      (when buffer
                        (with-current-buffer buffer
                          (diff-syntax-fontify-props file text line-nb))))))))
@@ -2719,7 +2719,7 @@ diff-syntax-fontify-props
     (cl-assert (null buffer-file-name))
     (let ((enable-local-variables :safe) ;; to find `mode:'
           (buffer-file-name file))
-      (set-auto-mode)
+      (delay-mode-hooks (set-auto-mode))
       ;; FIXME: Is this really worth the trouble?
       (when (and (fboundp 'generic-mode-find-file-hook)
                  (memq #'generic-mode-find-file-hook
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index a6be04e313..e629674ea6 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -497,7 +497,7 @@ mm-display-inline-fontify
 	    (let ((auto-mode-alist
 		   (delq (rassq 'doc-view-mode-maybe auto-mode-alist)
 			 (copy-sequence auto-mode-alist))))
-	      (set-auto-mode)
+	      (delay-mode-hooks (set-auto-mode))
 	      (setq mode major-mode)))
 	  ;; Do not fontify if the guess mode is fundamental.
 	  (unless (eq major-mode 'fundamental-mode)
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 1a34456340..741ed73905 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1395,7 +1395,7 @@ xref--collect-matches
                 (inhibit-message t)
                 message-log-max)
             (ignore-errors
-              (set-auto-mode t)))
+              (delay-mode-hooks (set-auto-mode t))))
           (setq-local xref--temp-buffer-file-name file)
           (setq-local inhibit-read-only t)
           (erase-buffer))

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 2 Feb 2020 13:50:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 02 08:50:19 2020
Received: from localhost ([127.0.0.1]:39622 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iyFdj-0001nE-E4
	for submit <at> debbugs.gnu.org; Sun, 02 Feb 2020 08:50:19 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:51871)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1iyFdh-0001n1-DE
 for 39190 <at> debbugs.gnu.org; Sun, 02 Feb 2020 08:50:17 -0500
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 016EB8136F;
 Sun,  2 Feb 2020 08:50:12 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 3AD4980D5A;
 Sun,  2 Feb 2020 08:50:09 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1580651409;
 bh=MRMLtmfKiZmhH39qPrsOaRro59dmQ1FfL6/UYUv2U6U=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=N94fsQO4DHspwlkpksdL+uV62K7XF9i0gDigVpY7Qv0osOW87QZdLWzYJxUANFCh2
 MynWtBCyXnWFDbVTuROSxJIcA7xmgdFgzq1dkoEqMT8gbFFQR9hNmkTge0xFoc6IbW
 t+jrekERTjoQi7GwS0Ez9x1raakQNAtFC5JpcNla3hHXsiz8FwOUFnf09vdicvu2eh
 g1YmsKRKxnzrojtd/r1m95cfsSqb0n107d2AoU2pIJs4lgzRdF9aG3rNVxfbllt9g0
 aRgY20NYMtDRyDOsKCSleykLR9s72czSXwgu8VybQ3MnaXZ+NrV257HOMnVBbnlpA1
 55T2+x+yxNGkw==
Received: from pastel (unknown [216.154.34.88])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C73EF120FEA;
 Sun,  2 Feb 2020 08:50:08 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Felician Nemeth <felician.nemeth@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwvftft85i6.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN> <87r1zd8gvx.fsf@HIDDEN>
Date: Sun, 02 Feb 2020 08:50:07 -0500
In-Reply-To: <87r1zd8gvx.fsf@HIDDEN> (Felician Nemeth's message of
 "Sun, 02 Feb 2020 10:42:26 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.054 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Juri Linkov <juri@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> vc-find-revision-no-save also calls set-auto-mode.  So, I don't know if
> the following patch is correct, but together with your patch it does
> solve the original issue.
>
> diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
> index f64b6c0631..c50ba132e7 100644
> --- a/lisp/vc/vc.el
> +++ b/lisp/vc/vc.el
> @@ -2098,7 +2098,7 @@ vc-find-revision-no-save
>                      ;; For non-interactive, skip any questions
>                      (let ((enable-local-variables :safe) ;; to find `mode:'
>                            (buffer-file-name file))
> -                      (ignore-errors (set-auto-mode)))
> +                      (ignore-errors (delay-mode-hooks (set-auto-mode))))
>                    (normal-mode))
>  	        (set-buffer-modified-p nil)
>                  (setq buffer-read-only t))

How 'bout we first consolidate the two cases into one by introducing
a new function `set-auto-mode-for-filename` that both
vc-find-revision-no-save and diff-mode can use?


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 2 Feb 2020 09:42:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 02 04:42:36 2020
Received: from localhost ([127.0.0.1]:39542 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iyBm0-0001Zh-9i
	for submit <at> debbugs.gnu.org; Sun, 02 Feb 2020 04:42:36 -0500
Received: from mail-wr1-f49.google.com ([209.85.221.49]:40134)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felician.nemeth@HIDDEN>) id 1iyBly-0001ZV-9f
 for 39190 <at> debbugs.gnu.org; Sun, 02 Feb 2020 04:42:34 -0500
Received: by mail-wr1-f49.google.com with SMTP id j104so14073368wrj.7
 for <39190 <at> debbugs.gnu.org>; Sun, 02 Feb 2020 01:42:34 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:face:mime-version;
 bh=eiRQfTph4eLw7PMX0OfB5TZ0c/kU1AaMVP1A/itkESE=;
 b=Bnv3+d69JCfKzD4+3pPX8RCdDvGnpSq9/yW8fX8ysgxwIw9PZ57+FVJlIVJFi2Gqsk
 rQpMpvYJPPWaj3bcZCPlBjBAWVy9kbNeDkctKaaV676EsGZQTSrMsqqaFOTpoYVHvyiC
 SrpvJ3qd0suMWiUAs/Eq3EV/KCnBySylSf3trD+uyd38lRvjyQreAsF+o4FfyLnPoesZ
 4EsnXA2KVHgJX2BqKz9a3FjbTIWt3KDsVBwjjO1+1n9jePYbXTBSY2l4CZpp9GRoUk3E
 kR1PBUeZJnR2zZZUWv8lgVHU6HIapyHar/edVT0REM4MDnNc2YmafAX5uS+iKKq4QMlq
 CNTg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:face:mime-version;
 bh=eiRQfTph4eLw7PMX0OfB5TZ0c/kU1AaMVP1A/itkESE=;
 b=jwv9+UUdj0Fj1L0PFZULfngeFGzCC02uZ0Si8l+rFdWPXRtbOi+7GAvdCnCgAvX3a3
 qHKhd/VtD/RUDVOOPmxbC5dx/AUOZX3KLzulh/4xEtt+TYxGfgUi5E+b49KE4uFZ1j+T
 1t1r5jFnQ7d47muk3fJsXZap9Tcnvn1k2ZpxDf4113OeifE+49ZB7F5tWDw7hZyiuvVb
 XD2WCpY4XEjuczEs3dMCX/yLScQQB6QF/3S0gTE+c5cUnq+FghcLQNw1Lj4nZ7yv5YKq
 RqRu6+nIwbV8wHsFL3quF3edOdSVDhwnTlMep13X6mdprCs54zdaokmukIqzS7KUd3ch
 oQRg==
X-Gm-Message-State: APjAAAVHKrZZ9tVH7ugvr6mBgXys69AzVhEVeiyCeRMX1Mn8fvFw0lSA
 P5G07HeykmNKjJ7irIisKElSvA/u
X-Google-Smtp-Source: APXvYqy5hV0WxsUKH/3E/v4gXu30fPxqHuiFCUDIAQRO/p/b/YGTiOADg+l7yMojrIiqM/Cv6PLU4g==
X-Received: by 2002:adf:93c1:: with SMTP id 59mr9599082wrp.399.1580636547851; 
 Sun, 02 Feb 2020 01:42:27 -0800 (PST)
Received: from betli.gmail.com (catv-178-48-82-41.catv.broadband.hu.
 [178.48.82.41])
 by smtp.gmail.com with ESMTPSA id s22sm18098459wmh.4.2020.02.02.01.42.26
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 02 Feb 2020 01:42:27 -0800 (PST)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#39190: 28.0.50;
 two buffers with same buffer-file-name (diff-syntax-fontify-props)
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
 <87a764y35u.fsf@HIDDEN>
Date: Sun, 02 Feb 2020 10:42:26 +0100
In-Reply-To: <87a764y35u.fsf@HIDDEN> (Juri Linkov's message of "Fri, 
 31 Jan 2020 00:45:17 +0200")
Message-ID: <87r1zd8gvx.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEUMBwgHAgMFAAGPjY7/
 //80MDHq6eqJt3pKAAABr0lEQVQ4jX2UzZKDIAzHqR177q7TPbtx2HMr6guQcrbY9txZ0fd/hA0f
 onXazcEJ/CD8E4Js8/HS9mwjXtqeMRxHXJkakTEm4b4GPVQW8PU8ov4fQCqeThlF60MBWdo1IXzd
 2nEEZE7CEAZLwI0N/gJAhTj7ESQAX4gPgO8lyI+cvgViSVPlNomAj2M9gW40eg7VWY3cATjUcyiO
 Z+i03cFruGLYoUR7VyU3HihdmCEVhoDN65FXkpbSxkomOzsTQN/gySaodGb9Gdi1oSRXP46gdBWh
 LcUKJNdeGCWac74GKakmne0aHCFvyqJPYLsCFAVlhRTvGdzMdLHqtgRyUulyXIAH7CYQ3AB0Nody
 JQhAkq/qtOnbjhxdzYDkXPxlH5y4WdUAeUcX1NVJ6GR7UQEYPGWoAnA36OQNn5lRRp38vHTAp9Br
 LoTmvlPPDoRCKzpjG1SXT89AaT5l456BamJuMcs+NIOMzJ/s5dI6yUVcrARlruwOebfdv6gunTn4
 ww3+QjGBEn5suVyLHoSGvAqREuDLN+iqZ+VcFg+HBbsJUU9+FZthbez9T+bdb+kPv2Ls6ct3hTkA
 AAAASUVORK5CYII=
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Juri Linkov <juri@HIDDEN> writes:

>>> Could you please try to reproduce the issue using Eglot with the
>>> following minimal patch.  If it really fixes the bug then it
>>> should be committed to Emacs 27 immediately, and more changes
>>> could be added later.
>>
>> Unfortunately the minimal patch doesn't fix the issue.
>>
>> Case 1. When Eglot is started manually, then the recipe fails in an
>> after-change-major-mode-hook where the buffer-file-name is non-nil for
>> the temporary diff buffer.
>
> Strange, when I tested the minimal patch, there were no errors anymore.

Maybe I wasn't clear enough.  I got no errors, but flymake incorrectly
fontified the buffer.  Anyway, I tried to look into why this happened
even after applying your patch and it turned out that
vc-find-revision-no-save also calls set-auto-mode.  So, I don't know if
the following patch is correct, but together with your patch it does
solve the original issue.

diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index f64b6c0631..c50ba132e7 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2098,7 +2098,7 @@ vc-find-revision-no-save
                     ;; For non-interactive, skip any questions
                     (let ((enable-local-variables :safe) ;; to find `mode:'
                           (buffer-file-name file))
-                      (ignore-errors (set-auto-mode)))
+                      (ignore-errors (delay-mode-hooks (set-auto-mode))))
                   (normal-mode))
 	        (set-buffer-modified-p nil)
                 (setq buffer-read-only t))





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 30 Jan 2020 23:31:28 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 30 18:31:28 2020
Received: from localhost ([127.0.0.1]:36377 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ixJHU-0003yO-Fe
	for submit <at> debbugs.gnu.org; Thu, 30 Jan 2020 18:31:28 -0500
Received: from mail-lj1-f182.google.com ([209.85.208.182]:32837)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1ixJHS-0003y9-H7
 for 39190 <at> debbugs.gnu.org; Thu, 30 Jan 2020 18:31:27 -0500
Received: by mail-lj1-f182.google.com with SMTP id y6so5269517lji.0
 for <39190 <at> debbugs.gnu.org>; Thu, 30 Jan 2020 15:31:26 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=U71b4PVfINEs1JbuLgUfmGgTrU+8J5vye46XrkJVLY8=;
 b=AEx0bq0dPUxBip5CF9fITVuZzemshCA5rJqXm7aQEhScMi2nTdyUTvrz28PeOtUmvd
 AH73MgxLYfxKBvn9l+rowRX6w5sHudfcEdO3wpjGWq9j0gcgS1FCQdO7QlEFlT/RIrCx
 fC4nEusYodLmvFj6UA7u7AykVni8m5yO9QTADyC3lmVepDg87GxGRy0jsnEiUdnXznqW
 sVlKGNU5F67IxEBZrHobtjFUoSwXYwchK6sMh/ZDEcD1JBrID/aMO5FZy1MdM1ROEsGR
 dZ/5JvTFo5ZEWhQQukVvQ8B4Y5NQFvAN/snG3LHR0KNCXqFgJxz3nZHgHqByeeNdE7Nh
 wm2w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=U71b4PVfINEs1JbuLgUfmGgTrU+8J5vye46XrkJVLY8=;
 b=OfeMNEln5KvlxFh53MxM7xAqneb7CJibzfnuv8tDb+pATqx/e5o5BuSG3vgdK811pg
 iwPA9j4g8MoyVwPhZCPbDhsmRYKJ0WXdmAdWPJ1vdXLypJeBieIn3JyKaCjog54+W/xn
 meI/a0nwPLEGCfwcjCEuGzEHJ1iNod/xteq215LLMU0gGI6XpELKQC64SSwwCP2hQ5vq
 J0Z5TuH1Vxfm5o/e5zVddE0UMhEx8tbfMDQn+ru/bYAcVQS86eX0BUJU9AMHhDjF9NXu
 HS7b/o+HBsXctIYE8HvH7BU+hEcCqbA/jMM/rIoPjd6wL0/u3dA5uCyJ+EoGqKW6EMCJ
 Fq+A==
X-Gm-Message-State: APjAAAUDeVwJ4LgUHRnTG0Snn5uLywIxXeHApGe1pswJmIlYy6NjVcRn
 H85RpwugYN3PvJ+W+WXODPM=
X-Google-Smtp-Source: APXvYqyLPUCIBkC9+yxGy1Olcs5rCWZAbgEV3MaWOMzjG2Bqb1DGVZBiVevkGSjb0hS4TcGizVANxw==
X-Received: by 2002:a2e:96c6:: with SMTP id d6mr4407533ljj.4.1580427080541;
 Thu, 30 Jan 2020 15:31:20 -0800 (PST)
Received: from [192.168.1.142] ([178.252.127.239])
 by smtp.googlemail.com with ESMTPSA id q17sm3745683ljg.23.2020.01.30.15.31.19
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Thu, 30 Jan 2020 15:31:19 -0800 (PST)
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
To: Juri Linkov <juri@HIDDEN>, Stefan Monnier <monnier@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN>
 <8736c921s6.fsf@HIDDEN> <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN> <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN>
 <87mua4woci.fsf@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <d4815135-49e6-1f17-0b41-16cc1df7e396@HIDDEN>
Date: Fri, 31 Jan 2020 02:31:18 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.9.0
MIME-Version: 1.0
In-Reply-To: <87mua4woci.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  On 31.01.2020 1:50, Juri Linkov wrote: > Maybe safer would
 be to use just (delay-mode-hooks (set-auto-mode)) That would be my choice
 as well. BTW, xref--collect-matches uses buffer-file-name in a similar way,
 curious how a problem with Eglot (or etc) never came up. 
 Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level
 mail domains are different
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (dgutov[at]yandex.ru)
 1.5 RCVD_IN_SORBS_WEB      RBL: SORBS: sender is an abusable web server
 [178.252.127.239 listed in dnsbl.sorbs.net]
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.208.182 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.85.208.182 listed in wl.mailspike.net]
 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and
 EnvelopeFrom freemail headers are different
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

On 31.01.2020 1:50, Juri Linkov wrote:
> Maybe safer would be to use just (delay-mode-hooks (set-auto-mode))

That would be my choice as well.

BTW, xref--collect-matches uses buffer-file-name in a similar way, 
curious how a problem with Eglot (or etc) never came up.

Also, see the comment there why it couldn't use delay-mode-hooks at the 
time (maybe it can now, if we're okay with entirely unsupporting 
syntax-propertize-via-font-lock).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 30 Jan 2020 23:10:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 30 18:10:06 2020
Received: from localhost ([127.0.0.1]:36368 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ixIwo-0003S8-4M
	for submit <at> debbugs.gnu.org; Thu, 30 Jan 2020 18:10:06 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:21690)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1ixIwm-0003RW-DI
 for 39190 <at> debbugs.gnu.org; Thu, 30 Jan 2020 18:10:04 -0500
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id DEE7780D86;
 Thu, 30 Jan 2020 18:09:58 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id EF6A480D8A;
 Thu, 30 Jan 2020 18:09:56 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1580425796;
 bh=m7NiLX+G1asPrnQf///tqMA+91XPMxHqWT659Ud+Y2U=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=e4AjfTPj18gOPqy/GPi4Ry5sGCuTnNdkORhd9HWlMnjCL5mWm73b/PMZd34NAxIbJ
 MlBkJzWc+ndRg7Ans7UNc0g7CP7ToADSY27/wODC9w1+IfvpyQwL/mQNybOJLdxuda
 OS6OXpRQsZAeJaV8yYg5Mr9R/naxEUAYVr3d9osw/LO8jNzBH3hM2JuHvfaEInJXQo
 9XTEE/1wsLDdqti9euUDxA/f/8F5rRYmCp7TZEv7QlEZSGOeWyV18zvxg2Rgbprmk3
 51q9/m/gmGNXwelGjNsE8cVuQJIuEht7cRa0Qx4LSGc7fXLMOP0mxMLRfN6jhp09DB
 7+E5KHKLPs5pg==
Received: from pastel (unknown [45.72.213.248])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 9B24B120FBB;
 Thu, 30 Jan 2020 18:09:56 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwv36bwczjx.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN>
 <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN>
 <87mua4woci.fsf@HIDDEN>
Date: Thu, 30 Jan 2020 18:09:55 -0500
In-Reply-To: <87mua4woci.fsf@HIDDEN> (Juri Linkov's message of "Fri, 
 31 Jan 2020 00:50:37 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.027 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>   generic-mode-find-file-hook()

Add that to the list of reasons why I loathe generic.el (and think that
diff-mode shouldn't call it explicitly).


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 30 Jan 2020 23:02:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 30 18:02:57 2020
Received: from localhost ([127.0.0.1]:36360 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ixIpt-0003HC-CV
	for submit <at> debbugs.gnu.org; Thu, 30 Jan 2020 18:02:57 -0500
Received: from dog.birch.relay.mailchannels.net ([23.83.209.48]:38546)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1ixIpr-0003H3-9o
 for 39190 <at> debbugs.gnu.org; Thu, 30 Jan 2020 18:02:55 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 162206A2641;
 Thu, 30 Jan 2020 23:02:54 +0000 (UTC)
Received: from pdx1-sub0-mail-a43.g.dreamhost.com
 (100-96-7-5.trex.outbound.svc.cluster.local [100.96.7.5])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 9AA0F6A283E;
 Thu, 30 Jan 2020 23:02:53 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a43.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); Thu, 30 Jan 2020 23:02:54 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Grain-Stupid: 4ec81ab408f155a7_1580425373863_405080721
X-MC-Loop-Signature: 1580425373863:1254788712
X-MC-Ingress-Time: 1580425373862
Received: from pdx1-sub0-mail-a43.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a43.g.dreamhost.com (Postfix) with ESMTP id 441577F470;
 Thu, 30 Jan 2020 15:02:48 -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=d9INx6rlOZX8shirF5GWrUoKnvQ=; b=
 BNph9yuPXRSxg4HYE68UTmaX5QJo2wyV60oQmpGjfgPLG3pXyKq51SfmX6Y9Zzyf
 /l6SDwADA0Y8a1QNQ7tFyZtIPR6jpaszRQOEYtKemJZjn5PKKWlPAdN1AQq8Yqqv
 cHvO1wXCFWgpC0AM06Ru+lHs45217iwIkwOa6FRa0Xk=
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@HIDDEN)
 by pdx1-sub0-mail-a43.g.dreamhost.com (Postfix) with ESMTPSA id 936677F104;
 Thu, 30 Jan 2020 15:02:45 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a43
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN>
 <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN>
Date: Fri, 31 Jan 2020 00:50:37 +0200
In-Reply-To: <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Mon, 27 Jan 2020 20:30:31 -0500")
Message-ID: <87mua4woci.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrfeelgddtudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> And now that I think about it, maybe
>
>     (or buffer-file-name-for-mode buffer-file-name)

I encountered more problems with buffer-file-name-for-mode
because there are more unexpected places that expect buffer-file-name:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  find-file-name-handler(nil file-name-sans-versions)
  file-name-sans-versions(nil)
  generic-mode-find-file-hook()
  diff-syntax-fontify-props(#("/dev/null" 0 9 (face (diff-file-header diff-header) fontified t)) "" (0 0) t)
  diff-syntax-fontify-hunk(1686 3081 t)
  diff-syntax-fontify(1686 3081)

because it relies on non-nil buffer-file-name:

(defun generic-mode-find-file-hook ()
  ...
  (when (and (eq major-mode 'fundamental-mode)
             (or (null generic-ignore-files-regexp)
                 (not (string-match-p
                       generic-ignore-files-regexp
                       (file-name-sans-versions buffer-file-name)))))
                                                ================

It would be hard to find all occurrences of buffer-file-name
where to add buffer-file-name-for-mode.

Maybe safer would be to use just (delay-mode-hooks (set-auto-mode))




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 30 Jan 2020 23:02:49 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 30 18:02:49 2020
Received: from localhost ([127.0.0.1]:36357 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ixIpl-0003Gq-2p
	for submit <at> debbugs.gnu.org; Thu, 30 Jan 2020 18:02:49 -0500
Received: from anteater.elm.relay.mailchannels.net ([23.83.212.3]:46826)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1ixIpi-0003Gi-N4
 for 39190 <at> debbugs.gnu.org; Thu, 30 Jan 2020 18:02:47 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 74A4D5E2899;
 Thu, 30 Jan 2020 23:02:45 +0000 (UTC)
Received: from pdx1-sub0-mail-a43.g.dreamhost.com
 (100-96-10-4.trex.outbound.svc.cluster.local [100.96.10.4])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id C7D1E5E28E1;
 Thu, 30 Jan 2020 23:02:44 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a43.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); Thu, 30 Jan 2020 23:02:45 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Cold-Spicy: 61cbf66846b6e5cb_1580425365128_593292083
X-MC-Loop-Signature: 1580425365127:137535292
X-MC-Ingress-Time: 1580425365127
Received: from pdx1-sub0-mail-a43.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a43.g.dreamhost.com (Postfix) with ESMTP id ACE787F104;
 Thu, 30 Jan 2020 15:02:40 -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=H+fecMR7tEHqz+c3Wu4fjnKwCyI=; b=
 fh/Uv3M/4YNHkG5eEmcnF7wJw94xVWi9kZ6lAHd+GonHfZ4NEh8XKgMVFDn3wRot
 rZ+MGjlmAMcVWaUm7STb7WPNjxD3+iWks6kfsBe1m84IIaktUWA1qVCEofHzvvaF
 a76XBCxuLC72f1s4ecGfKM5D4On9NTbanB2XSWH/pZo=
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@HIDDEN)
 by pdx1-sub0-mail-a43.g.dreamhost.com (Postfix) with ESMTPSA id 39D357F470;
 Thu, 30 Jan 2020 15:02:37 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a43
From: Juri Linkov <juri@HIDDEN>
To: Felician Nemeth <felician.nemeth@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN> <87v9os914e.fsf@HIDDEN>
Date: Fri, 31 Jan 2020 00:45:17 +0200
In-Reply-To: <87v9os914e.fsf@HIDDEN> (Felician Nemeth's message of
 "Thu, 30 Jan 2020 20:48:33 +0100")
Message-ID: <87a764y35u.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrfeelgddtudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehfvghlihgtihgrnhdrnhgvmhgvthhhsehgmhgrihhlrdgtohhm
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> Could you please try to reproduce the issue using Eglot with the
>> following minimal patch.  If it really fixes the bug then it
>> should be committed to Emacs 27 immediately, and more changes
>> could be added later.
>
> Unfortunately the minimal patch doesn't fix the issue.
>
> Case 1. When Eglot is started manually, then the recipe fails in an
> after-change-major-mode-hook where the buffer-file-name is non-nil for
> the temporary diff buffer.

Strange, when I tested the minimal patch, there were no errors anymore.

Before the patch, I got this error in the git master when trying
to use 'C-c C-r' (diff-reverse-direction) in the diff buffer:

  Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
    substring(nil 0 1)
    file-truename(nil)

But after applying the patch, after-change-major-mode-hook is not called
anymore in the temporary diff buffer.

> Case 2. With (add-to-list 'python-mode-hook 'eglot-ensure) the recipe
> fails in a post-command-hook, because eglot-ensure has this:
>
>       (when buffer-file-name
>         (add-hook 'post-command-hook #'maybe-connect 'append nil)))))
>
> And buffer-file-name is non-nil for the diff buffer during the execution
> of python-mode-hook.  But during the execution of maybe-connect in the
> post-command-hook, the buffer-file-name is nil and that leads to an
> error.

I guess Eglot should have more safeguarding, i.e. the same check
'when buffer-file-name' could be added to 'maybe-connect' as well.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 30 Jan 2020 19:48:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 30 14:48:45 2020
Received: from localhost ([127.0.0.1]:36275 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ixFnw-00074S-P5
	for submit <at> debbugs.gnu.org; Thu, 30 Jan 2020 14:48:44 -0500
Received: from mail-wr1-f54.google.com ([209.85.221.54]:34404)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felician.nemeth@HIDDEN>) id 1ixFnv-00074G-Hw
 for 39190 <at> debbugs.gnu.org; Thu, 30 Jan 2020 14:48:43 -0500
Received: by mail-wr1-f54.google.com with SMTP id t2so5663500wrr.1
 for <39190 <at> debbugs.gnu.org>; Thu, 30 Jan 2020 11:48:43 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:face:mime-version;
 bh=Sf/n+8Fgiin1OaxR67rcFzoSjf0mI/k67Zb2v5/u1ps=;
 b=jRQ0w8lTf4x3bsw18yCxC4Z43t2qOmHHyCEeQmVR8Evhmy4il5og0NcpUtzGUAjbUP
 AH8LoNYMrIBkMvK4EJ1LyuUqVbZtezcLhv1BXOwixyf3pT6nQkGwGMUaHNOVHT95lCZt
 TlinCcAe/W67qPa74lVOM+Q+09kwZyVcudXPtuzumy4/wGbfQwcY8ggwcHDqHyLk7IdK
 hFZGJSHP3sIPxLsR5q0ntYpbaZHiyiPTbntiUWZIUQynZX4Vr+7RvETAZx0+Io2/1IMJ
 147vB1OYYIfvTttuarFnJRjgalUrf49kTu9figPg9DrAZXL6RuvtxIz4p42bRjUryuas
 OGsA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:face:mime-version;
 bh=Sf/n+8Fgiin1OaxR67rcFzoSjf0mI/k67Zb2v5/u1ps=;
 b=kocBntFEDcjNZAnawjMbx1uRLoizufqC8Nty6kAzWnMNMJPBrnO9lu9DUEFIbFtRON
 IvMlwEVbFKR2P3xplwitsOVXgTPDQU69G2vHwuQ6NhaOP3ISuf/fd4rR0GPAAC1wCqx/
 bm6UGMGOXU1llNDahwOOnihpuTsjOD+Bg+cJ47tS8KEDnDtHBv/ZdkmAjJev9/PapITj
 XimVhr439lQknq4IMa5q1HVsry0DkoWqQJXNZf1XQ7Gpjh3bEBkGGlDWk3uIRwjh0ybe
 810eILFoQr4xCiGGCqWqpdcKoBIFh8UzcHWZmFngHuaE+S2lDOyjCfOdAHCtcvcgCDeR
 ybmw==
X-Gm-Message-State: APjAAAUNWVMQ8M+LO3daiOJEbS/8DbHwlBtTka19KW5tE28ME9kDS48v
 vlXVE1ulPLFt6nORggPHquz0r5ak
X-Google-Smtp-Source: APXvYqw2E2QEkp4hKS0MCJdMTRZGhftlyTu1RkfmRskqGl7kbC0ZMMx9Ld5okHGCIOnA0T1i54gduA==
X-Received: by 2002:adf:ea06:: with SMTP id q6mr598503wrm.218.1580413717245;
 Thu, 30 Jan 2020 11:48:37 -0800 (PST)
Received: from betli.gmail.com (catv-178-48-82-41.catv.broadband.hu.
 [178.48.82.41])
 by smtp.gmail.com with ESMTPSA id z25sm7492903wmf.14.2020.01.30.11.48.34
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Thu, 30 Jan 2020 11:48:36 -0800 (PST)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#39190: 28.0.50;
 two buffers with same buffer-file-name (diff-syntax-fontify-props)
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
 <871rrhkgkm.fsf@HIDDEN>
Date: Thu, 30 Jan 2020 20:48:33 +0100
In-Reply-To: <871rrhkgkm.fsf@HIDDEN> (Juri Linkov's message of "Thu, 
 30 Jan 2020 01:07:05 +0200")
Message-ID: <87v9os914e.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEUMBwgHAgMFAAGPjY7/
 //80MDHq6eqJt3pKAAABr0lEQVQ4jX2UzZKDIAzHqR177q7TPbtx2HMr6guQcrbY9txZ0fd/hA0f
 onXazcEJ/CD8E4Js8/HS9mwjXtqeMRxHXJkakTEm4b4GPVQW8PU8ov4fQCqeThlF60MBWdo1IXzd
 2nEEZE7CEAZLwI0N/gJAhTj7ESQAX4gPgO8lyI+cvgViSVPlNomAj2M9gW40eg7VWY3cATjUcyiO
 Z+i03cFruGLYoUR7VyU3HihdmCEVhoDN65FXkpbSxkomOzsTQN/gySaodGb9Gdi1oSRXP46gdBWh
 LcUKJNdeGCWac74GKakmne0aHCFvyqJPYLsCFAVlhRTvGdzMdLHqtgRyUulyXIAH7CYQ3AB0Nody
 JQhAkq/qtOnbjhxdzYDkXPxlH5y4WdUAeUcX1NVJ6GR7UQEYPGWoAnA36OQNn5lRRp38vHTAp9Br
 LoTmvlPPDoRCKzpjG1SXT89AaT5l456BamJuMcs+NIOMzJ/s5dI6yUVcrARlruwOebfdv6gunTn4
 ww3+QjGBEn5suVyLHoSGvAqREuDLN+iqZ+VcFg+HBbsJUU9+FZthbez9T+bdb+kPv2Ls6ct3hTkA
 AAAASUVORK5CYII=
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> Could you please try to reproduce the issue using Eglot with the
> following minimal patch.  If it really fixes the bug then it
> should be committed to Emacs 27 immediately, and more changes
> could be added later.

Unfortunately the minimal patch doesn't fix the issue.

Case 1. When Eglot is started manually, then the recipe fails in an
after-change-major-mode-hook where the buffer-file-name is non-nil for
the temporary diff buffer.

Case 2. With (add-to-list 'python-mode-hook 'eglot-ensure) the recipe
fails in a post-command-hook, because eglot-ensure has this:

      (when buffer-file-name
        (add-hook 'post-command-hook #'maybe-connect 'append nil)))))

And buffer-file-name is non-nil for the diff buffer during the execution
of python-mode-hook.  But during the execution of maybe-connect in the
post-command-hook, the buffer-file-name is nil and that leads to an
error.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 30 Jan 2020 14:34:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 30 09:34:52 2020
Received: from localhost ([127.0.0.1]:35131 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ixAuB-0005q7-VF
	for submit <at> debbugs.gnu.org; Thu, 30 Jan 2020 09:34:52 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:65030)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1ixAuA-0005pv-Hp
 for 39190 <at> debbugs.gnu.org; Thu, 30 Jan 2020 09:34:50 -0500
Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 2B93280EB9;
 Thu, 30 Jan 2020 09:34:45 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 60ECD80D8A;
 Thu, 30 Jan 2020 09:34:36 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1580394876;
 bh=oz0QPKo+HDsPRlD1snTdqZOq2zNgnBkiZF+69u8xnW0=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=VErSxEihY8L4GWOEZuVppcuv2uRIzN1AtkAFgPoi2WHWbFAt5FfMU+Fo6W2L05Moe
 3CKkDd9wgDpoRMqbXeaFbJq2UBhRF2d8YAFIqExSjkfovmq4ULHmvSXrOmskEMgg0X
 TOu6RFsy80YtYttLZnj9GhmNcK6VaDZ966fCnA/hSg8hvX9Wam1nmu4Oa9f2jS6k9E
 bI+OvwyZCp49UgzLtalJxQmrOovj0mmX/8rNElwEbwheq+mWCKFRXuLg1JIh0XBupN
 Gi0fq9wJZ/5pgnf0VPvOaU3shQHefGDN2Nj0q/dxbkV1kqv1R2JYDPzihHnZTYDdk7
 YRkBz2R9yif4g==
Received: from pastel (unknown [45.72.213.248])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C466A1201F4;
 Thu, 30 Jan 2020 09:34:35 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwvmua5dnun.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN>
 <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN> <83blqontlu.fsf@HIDDEN>
 <jwvk15bhevv.fsf-monnier+emacs@HIDDEN> <837e1bo499.fsf@HIDDEN>
 <jwvr1zjxs60.fsf-monnier+emacs@HIDDEN> <83y2trmitb.fsf@HIDDEN>
 <jwvmua7rx2n.fsf-monnier+emacs@HIDDEN> <83tv4embit.fsf@HIDDEN>
 <jwvd0b23qdl.fsf-monnier+emacs@HIDDEN> <83imktm3jh.fsf@HIDDEN>
Date: Thu, 30 Jan 2020 09:34:28 -0500
In-Reply-To: <83imktm3jh.fsf@HIDDEN> (Eli Zaretskii's message of "Thu, 30 Jan
 2020 16:17:54 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.032 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, felician.nemeth@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> >  . change set-auto-mode to accept another optional argument, the file
>> >    name to use to look up the mode
>> >
>> >  . perform look up of auto-mode-alist, then invoke the mode directly
>> 
>> The issue is that we also want to obey dir-locals and both above options
>> seem to become more invasive once we try and handle those (the first
>> above option is the first one I proposed, since I prefer
>> lexically-scoped args over dynamically-scoped vars ;-)
>
> What is the problem of the first alternative wrt dir-locals?  I don't
> think I understand that.

As I wrote: it's more invasive because you have to pass that extra arg
through various functions.

>> > Also, setting the pseudo-filename is not guaranteed to turn on the
>> > mode according to that file name.  Not sure if this matters in these
>> > cases.
>> Not sure what you mean here.
> set-auto-mode looks on other mode-determining stuff, before looking at
> the file name.

Ah, right.  This is a side-issue, yes: in cases like
`vc-revision-other-window` it does exactly what we want (i.e. it takes
advantage of the buffer's content (file-local vars, magic strings, ...)
to guess the mode), but in cases like diff-mode it can be detrimental
(since we don't have the full file content in that case, but only
a chunk of it, which means that things like file-local vars not only
will usually not be found but can even be incorrectly found).

I don't think it makes much difference to the current discussion, tho
(it's largely orthogonal).

>> > And finally, I cannot say that I like this part of the patch:
>> >
>> >   @@ -3459,6 +3460,8 @@ hack-local-variables-confirm
>> >        (let ((name (cond (dir-name)
>> > 			(buffer-file-name
>> > 			 (file-name-nondirectory buffer-file-name))
>> >   +		      (buffer-file-name-for-mode
>> >   +		       (file-name-nondirectory buffer-file-name-for-mode))
>> > 			((concat "buffer " (buffer-name)))))
>> > 	    (offer-save (and (eq enable-local-variables t)
>> > 			     unsafe-vars))
>> >
>> > If buffer-file-name-for-mode is not really a file name, we shouldn't
>> > call file-name-nondirectory on it.
>> 
>> It is supposed to be a file name.  It's only that the buffer is not
>> supposed to be the buffer corresponding to that file.
>
> Yes, but having leading directories in it feels... unclean,

Why so?  The leading directories are crucial for dir-locals support, and
they can also be important for auto-mode-alist.

>> That code is predicated on `buffer-file-name-for-mode` being
>> non-nil, AFAICT, so I think we're OK in this regard.
> Non-nil doesn't mean it's a string.

If someone sets it to non-nil and not a string, they'll get what
they deserve.  Same holds already for `buffer-file-name`, so it's not
a new problem introduced with this change.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 30 Jan 2020 14:18:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 30 09:18:01 2020
Received: from localhost ([127.0.0.1]:35099 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ixAdt-0005QG-In
	for submit <at> debbugs.gnu.org; Thu, 30 Jan 2020 09:18:01 -0500
Received: from eggs.gnu.org ([209.51.188.92]:51875)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1ixAdr-0005Q3-MZ
 for 39190 <at> debbugs.gnu.org; Thu, 30 Jan 2020 09:18:00 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:39518)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1ixAdm-0005pp-En; Thu, 30 Jan 2020 09:17:54 -0500
Received: from [176.228.60.248] (port=4921 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1ixAdl-00050x-Oq; Thu, 30 Jan 2020 09:17:54 -0500
Date: Thu, 30 Jan 2020 16:17:54 +0200
Message-Id: <83imktm3jh.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-reply-to: <jwvd0b23qdl.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Wed, 29 Jan 2020 16:33:31 -0500)
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN>
 <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN> <83blqontlu.fsf@HIDDEN>
 <jwvk15bhevv.fsf-monnier+emacs@HIDDEN> <837e1bo499.fsf@HIDDEN>
 <jwvr1zjxs60.fsf-monnier+emacs@HIDDEN> <83y2trmitb.fsf@HIDDEN>
 <jwvmua7rx2n.fsf-monnier+emacs@HIDDEN> <83tv4embit.fsf@HIDDEN>
 <jwvd0b23qdl.fsf-monnier+emacs@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, felician.nemeth@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> From: Stefan Monnier <monnier@HIDDEN>
> Cc: juri@HIDDEN,  39190 <at> debbugs.gnu.org,  felician.nemeth@HIDDEN
> Date: Wed, 29 Jan 2020 16:33:31 -0500
> 
> > But then did you consider alternatives to yet another magic
> > buffer-local variable?  Two possibilities come to mind:
> >
> >  . change set-auto-mode to accept another optional argument, the file
> >    name to use to look up the mode
> >
> >  . perform look up of auto-mode-alist, then invoke the mode directly
> 
> The issue is that we also want to obey dir-locals and both above options
> seem to become more invasive once we try and handle those (the first
> above option is the first one I proposed, since I prefer
> lexically-scoped args over dynamically-scoped vars ;-)

What is the problem of the first alternative wrt dir-locals?  I don't
think I understand that.

> > Also, setting the pseudo-filename is not guaranteed to turn on the
> > mode according to that file name.  Not sure if this matters in these
> > cases.
> 
> Not sure what you mean here.

set-auto-mode looks on other mode-determining stuff, before looking at
the file name.

> > And finally, I cannot say that I like this part of the patch:
> >
> >   @@ -3459,6 +3460,8 @@ hack-local-variables-confirm
> >        (let ((name (cond (dir-name)
> > 			(buffer-file-name
> > 			 (file-name-nondirectory buffer-file-name))
> >   +		      (buffer-file-name-for-mode
> >   +		       (file-name-nondirectory buffer-file-name-for-mode))
> > 			((concat "buffer " (buffer-name)))))
> > 	    (offer-save (and (eq enable-local-variables t)
> > 			     unsafe-vars))
> >
> > If buffer-file-name-for-mode is not really a file name, we shouldn't
> > call file-name-nondirectory on it.
> 
> It is supposed to be a file name.  It's only that the buffer is not
> supposed to be the buffer corresponding to that file.

Yes, but having leading directories in it feels... unclean, even more
than just having this variable.

> > If nothing else, it will signal an
> > error if buffer-file-name-for-mode is nil.
> 
> That code is predicated on `buffer-file-name-for-mode` being
> non-nil, AFAICT, so I think we're OK in this regard.

Non-nil doesn't mean it's a string.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 29 Jan 2020 23:44:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 29 18:44:45 2020
Received: from localhost ([127.0.0.1]:34720 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwx0n-0003oy-Hw
	for submit <at> debbugs.gnu.org; Wed, 29 Jan 2020 18:44:45 -0500
Received: from azure.elm.relay.mailchannels.net ([23.83.212.7]:21151)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1iwx0l-0003oo-Bt
 for 39190 <at> debbugs.gnu.org; Wed, 29 Jan 2020 18:44:44 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 33ACA580B66;
 Wed, 29 Jan 2020 23:44:42 +0000 (UTC)
Received: from pdx1-sub0-mail-a85.g.dreamhost.com
 (100-96-1-10.trex.outbound.svc.cluster.local [100.96.1.10])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 905C058119E;
 Wed, 29 Jan 2020 23:44:41 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a85.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, 29 Jan 2020 23:44:42 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Turn-Arch: 40a5efbc3ecc0844_1580341481931_1125987433
X-MC-Loop-Signature: 1580341481931:2813475626
X-MC-Ingress-Time: 1580341481931
Received: from pdx1-sub0-mail-a85.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a85.g.dreamhost.com (Postfix) with ESMTP id 34EAB7F012;
 Wed, 29 Jan 2020 15:44:36 -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=SoQ6Ly/aHezNYoAZi+N+I2S1ukE=; b=
 QOd2BckfJDRBUHvBDXoIBX/YdFdvdk6bqdxSs4lvOPHPYFxHpq7RmBqA2/g6bm4U
 x2kNlk7hVy2GJLpASdbuKuF6zRNYflxMUabFens3qVdRhFVrsEP0v4l1PGi2ce8X
 npDX5VzE3xpB4I2vpFsu8wrY6BayK7hSb482kidJOl0=
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@HIDDEN)
 by pdx1-sub0-mail-a85.g.dreamhost.com (Postfix) with ESMTPSA id DF5477F009;
 Wed, 29 Jan 2020 15:44:33 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a85
From: Juri Linkov <juri@HIDDEN>
To: Felician Nemeth <felician.nemeth@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN> <87d0b3qz3m.fsf@HIDDEN>
Date: Thu, 30 Jan 2020 01:07:05 +0200
In-Reply-To: <87d0b3qz3m.fsf@HIDDEN> (Felician Nemeth's message of
 "Tue, 28 Jan 2020 18:18:05 +0100")
Message-ID: <871rrhkgkm.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrfeejgdduudcutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehfvghlihgtihgrnhdrnhgvmhgvthhhsehgmhgrihhlrdgtohhm
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> Since it will take much time when the fix in Emacs will appear in a released
>> version, a workaround needs to be added to Eglot immediately.
>
> OK, but this feature ("Better syntax highlighting of Diff hunks") will
> first appear in Emacs 27.

Right, so it needs to be fixed in Emacs 27.

Could you please try to reproduce the issue using Eglot with the
following minimal patch.  If it really fixes the bug then it
should be committed to Emacs 27 immediately, and more changes
could be added later.

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 2dbab80208..9035f7643a 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2719,7 +2719,7 @@ diff-syntax-fontify-props
     (cl-assert (null buffer-file-name))
     (let ((enable-local-variables :safe) ;; to find `mode:'
           (buffer-file-name file))
-      (set-auto-mode)
+      (delay-mode-hooks (set-auto-mode))
       ;; FIXME: Is this really worth the trouble?
       (when (and (fboundp 'generic-mode-find-file-hook)
                  (memq #'generic-mode-find-file-hook






Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 29 Jan 2020 21:33:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 29 16:33:48 2020
Received: from localhost ([127.0.0.1]:34665 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwuy3-0000dC-Sw
	for submit <at> debbugs.gnu.org; Wed, 29 Jan 2020 16:33:48 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:39131)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1iwuy2-0000cz-9E
 for 39190 <at> debbugs.gnu.org; Wed, 29 Jan 2020 16:33:46 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 039B5440C44;
 Wed, 29 Jan 2020 16:33:41 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id D4CB3440C30;
 Wed, 29 Jan 2020 16:33:31 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1580333611;
 bh=wqDu1ihT8Mg1UfUo9HgSt+GRS1REoqHxjDBFSsPrQbw=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=C5wApj5oxfJFM7Ilv/mPEPSwcH094tY7gfehYm8YDAFYkzBxeId6aoFzEkJ2khuqb
 HUJQIazKcS8VWbsaRIPKuLulWi02PxlOchJiBOOE6ajsT4DomnT4xGlN6+Gvovd4tA
 MWfKXt5Gd/Q4/KQyLlC5h3RXKlgIboBceNb22QpV/Cost0ZC7KYfcFnzxtfwQ3g9h+
 tMZVx3imzkYVWfGXlbgBxHQ+bYOd6W1Q3AlE5QM+q1fIudC8lCS3bDnT8E46l+GUgl
 fEsJuasnYrLyiqgJ36eZbf4Q25yWr2CgR9UqdnxFgUJYIIQc41aDabD347+Gcr/2ed
 qsSKscnBXw5Yg==
Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id BA86C12097B;
 Wed, 29 Jan 2020 16:33:31 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwvd0b23qdl.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN>
 <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN> <83blqontlu.fsf@HIDDEN>
 <jwvk15bhevv.fsf-monnier+emacs@HIDDEN> <837e1bo499.fsf@HIDDEN>
 <jwvr1zjxs60.fsf-monnier+emacs@HIDDEN> <83y2trmitb.fsf@HIDDEN>
 <jwvmua7rx2n.fsf-monnier+emacs@HIDDEN> <83tv4embit.fsf@HIDDEN>
Date: Wed, 29 Jan 2020 16:33:31 -0500
In-Reply-To: <83tv4embit.fsf@HIDDEN> (Eli Zaretskii's message of "Wed, 29 Jan
 2020 19:13:14 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.057 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, felician.nemeth@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> But then did you consider alternatives to yet another magic
> buffer-local variable?  Two possibilities come to mind:
>
>  . change set-auto-mode to accept another optional argument, the file
>    name to use to look up the mode
>
>  . perform look up of auto-mode-alist, then invoke the mode directly

The issue is that we also want to obey dir-locals and both above options
seem to become more invasive once we try and handle those (the first
above option is the first one I proposed, since I prefer
lexically-scoped args over dynamically-scoped vars ;-)

> Also, setting the pseudo-filename is not guaranteed to turn on the
> mode according to that file name.  Not sure if this matters in these
> cases.

Not sure what you mean here.

> And finally, I cannot say that I like this part of the patch:
>
>   @@ -3459,6 +3460,8 @@ hack-local-variables-confirm
>        (let ((name (cond (dir-name)
> 			(buffer-file-name
> 			 (file-name-nondirectory buffer-file-name))
>   +		      (buffer-file-name-for-mode
>   +		       (file-name-nondirectory buffer-file-name-for-mode))
> 			((concat "buffer " (buffer-name)))))
> 	    (offer-save (and (eq enable-local-variables t)
> 			     unsafe-vars))
>
> If buffer-file-name-for-mode is not really a file name, we shouldn't
> call file-name-nondirectory on it.

It is supposed to be a file name.  It's only that the buffer is not
supposed to be the buffer corresponding to that file.

> If nothing else, it will signal an
> error if buffer-file-name-for-mode is nil.

That code is predicated on `buffer-file-name-for-mode` being
non-nil, AFAICT, so I think we're OK in this regard.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 29 Jan 2020 17:13:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jan 29 12:13:27 2020
Received: from localhost ([127.0.0.1]:34549 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwqu6-0000jP-VS
	for submit <at> debbugs.gnu.org; Wed, 29 Jan 2020 12:13:27 -0500
Received: from eggs.gnu.org ([209.51.188.92]:44767)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1iwqu5-0000jD-11
 for 39190 <at> debbugs.gnu.org; Wed, 29 Jan 2020 12:13:25 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:50580)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1iwqtz-0007Cn-7I; Wed, 29 Jan 2020 12:13:19 -0500
Received: from [176.228.60.248] (port=3682 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1iwqtw-0008Sw-GM; Wed, 29 Jan 2020 12:13:17 -0500
Date: Wed, 29 Jan 2020 19:13:14 +0200
Message-Id: <83tv4embit.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-reply-to: <jwvmua7rx2n.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Tue, 28 Jan 2020 18:17:23 -0500)
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN>
 <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN> <83blqontlu.fsf@HIDDEN>
 <jwvk15bhevv.fsf-monnier+emacs@HIDDEN> <837e1bo499.fsf@HIDDEN>
 <jwvr1zjxs60.fsf-monnier+emacs@HIDDEN> <83y2trmitb.fsf@HIDDEN>
 <jwvmua7rx2n.fsf-monnier+emacs@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, felician.nemeth@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> From: Stefan Monnier <monnier@HIDDEN>
> Cc: juri@HIDDEN,  39190 <at> debbugs.gnu.org,  felician.nemeth@HIDDEN
> Date: Tue, 28 Jan 2020 18:17:23 -0500
> 
> > Sorry, I don't understand.  I meant to ask why the code which sets
> > this new variable cannot call the major mode function instead?
> 
> The code does basically:
> 
>     (let ((buffer-file-name FOO))
>       (set-auto-mode))

Ah, okay.

But then did you consider alternatives to yet another magic
buffer-local variable?  Two possibilities come to mind:

 . change set-auto-mode to accept another optional argument, the file
   name to use to look up the mode

 . perform look up of auto-mode-alist, then invoke the mode directly

Also, setting the pseudo-filename is not guaranteed to turn on the
mode according to that file name.  Not sure if this matters in these
cases.

And finally, I cannot say that I like this part of the patch:

  @@ -3459,6 +3460,8 @@ hack-local-variables-confirm
       (let ((name (cond (dir-name)
			(buffer-file-name
			 (file-name-nondirectory buffer-file-name))
  +		      (buffer-file-name-for-mode
  +		       (file-name-nondirectory buffer-file-name-for-mode))
			((concat "buffer " (buffer-name)))))
	    (offer-save (and (eq enable-local-variables t)
			     unsafe-vars))

If buffer-file-name-for-mode is not really a file name, we shouldn't
call file-name-nondirectory on it.  If nothing else, it will signal an
error if buffer-file-name-for-mode is nil.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 28 Jan 2020 23:17:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 28 18:17:34 2020
Received: from localhost ([127.0.0.1]:33026 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwa6v-0001ts-Ux
	for submit <at> debbugs.gnu.org; Tue, 28 Jan 2020 18:17:34 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:44898)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1iwa6u-0001te-4U
 for 39190 <at> debbugs.gnu.org; Tue, 28 Jan 2020 18:17:32 -0500
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id C7F27101016;
 Tue, 28 Jan 2020 18:17:26 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 0703D100EC5;
 Tue, 28 Jan 2020 18:17:25 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1580253445;
 bh=3hg2Gu/2k97DuqaPHmJws9bfkljBoagqD860Rdz0BUE=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=klfcododMxaWOEYVufrBr/6fusuoQRbRqbU5wZ57UWq9eoRLgJhsT1Yh/0mC/gxaF
 6AsfLu82b18ojdqHXmx4C/mkYJ2L61P3TOA5exr9CnovoYSreQCLDFS+6mJcCIH+Ej
 wmpWVoxu/M+tsbj0IA+LlNQWUu5kjzOs7Q7lN8XGeITe3zGatESCcnzPgRWWTFRn7p
 SS/OLMEAjI+YNOJUzDg/z5ZKddeNl7vybqeaqdieGyeIV7txniBvGgBPt5c5j2+TIz
 3XtECiLUmRQe/H/pW/FetMqdBvAuJX6CiXNvZ3H10BZ07lqXyTXJHzYiBKqCfUsC6h
 5PyVBXCNuRUPA==
Received: from ceviche (unknown [45.72.213.248])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id B9FE712093A;
 Tue, 28 Jan 2020 18:17:24 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwvmua7rx2n.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN>
 <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN> <83blqontlu.fsf@HIDDEN>
 <jwvk15bhevv.fsf-monnier+emacs@HIDDEN> <837e1bo499.fsf@HIDDEN>
 <jwvr1zjxs60.fsf-monnier+emacs@HIDDEN> <83y2trmitb.fsf@HIDDEN>
Date: Tue, 28 Jan 2020 18:17:23 -0500
In-Reply-To: <83y2trmitb.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 28 Jan
 2020 22:23:28 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.020 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, felician.nemeth@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Sorry, I don't understand.  I meant to ask why the code which sets
> this new variable cannot call the major mode function instead?

The code does basically:

    (let ((buffer-file-name FOO))
      (set-auto-mode))

How could it "call the major mode function instead"?


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 28 Jan 2020 23:17:14 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 28 18:17:13 2020
Received: from localhost ([127.0.0.1]:33022 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwa6b-0001tI-Ks
	for submit <at> debbugs.gnu.org; Tue, 28 Jan 2020 18:17:13 -0500
Received: from bongo.elm.relay.mailchannels.net ([23.83.212.21]:56564)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1iwa6W-0001t6-TK
 for 39190 <at> debbugs.gnu.org; Tue, 28 Jan 2020 18:17:11 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 7A84350203A;
 Tue, 28 Jan 2020 23:17:07 +0000 (UTC)
Received: from pdx1-sub0-mail-a93.g.dreamhost.com
 (100-96-211-48.trex.outbound.svc.cluster.local [100.96.211.48])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id EC81E501FFA;
 Tue, 28 Jan 2020 23:17:06 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a93.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); Tue, 28 Jan 2020 23:17:07 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Lyrical-Spicy: 52c107364b22cf3a_1580253427224_4211542375
X-MC-Loop-Signature: 1580253427224:3012536684
X-MC-Ingress-Time: 1580253427224
Received: from pdx1-sub0-mail-a93.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a93.g.dreamhost.com (Postfix) with ESMTP id 5CFDA80F9A;
 Tue, 28 Jan 2020 15:17:03 -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=6Kqamy1wXh3ra+2QK9avMYpMS3E=; b=
 crOe5fGgTIrhTvwypx1ujWrJwnMdImJujsgsLK/MLQk5i2zOOs5xm2N357NiPRKz
 YyFIOZrxuBBT2KN/9PKanFnqcE8wIjaSzCXrUr09/SgAljkj7odIkO4WVYl86Ryd
 74Y9Mh88LnJvNPqoT7ECQwIbndhBNzQ7l5ui6+bw96s=
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@HIDDEN)
 by pdx1-sub0-mail-a93.g.dreamhost.com (Postfix) with ESMTPSA id 4D1F480F9C;
 Tue, 28 Jan 2020 15:16:58 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a93
From: Juri Linkov <juri@HIDDEN>
To: Dmitry Gutov <dgutov@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN>
 <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN> <83blqontlu.fsf@HIDDEN>
 <jwvk15bhevv.fsf-monnier+emacs@HIDDEN>
 <ed4629f1-29cb-c2e4-a75a-39a072ef2c58@HIDDEN>
Date: Wed, 29 Jan 2020 00:53:27 +0200
In-Reply-To: <ed4629f1-29cb-c2e4-a75a-39a072ef2c58@HIDDEN> (Dmitry Gutov's
 message of "Tue, 28 Jan 2020 17:54:23 +0300")
Message-ID: <871rrjcgyw.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrfeeggdduieehucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffvufhofhffjgfkfgggtgesthdtredttdertdenucfhrhhomheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqeenucfkphepledurdduvdelrddutdehrdduvdeinecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrddutdehrdduvdeipdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepughguhhtohhvseihrghnuggvgidrrhhu
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Eli Zaretskii <eliz@HIDDEN>,
 felician.nemeth@HIDDEN, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> 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
>
> I think diff-mode could also use delay-mode-hooks and then run them (or
> not) outside of that let binding.

Interesting idea, I see no problem with this:

diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 2dbab80208..9035f7643a 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2719,7 +2719,7 @@ diff-syntax-fontify-props
     (cl-assert (null buffer-file-name))
     (let ((enable-local-variables :safe) ;; to find `mode:'
           (buffer-file-name file))
-      (set-auto-mode)
+      (delay-mode-hooks (set-auto-mode))
       ;; FIXME: Is this really worth the trouble?
       (when (and (fboundp 'generic-mode-find-file-hook)
                  (memq #'generic-mode-find-file-hook




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 28 Jan 2020 20:23:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 28 15:23:41 2020
Received: from localhost ([127.0.0.1]:32951 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwXOf-0005oJ-6g
	for submit <at> debbugs.gnu.org; Tue, 28 Jan 2020 15:23:41 -0500
Received: from eggs.gnu.org ([209.51.188.92]:59170)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1iwXOd-0005o4-Cw
 for 39190 <at> debbugs.gnu.org; Tue, 28 Jan 2020 15:23:40 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:34546)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1iwXOX-0002Et-Bn; Tue, 28 Jan 2020 15:23:33 -0500
Received: from [176.228.60.248] (port=3601 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1iwXOW-0000ly-NV; Tue, 28 Jan 2020 15:23:33 -0500
Date: Tue, 28 Jan 2020 22:23:28 +0200
Message-Id: <83y2trmitb.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-reply-to: <jwvr1zjxs60.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Tue, 28 Jan 2020 15:12:03 -0500)
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN>
 <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN> <83blqontlu.fsf@HIDDEN>
 <jwvk15bhevv.fsf-monnier+emacs@HIDDEN> <837e1bo499.fsf@HIDDEN>
 <jwvr1zjxs60.fsf-monnier+emacs@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, felician.nemeth@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> From: Stefan Monnier <monnier@HIDDEN>
> Cc: juri@HIDDEN,  39190 <at> debbugs.gnu.org,  felician.nemeth@HIDDEN
> Date: Tue, 28 Jan 2020 15:12:03 -0500
> 
> > 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?
> 
> We set the variable in order to find out what mode to use.

Sorry, I don't understand.  I meant to ask why the code which sets
this new variable cannot call the major mode function instead?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 28 Jan 2020 20:12:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 28 15:12:17 2020
Received: from localhost ([127.0.0.1]:32928 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwXDc-0005Ui-PZ
	for submit <at> debbugs.gnu.org; Tue, 28 Jan 2020 15:12:17 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:34567)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1iwXDa-0005UJ-P8
 for 39190 <at> debbugs.gnu.org; Tue, 28 Jan 2020 15:12:15 -0500
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 3AE8F101359;
 Tue, 28 Jan 2020 15:12:09 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 3097F1012B8;
 Tue, 28 Jan 2020 15:12:07 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1580242327;
 bh=o64WLv61uHWOrczCh2e1gGil3riLI/xkAxchYUlHnV0=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=T46R9WjlvkgRmwmQ9Vy30h/dW5yRXakXPwewgxzLMTcpHfs0HSVubnKVRSrlDVoTF
 gUAV6oSoGmRhNeXDVDpPXBWDDBZahJI67DMMYkUgNtfrRQykMobf9cfRm8dNH10NSe
 jw30zTsLaS7dtKqKx01/8dPkUG1Ch/KSnr1kDERh18QMgSVPlVjrDU1U+KtlTLk4bu
 hiSJey9b42lsezHchBd6PXoMUc4kBllSw0mMYBwvKS3yqx3NgIsb2i02KbG08it/1/
 tJRGqAxKb1ttUjMp7A+8rZirLm7EpfuLwr1Ske0vxP3zZKj/zqE1UVTjgY46+VgdlU
 QnpVHOhclQaJQ==
Received: from alfajor (modemcable157.163-203-24.mc.videotron.ca
 [24.203.163.157])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id C3CA7120287;
 Tue, 28 Jan 2020 15:12:06 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwvr1zjxs60.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN>
 <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN> <83blqontlu.fsf@HIDDEN>
 <jwvk15bhevv.fsf-monnier+emacs@HIDDEN> <837e1bo499.fsf@HIDDEN>
Date: Tue, 28 Jan 2020 15:12:03 -0500
In-Reply-To: <837e1bo499.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 28 Jan
 2020 19:54:58 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.013 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, felician.nemeth@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> So this is because those modes

They're not "modes", really, they're features that create a temp buffer
related to file FOO and need to set this buffer to the same mode as file FOO
(e.g. this happens in vc-revision-other-window, or also in diff-mode
where we grab a hunk's text and want to put it in its corresponding
major mode to give it mode-specific highlighting).

> set buffer-file-name instead of activating the major mode directly?

Right: they don't know which major mode should be used, so they set
buffer-file-name and then call set-auto-mode (which looks up
auto-mode-alist and directory local vars appropriately).

> And by setting buffer-file-name they by side effect tell unrelated
> features that this buffer is associated with a file?

Indeed.

> 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?

That's what the patch does, yes (modulo the fact that they're not
really "modes").

> 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?

We set the variable in order to find out what mode to use.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 28 Jan 2020 17:55:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 28 12:55:17 2020
Received: from localhost ([127.0.0.1]:32833 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwV53-0006LE-4A
	for submit <at> debbugs.gnu.org; Tue, 28 Jan 2020 12:55:17 -0500
Received: from eggs.gnu.org ([209.51.188.92]:50321)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1iwV51-0006Ky-GT
 for 39190 <at> debbugs.gnu.org; Tue, 28 Jan 2020 12:55:15 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:60320)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1iwV4v-0001QM-Ho; Tue, 28 Jan 2020 12:55:09 -0500
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 <eliz@HIDDEN>)
 id 1iwV4q-0001ZX-8m; Tue, 28 Jan 2020 12:55:06 -0500
Date: Tue, 28 Jan 2020 19:54:58 +0200
Message-Id: <837e1bo499.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-reply-to: <jwvk15bhevv.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Tue, 28 Jan 2020 08:58:32 -0500)
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN>
 <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN> <83blqontlu.fsf@HIDDEN>
 <jwvk15bhevv.fsf-monnier+emacs@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, felician.nemeth@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> From: Stefan Monnier <monnier@HIDDEN>
> Cc: juri@HIDDEN,  39190 <at> debbugs.gnu.org,  felician.nemeth@HIDDEN
> 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?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 28 Jan 2020 17:18:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 28 12:18:15 2020
Received: from localhost ([127.0.0.1]:32812 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwUVC-0005Pr-Vj
	for submit <at> debbugs.gnu.org; Tue, 28 Jan 2020 12:18:15 -0500
Received: from mail-wr1-f48.google.com ([209.85.221.48]:47013)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felician.nemeth@HIDDEN>) id 1iwUVB-0005Pd-5z
 for 39190 <at> debbugs.gnu.org; Tue, 28 Jan 2020 12:18:13 -0500
Received: by mail-wr1-f48.google.com with SMTP id z7so16921139wrl.13
 for <39190 <at> debbugs.gnu.org>; Tue, 28 Jan 2020 09:18:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:face:mime-version;
 bh=lO0VwfDTwKO4+oWh0Iq1A9vTsxi9DkClmmF9NhZ13TA=;
 b=Gc5PI1cKVTvWnreMyTXbzVOfcyLyrozpYL9UJirndSv8Xvr23ssLobBkxhvU85nd26
 L2AWs6/LLiT5fwK7DdA8YYgazwMp17x6j382ev5GsudaQpR8IAIR2prnfEBjLyce9/BX
 ZzyMYaiJhtgaZ7YeiXfTHkNKJsdyJmKYEB2QqMk75w169+Ns3/pSKq02DppDFfDPVSYI
 8sJOAL/uSt+AQFeFyyEJbNdlCxMnuLC2q05yUPERwF6Pr1rmpB5//kTQjo2qYOPaxUCm
 nIs8l+Q/a/lZdr2cieERTtTLh/W3y+nG39IOVnkH7vn51bljYf7vd7Zcz7NdK1FCDlAp
 2p0g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:user-agent:face:mime-version;
 bh=lO0VwfDTwKO4+oWh0Iq1A9vTsxi9DkClmmF9NhZ13TA=;
 b=F4BxfYXj2wf1Iveq9aY7y7qcxnkzU5imnCOOhaSvM9hlFYS3dn925yMORkd9UdIgm1
 F9Vj2P6FQS3Ywf3miUQpShFfykkc0z5+zC3ZB42B/MIURduWbiYJKTo24YqVWTKDAfKX
 xFNqDGdngRtwywsWegD6/iP667fD2GfvKfLftqTwacuE/UFl1kuxE1hN2TJdAN5G9QRp
 KoXoxHenBhDXXEcouZzcOkfrDs5BZUWl99wIV0nGAQH2xL0/T/OVzDpW6b59j/AZOvvm
 JALXYMCYlHnv5r+yTLTZzq6v3P2wFreFNEQ8wAKBo5NUFqpYjOSPA9b/lU7VgEjJkUcj
 VWHA==
X-Gm-Message-State: APjAAAV3qbQxWPf5htZSO7Tmcmcc/oMgLZIr+g2/SSS1v5HA1VqEQ+bE
 teus4+NMOipqNxeeqzoecL0Eznl1
X-Google-Smtp-Source: APXvYqy3+sOzmWfQRTpQ8RIcsI3btD/gjpMWW8qeqso6J6YRDu14AS/pQKvhfxX5MEv75+HJmufLKA==
X-Received: by 2002:a5d:480b:: with SMTP id l11mr28919793wrq.129.1580231887135; 
 Tue, 28 Jan 2020 09:18:07 -0800 (PST)
Received: from betli.gmail.com (catv-178-48-82-41.catv.broadband.hu.
 [178.48.82.41])
 by smtp.gmail.com with ESMTPSA id a198sm2774369wme.12.2020.01.28.09.18.05
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Tue, 28 Jan 2020 09:18:06 -0800 (PST)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#39190: 28.0.50;
 two buffers with same buffer-file-name (diff-syntax-fontify-props)
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
 <87ftg0fnyb.fsf@HIDDEN>
Date: Tue, 28 Jan 2020 18:18:05 +0100
In-Reply-To: <87ftg0fnyb.fsf@HIDDEN> (Juri Linkov's message of "Tue, 
 28 Jan 2020 02:05:04 +0200")
Message-ID: <87d0b3qz3m.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX5+fmhoaEwMDD/
 ///TMNVWAAAAAWJLR0QDEQxM8gAAAAlwSFlzAAAPEgAADxIBIZvyMwAAAAd0SU1FB+AICBUfHgLs
 gGoAAAGXSURBVCjPRdK/b5tAFAfw753gBEwM2ApMbuVIqf+Ko0qiyhOu4sj2xJBYMn/FUdX7UUUZ
 OjHgyvf+yj6IcW6Bjx53934ADEvs8bmEr8UVoTYTOyJO9KoYsVofN8kILdbeJ8Li6YpZWop4xOK0
 VdfIoXmkHn5/5D7/Ts/8THacSqnkKTcMTxgUkVzFnEIRTKwwYYSCvzfg16f0i8YApW/XG/Pm8R49
 dXjxKmRnxv3OwooQWcv4RUYem1fsNe/WU63uk7AmYxk78y32/ee2tZB4fO+WcZ7lnIGEolXW1EGw
 LfkSuQ0XTgRefgNlfNwRNV6QhBxJ8JNxTMUPyBqTd0bjaAP5G7NJRU39z80hLOZTjqB7K3tEEFSj
 aEsuQew6qBxxyhHjVUR7H7NpC9iHJZGLMCEuweqAqE1BHbfK2oRIz9EHYA/+wiFWru9smeVfuWNZ
 2+NFtX80UA1TvJNdytM4DwO4kY7bJz8Qcd0G0ceslZGkkeoBsjUHwF1+jjM3XHaXEZ7mGLfwPFO+
 RV9QLY2iEdmDo78D/gNPaXVYqd+pyQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNi0wOC0wOFQyMzoz
 MDoyOCswMjowMGy/yHYAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTYtMDgtMDhUMjM6MzA6MjgrMDI6
 MDAd4nDKAAAAAElFTkSuQmCC
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>>> Now I tried to repeat this problem with eglot and got such backtrace:
>> [...]
>>
>> Did you use the ELPA version or the git master?
>
> The backtrace was from the ELPA version, but trying it
> in the git master signals a different error:
>
> Error in post-command-hook:
> (error "[eglot] Can't guess mode to manage for ` *diff-syntax:...

That's strange.  I was able to reproduce the original bug report
following this recipe:
https://github.com/joaotavora/eglot/pull/233#issuecomment-466691992
I wonder if your setup is different is some way.

>> Having read your discussion I have a feeling that this issue affects
>> more than just Eglot.  Nevertheless we plan a feature that postpones the
>> activation of Eglot and this feature is somewhat similar to Stefan's
>> first suggestion.  So if the only concern is Eglot, then this issue can
>> be closed.
>
> Since it will take much time when the fix in Emacs will appear in a released
> version, a workaround needs to be added to Eglot immediately.

OK, but this feature ("Better syntax highlighting of Diff hunks") will
first appear in Emacs 27.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 28 Jan 2020 14:54:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 28 09:54:33 2020
Received: from localhost ([127.0.0.1]:59758 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwSG9-0001V1-4j
	for submit <at> debbugs.gnu.org; Tue, 28 Jan 2020 09:54:33 -0500
Received: from mail-lj1-f174.google.com ([209.85.208.174]:45409)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <raaahh@HIDDEN>) id 1iwSG7-0001Uo-IY
 for 39190 <at> debbugs.gnu.org; Tue, 28 Jan 2020 09:54:32 -0500
Received: by mail-lj1-f174.google.com with SMTP id f25so2135066ljg.12
 for <39190 <at> debbugs.gnu.org>; Tue, 28 Jan 2020 06:54:31 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=sender:subject:to:cc:references:from:message-id:date:user-agent
 :mime-version:in-reply-to:content-language:content-transfer-encoding;
 bh=72MuCNUdYlSZesSoXr2Te10yVRaLUDSwFtfAasevCYg=;
 b=SN2kQbWqMLSLSK9x7mSbE10vb/0Q1Zx9HcaUDTH4RDGOfiZiHJ3FBuBD9EFVmZ3BkY
 spRmtn2SwJTgKLId/ponlsaDGHYQ4XCHWtKR/qcO0HTkJc1aHGG1GaLEF4LYnxUjydjs
 hMK9IVySpDDyxmuao7DLTKueWlZgIoG7J/dFsIF6dUBdhzG448PmunjvLXl8OqfPhiRC
 wERmnFOZdiFa7YmoKqW0Q3KmVIqK7gZllK9+Exi9KuGV29MovleAc70Ne1oBjmCz76Pb
 mzxfPW6iUaXmtYk3+P4SU/++K6MtzS+TXpgzb4wryw1QQuWfktS3aHDD80+ZT4j5Vw+s
 tY5Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:sender:subject:to:cc:references:from:message-id
 :date:user-agent:mime-version:in-reply-to:content-language
 :content-transfer-encoding;
 bh=72MuCNUdYlSZesSoXr2Te10yVRaLUDSwFtfAasevCYg=;
 b=ERc7QdrPAgkRB4ecJWfvKN9OVhEA/jVjgmH6R8nEzgeGP9cxJ9+RfQuWKFwzqXgTpK
 fC4WBNmwc7gd7etQDdF+yQI6WnnNdgfGGJcPsM+EUvwK5Bz3cdosIlw/uSTUwupNNZzt
 xoUnR/hurcTt2TNKaiLtnjltzrgqJjoLPqg2EJYRUb8KPyLSQ6ItuLhpzh0pS7hS42Cv
 j8g1szyIklXNudQh4Lp2ik0D3+TBqUPICz+IKyy9ya1TlNnm+AxQw06nFIU3Vld1j2AR
 LoGvWPqRWNfY3uB10W3RIKQi+8erCv3i6ttW1T5eNd/CsrCsqwvvCObNJGlgSZdOK442
 Cu7g==
X-Gm-Message-State: APjAAAUuoQiNuxNeEtEnCYdIGYwFyCV/BQDAxdPVSHh+u1SKWbmW0bJl
 fO38uD7m/2nXOdrQCd3uFos=
X-Google-Smtp-Source: APXvYqzzjgcAre8i4HxaLhW+2zDTYAwKvtDGQQ+/IabJqllGdKtzAkbVTbYxUpUkabf7ego6ggaZNw==
X-Received: by 2002:a2e:9f52:: with SMTP id v18mr12734597ljk.30.1580223265389; 
 Tue, 28 Jan 2020 06:54:25 -0800 (PST)
Received: from [192.168.1.142] ([178.252.127.239])
 by smtp.googlemail.com with ESMTPSA id y7sm2787168ljy.92.2020.01.28.06.54.24
 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
 Tue, 28 Jan 2020 06:54:24 -0800 (PST)
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
To: Stefan Monnier <monnier@HIDDEN>, Eli Zaretskii <eliz@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN>
 <8736c921s6.fsf@HIDDEN> <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN> <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN>
 <83blqontlu.fsf@HIDDEN> <jwvk15bhevv.fsf-monnier+emacs@HIDDEN>
From: Dmitry Gutov <dgutov@HIDDEN>
Message-ID: <ed4629f1-29cb-c2e4-a75a-39a072ef2c58@HIDDEN>
Date: Tue, 28 Jan 2020 17:54:23 +0300
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.9.0
MIME-Version: 1.0
In-Reply-To: <jwvk15bhevv.fsf-monnier+emacs@HIDDEN>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Spam-Score: 2.0 (++)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  On 28.01.2020 16:58, Stefan Monnier wrote: > 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 buff [...]
 Content analysis details:   (2.0 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 1.5 RCVD_IN_SORBS_WEB      RBL: SORBS: sender is an abusable web server
 [178.252.127.239 listed in dnsbl.sorbs.net]
 0.0 SPF_HELO_NONE          SPF: HELO does not publish an SPF Record
 0.0 FREEMAIL_FROM          Sender email is commonly abused enduser mail
 provider (dgutov[at]yandex.ru)
 -0.0 SPF_PASS               SPF: sender matches SPF record
 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level
 mail domains are different
 -0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at https://www.dnswl.org/,
 no trust [209.85.208.174 listed in list.dnswl.org]
 -0.0 RCVD_IN_MSPIKE_H2      RBL: Average reputation (+2)
 [209.85.208.174 listed in wl.mailspike.net]
 0.2 FREEMAIL_FORGED_FROMDOMAIN 2nd level domains in From and
 EnvelopeFrom freemail headers are different
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, felician.nemeth@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

On 28.01.2020 16:58, Stefan Monnier wrote:
> 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

I think diff-mode could also use delay-mode-hooks and then run them (or 
not) outside of that let binding.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 28 Jan 2020 13:58:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jan 28 08:58:44 2020
Received: from localhost ([127.0.0.1]:59726 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwRO7-0000Am-Qn
	for submit <at> debbugs.gnu.org; Tue, 28 Jan 2020 08:58:44 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:56668)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1iwRO6-0000AZ-03
 for 39190 <at> debbugs.gnu.org; Tue, 28 Jan 2020 08:58:42 -0500
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)
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==
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)
From: Stefan Monnier <monnier@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwvk15bhevv.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN>
 <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN> <83blqontlu.fsf@HIDDEN>
Date: Tue, 28 Jan 2020 08:58:32 -0500
In-Reply-To: <83blqontlu.fsf@HIDDEN> (Eli Zaretskii's message of "Tue, 28 Jan
 2020 05:32:45 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.020 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, felician.nemeth@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> 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





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 28 Jan 2020 03:33:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 27 22:33:00 2020
Received: from localhost ([127.0.0.1]:59343 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwHcZ-0008Hg-OE
	for submit <at> debbugs.gnu.org; Mon, 27 Jan 2020 22:32:59 -0500
Received: from eggs.gnu.org ([209.51.188.92]:41550)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1iwHcX-0008HR-Qe
 for 39190 <at> debbugs.gnu.org; Mon, 27 Jan 2020 22:32:58 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e]:47475)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>)
 id 1iwHcR-000319-VT; Mon, 27 Jan 2020 22:32:52 -0500
Received: from [176.228.60.248] (port=1735 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256)
 (Exim 4.82) (envelope-from <eliz@HIDDEN>)
 id 1iwHcR-0000Ox-97; Mon, 27 Jan 2020 22:32:51 -0500
Date: Tue, 28 Jan 2020 05:32:45 +0200
Message-Id: <83blqontlu.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
In-reply-to: <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN> (message from Stefan
 Monnier on Mon, 27 Jan 2020 20:30:31 -0500)
Subject: Re: bug#39190: 28.0.50;
 two buffers with same buffer-file-name (diff-syntax-fontify-props)
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN> <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, felician.nemeth@HIDDEN, juri@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.7 (-)

> From: Stefan Monnier <monnier@HIDDEN>
> Date: Mon, 27 Jan 2020 20:30:31 -0500
> Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
> 
> > This requires more testing, but at least such patch
> > basically would look like this:
> 
> This looks pretty good to me.  I wonder what Eli thinks about it.

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?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 28 Jan 2020 01:30:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 27 20:30:47 2020
Received: from localhost ([127.0.0.1]:59327 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwFiI-0005NP-Vf
	for submit <at> debbugs.gnu.org; Mon, 27 Jan 2020 20:30:47 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:57098)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1iwFiF-0005NB-CL
 for 39190 <at> debbugs.gnu.org; Mon, 27 Jan 2020 20:30:45 -0500
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 3D3541011CA;
 Mon, 27 Jan 2020 20:30:37 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 37E69100375;
 Mon, 27 Jan 2020 20:30:35 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1580175035;
 bh=1f9lDce1ZZVv3NVeFz4qjN0hxXNor7X2FHg16JajYXc=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=Ldrjiop3S+jKcsG7o1U6sGr6iDMVFoQX0IUeS0j2Qhjc0+ibVLnEYcC3RUNXkFbDL
 f6GWVXe0UbDuKg8iiHQUsV9IHaWNkBRgjcb0P0E8KrAT5xZtZUipZdiuAmbGOAUzs/
 C4bAwl90Dbz7FHKYet2KA4kVyKfzNpVEsoNcly/KFwV0hV5BtL0PLBZA6bkZsR9tb+
 RkX7hes84tmVftD8RdDGdoDXdzVLY4kA3eY6N8S1ZYIzg970NsRELEHmZhfuq5z0rC
 zv2wrudjT5nSrX2sLb7OOK/rONvrtSPupmsktFALIzcdnXbuuvEqKGS+k/LZbU2RvY
 2BrSPGlQ0w6/Q==
Received: from pastel (unknown [45.72.213.248])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 00D3E120732;
 Mon, 27 Jan 2020 20:30:33 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwvd0b4id3v.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
 <87imkwfnyv.fsf@HIDDEN>
Date: Mon, 27 Jan 2020 20:30:31 -0500
In-Reply-To: <87imkwfnyv.fsf@HIDDEN> (Juri Linkov's message of "Tue, 
 28 Jan 2020 02:01:44 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.020 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> This requires more testing, but at least such patch
> basically would look like this:

This looks pretty good to me.  I wonder what Eli thinks about it.

> +(defvar-local buffer-file-name-for-mode nil)

Clearly we'd need a docstring here.

> +      (if (or buffer-file-name buffer-file-name-for-mode)

And now that I think about it, maybe

    (or buffer-file-name-for-mode buffer-file-name)

would be preferable (in case we want to set the major mode of a file
buffer based o a different file name).


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 28 Jan 2020 00:13:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 27 19:13:40 2020
Received: from localhost ([127.0.0.1]:59301 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwEVg-0001Xu-KU
	for submit <at> debbugs.gnu.org; Mon, 27 Jan 2020 19:13:40 -0500
Received: from chocolate.birch.relay.mailchannels.net ([23.83.209.35]:18900)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1iwEVd-0001Xk-V0
 for 39190 <at> debbugs.gnu.org; Mon, 27 Jan 2020 19:13:38 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id DA4E4580AAD;
 Tue, 28 Jan 2020 00:13:36 +0000 (UTC)
Received: from pdx1-sub0-mail-a37.g.dreamhost.com
 (100-96-11-27.trex.outbound.svc.cluster.local [100.96.11.27])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 72E4F580A9A;
 Tue, 28 Jan 2020 00:13:36 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a37.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); Tue, 28 Jan 2020 00:13:36 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Reaction-Relation: 00534c6c341eca12_1580170416689_4240566262
X-MC-Loop-Signature: 1580170416689:887987615
X-MC-Ingress-Time: 1580170416689
Received: from pdx1-sub0-mail-a37.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a37.g.dreamhost.com (Postfix) with ESMTP id CE1ED8040D;
 Mon, 27 Jan 2020 16:13:31 -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=Zkae1ua7nZUDVq04Swb8h9+Z94Q=; b=
 Wxf3bdTUM9YSYt2PN9VoP7t3M7MLCUp7JkT4WRETHo9fVQRYj68Kr1q7+60g3sa4
 UbAslDbAkgxX+6EKnPbN+zDut1S0MoRExi09+WZfbpH9XXeuy7IXPluMwnlKYfCy
 ihXMPMFFu5fV56KUQOA5NEttneynLpJVjKq1bGI9/ko=
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@HIDDEN)
 by pdx1-sub0-mail-a37.g.dreamhost.com (Postfix) with ESMTPSA id E15DD7FF2E;
 Mon, 27 Jan 2020 16:13:29 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a37
From: Juri Linkov <juri@HIDDEN>
To: Felician Nemeth <felician.nemeth@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN> <87h80iqafm.fsf@HIDDEN>
Date: Tue, 28 Jan 2020 02:05:04 +0200
In-Reply-To: <87h80iqafm.fsf@HIDDEN> (Felician Nemeth's message of
 "Sun, 26 Jan 2020 20:34:05 +0100")
Message-ID: <87ftg0fnyb.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrfeefgddukecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehfvghlihgtihgrnhdrnhgvmhgvthhhsehgmhgrihhlrdgtohhm
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>> Now I tried to repeat this problem with eglot and got such backtrace:
> [...]
>
> Did you use the ELPA version or the git master?

The backtrace was from the ELPA version, but trying it
in the git master signals a different error:

Error in post-command-hook:
(error "[eglot] Can't guess mode to manage for ` *diff-syntax:...

> Having read your discussion I have a feeling that this issue affects
> more than just Eglot.  Nevertheless we plan a feature that postpones the
> activation of Eglot and this feature is somewhat similar to Stefan's
> first suggestion.  So if the only concern is Eglot, then this issue can
> be closed.

Since it will take much time when the fix in Emacs will appear in a released
version, a workaround needs to be added to Eglot immediately.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 28 Jan 2020 00:13:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 27 19:13:33 2020
Received: from localhost ([127.0.0.1]:59298 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iwEVZ-0001Xa-6D
	for submit <at> debbugs.gnu.org; Mon, 27 Jan 2020 19:13:33 -0500
Received: from anteater.elm.relay.mailchannels.net ([23.83.212.3]:2461)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1iwEVW-0001XR-PX
 for 39190 <at> debbugs.gnu.org; Mon, 27 Jan 2020 19:13:31 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 6C0886A2436;
 Tue, 28 Jan 2020 00:13:29 +0000 (UTC)
Received: from pdx1-sub0-mail-a37.g.dreamhost.com
 (100-96-11-27.trex.outbound.svc.cluster.local [100.96.11.27])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id E3D226A24CD;
 Tue, 28 Jan 2020 00:13:28 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a37.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); Tue, 28 Jan 2020 00:13:29 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Trade-Eyes: 4859f7ca5fd21206_1580170409232_682745170
X-MC-Loop-Signature: 1580170409232:4088676810
X-MC-Ingress-Time: 1580170409232
Received: from pdx1-sub0-mail-a37.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a37.g.dreamhost.com (Postfix) with ESMTP id 805C77FF2E;
 Mon, 27 Jan 2020 16:13:24 -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=Vpw7KiDi9rvJe6X1yMYYYFvmtdk=; b=
 ZbZno/ehOmvbZUabMet2g8Pdu5oB784GK2at7YD87uyiE8Mx0zmQ0uO7Ixl3Dkz9
 qiupH7ka+dvTHYQb9R1RFuM4ZSQc9u1/OnafZS16Pgg4PL3cVLoU2RN/oeSrtsls
 Bg1Sfe9NTisQ/vcUxiPi8u+mOThr+AfEl28xo7Q258U=
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@HIDDEN)
 by pdx1-sub0-mail-a37.g.dreamhost.com (Postfix) with ESMTPSA id C27B680401;
 Mon, 27 Jan 2020 16:13:22 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a37
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
 <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
Date: Tue, 28 Jan 2020 02:01:44 +0200
In-Reply-To: <jwvmuadosb3.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Fri, 24 Jan 2020 09:18:06 -0500")
Message-ID: <87imkwfnyv.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrfeefgddukecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehmtderredtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain

> Passing it down as an arg is indeed problematic.
> Maybe we should just add yet-another buffer-<foo>-filename and change
> the corresponding places to so that instead of consulting
>
>     buffer-file-name
>
> they consult
>
>     (or buffer-file-name buffer-<foo>-filename)
>
> Maybe this could also be used for things like `vc-revision-other-window`.

This requires more testing, but at least such patch
basically would look like this:


--=-=-=
Content-Type: text/x-diff
Content-Disposition: inline; filename=buffer-file-name-for-mode.patch

diff --git a/lisp/files.el b/lisp/files.el
index 683f4a8ce7..e2721f43fc 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3080,6 +3080,8 @@ magic-mode-regexp-match-limit
   "Upper limit on `magic-mode-alist' regexp matches.
 Also applies to `magic-fallback-mode-alist'.")
 
+(defvar-local buffer-file-name-for-mode nil)
+
 (defun set-auto-mode (&optional keep-mode-if-same)
   "Select major mode appropriate for current buffer.
 
@@ -3197,11 +3199,10 @@ set-auto-mode
 	  (set-auto-mode-0 done keep-mode-if-same)))
     ;; Next compare the filename against the entries in auto-mode-alist.
     (unless done
-      (if buffer-file-name
-	  (let ((name buffer-file-name)
-		(remote-id (file-remote-p buffer-file-name))
-		(case-insensitive-p (file-name-case-insensitive-p
-				     buffer-file-name)))
+      (if (or buffer-file-name buffer-file-name-for-mode)
+	  (let* ((name (or buffer-file-name buffer-file-name-for-mode))
+		 (remote-id (file-remote-p name))
+		 (case-insensitive-p (file-name-case-insensitive-p name)))
 	    ;; Remove backup-suffixes from file name.
 	    (setq name (file-name-sans-versions name))
 	    ;; Remove remote file name identification.
@@ -3459,6 +3460,8 @@ hack-local-variables-confirm
     (let ((name (cond (dir-name)
 		      (buffer-file-name
 		       (file-name-nondirectory buffer-file-name))
+		      (buffer-file-name-for-mode
+		       (file-name-nondirectory buffer-file-name-for-mode))
 		      ((concat "buffer " (buffer-name)))))
 	  (offer-save (and (eq enable-local-variables t)
 			   unsafe-vars))
diff --git a/lisp/gnus/mm-view.el b/lisp/gnus/mm-view.el
index a6be04e313..0c2b985956 100644
--- a/lisp/gnus/mm-view.el
+++ b/lisp/gnus/mm-view.el
@@ -482,7 +482,7 @@ mm-display-inline-fontify
         ;; aren't a problem any more.  So we could probably get rid of this
         ;; setting now, but it seems harmless and potentially still useful.
 	(set (make-local-variable 'font-lock-mode-hook) nil)
-        (setq buffer-file-name (mm-handle-filename handle))
+        (setq buffer-file-name-for-mode (mm-handle-filename handle))
 	(with-demoted-errors
 	    (if mode
                 (save-window-excursion
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 1a34456340..4290eeb66a 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1391,7 +1391,7 @@ xref--collect-matches
           (insert-file-contents file nil 0 200)
           ;; Can't (setq-local delay-mode-hooks t) because of
           ;; bug#23272, but the performance penalty seems minimal.
-          (let ((buffer-file-name file)
+          (let ((buffer-file-name-for-mode file)
                 (inhibit-message t)
                 message-log-max)
             (ignore-errors
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 2dbab80208..cff0a5a103 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -2718,7 +2718,7 @@ diff-syntax-fontify-props
     ;; temp buffer.
     (cl-assert (null buffer-file-name))
     (let ((enable-local-variables :safe) ;; to find `mode:'
-          (buffer-file-name file))
+          (buffer-file-name-for-mode file))
       (set-auto-mode)
       ;; FIXME: Is this really worth the trouble?
       (when (and (fboundp 'generic-mode-find-file-hook)
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index f64b6c0631..79f49ab68b 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -2097,7 +2099,7 @@ vc-find-revision-no-save
                 (if buffer
                     ;; For non-interactive, skip any questions
                     (let ((enable-local-variables :safe) ;; to find `mode:'
-                          (buffer-file-name file))
+                          (buffer-file-name-for-mode file))
                       (ignore-errors (set-auto-mode)))
                   (normal-mode))
 	        (set-buffer-modified-p nil)

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 26 Jan 2020 19:34:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 26 14:34:15 2020
Received: from localhost ([127.0.0.1]:57522 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ivnfj-0004KT-4R
	for submit <at> debbugs.gnu.org; Sun, 26 Jan 2020 14:34:15 -0500
Received: from mail-wr1-f42.google.com ([209.85.221.42]:39301)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felician.nemeth@HIDDEN>) id 1ivnfh-0004KG-Fs
 for 39190 <at> debbugs.gnu.org; Sun, 26 Jan 2020 14:34:13 -0500
Received: by mail-wr1-f42.google.com with SMTP id y11so8361057wrt.6
 for <39190 <at> debbugs.gnu.org>; Sun, 26 Jan 2020 11:34:13 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:in-reply-to:references:user-agent:face:date
 :message-id:mime-version;
 bh=AXzlrt4wH27ghAbsFSE0mQ0l8caoTAjbroz6O8XunKY=;
 b=nBsnWGVRyhjMkgbajbBhBRKFhm5A9NA6ONenQckgl3/wGXyfI4TBR5gdH7w6LjeoQg
 i/lnN8pK1ZCDlPQ68WE+4YL+a+Zi3a/WYbdPUKMHf1CjqWqedA9GJlG1FpHj3kfJK9Bi
 0RSPqojxXfCU/pRaAn5VW3bQyKgHZioZTh5Fos0I6Imvi9khhLTmbBI3LyPiGy2XF7IX
 GYrygEt+SdL3Rkk5RN+hiE2XFGjriHZlcrx04tc4bx1XflXu09YU7ppRN9b3hrHp4sGE
 qzVLr6b7i1hW4ygAxPMPK/TRyigm8t1YvY2hOCpPiTi/EvGK1DTofFeSpe6g4h6jbgmf
 FdHw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:in-reply-to:references
 :user-agent:face:date:message-id:mime-version;
 bh=AXzlrt4wH27ghAbsFSE0mQ0l8caoTAjbroz6O8XunKY=;
 b=Sw5Kaz4rxEbQ+sJvBODBmJNFaEB1oi/aVt5W8zViyRg6mgYkAOB+AlS1v89TU2MJyD
 2YWghXaYgkyYR66bx3LPwk8AU5JBTbc85IuNiQXeufi32LZ4hsWrCFB1pN2L1rzh6k/V
 2Bg3FTHuDPoGr4n1PmBT+Q2gE0K7Mvx/jkBMQrA7+OMPlr6dKeZadXxekKStmQw6wIN4
 8PQgMCRzQzQwELYAu5dqrkvIEWkopUYj5IFpmW5L9/VY3K9aNXBdrgsUyYqEhOxEVDbY
 0wx3DvNQBxB6w6VbLHpurU1CeetDe10K3zA+ZP0yhmHSoIS8TzVPBd+beUWJ1OCH1D/L
 R4+Q==
X-Gm-Message-State: APjAAAXx4A1raQgDOERXtN6W491J0R0B8+FyGT5aWy0A+M5OvfSSbLV2
 ZUo+GTWEE49x5/nXXF0ihpFo/QTk
X-Google-Smtp-Source: APXvYqz3qZPnG7ERq3uvWs1B1S2k49nHRdbv6UNa/BV8hSeSDIlGsg9y+3sYPPnetJBqoWEBAtxUIQ==
X-Received: by 2002:a5d:4a8c:: with SMTP id o12mr16511063wrq.43.1580067247407; 
 Sun, 26 Jan 2020 11:34:07 -0800 (PST)
Received: from betli.gmail.com (catv-178-48-82-41.catv.broadband.hu.
 [178.48.82.41])
 by smtp.gmail.com with ESMTPSA id n16sm17162310wro.88.2020.01.26.11.34.05
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 26 Jan 2020 11:34:06 -0800 (PST)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#39190: 28.0.50;
 two buffers with same buffer-file-name (diff-syntax-fontify-props)
In-Reply-To: <875zh13e5d.fsf@HIDDEN> (Juri Linkov's message of "Fri, 
 24 Jan 2020 02:13:18 +0200")
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAABGdBTUEAALGPC/xhBQAAACBj
 SFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAADFBMVEX5+fmhoaEwMDD/
 ///TMNVWAAAAAWJLR0QDEQxM8gAAAAlwSFlzAAAPEgAADxIBIZvyMwAAAAd0SU1FB+AICBUfHgLs
 gGoAAAGXSURBVCjPRdK/b5tAFAfw753gBEwM2ApMbuVIqf+Ko0qiyhOu4sj2xJBYMn/FUdX7UUUZ
 OjHgyvf+yj6IcW6Bjx53934ADEvs8bmEr8UVoTYTOyJO9KoYsVofN8kILdbeJ8Li6YpZWop4xOK0
 VdfIoXmkHn5/5D7/Ts/8THacSqnkKTcMTxgUkVzFnEIRTKwwYYSCvzfg16f0i8YApW/XG/Pm8R49
 dXjxKmRnxv3OwooQWcv4RUYem1fsNe/WU63uk7AmYxk78y32/ee2tZB4fO+WcZ7lnIGEolXW1EGw
 LfkSuQ0XTgRefgNlfNwRNV6QhBxJ8JNxTMUPyBqTd0bjaAP5G7NJRU39z80hLOZTjqB7K3tEEFSj
 aEsuQew6qBxxyhHjVUR7H7NpC9iHJZGLMCEuweqAqE1BHbfK2oRIz9EHYA/+wiFWru9smeVfuWNZ
 2+NFtX80UA1TvJNdytM4DwO4kY7bJz8Qcd0G0ceslZGkkeoBsjUHwF1+jjM3XHaXEZ7mGLfwPFO+
 RV9QLY2iEdmDo78D/gNPaXVYqd+pyQAAACV0RVh0ZGF0ZTpjcmVhdGUAMjAxNi0wOC0wOFQyMzoz
 MDoyOCswMjowMGy/yHYAAAAldEVYdGRhdGU6bW9kaWZ5ADIwMTYtMDgtMDhUMjM6MzA6MjgrMDI6
 MDAd4nDKAAAAAElFTkSuQmCC
Date: Sun, 26 Jan 2020 20:34:05 +0100
Message-ID: <87h80iqafm.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

> Now I tried to repeat this problem with eglot and got such backtrace:
[...]

Did you use the ELPA version or the git master?

> Felician, do you think that the eglot package should take more care
> to protect itself, so this report could be closed?

Having read your discussion I have a feeling that this issue affects
more than just Eglot.  Nevertheless we plan a feature that postpones the
activation of Eglot and this feature is somewhat similar to Stefan's
first suggestion.  So if the only concern is Eglot, then this issue can
be closed.

I haven't completely understood Stefan's second suggestion of
buffer-<foo>-filename, but if this means temporary diff buffers can be
detected similarly how save-some-buffers detects indirect buffers with
buffer-base-buffer, then I support the idea.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 24 Jan 2020 14:18:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Jan 24 09:18:23 2020
Received: from localhost ([127.0.0.1]:53590 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iuzmx-0002A7-3l
	for submit <at> debbugs.gnu.org; Fri, 24 Jan 2020 09:18:23 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:64173)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1iuzmv-00029u-8V
 for 39190 <at> debbugs.gnu.org; Fri, 24 Jan 2020 09:18:21 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id B12C544098B;
 Fri, 24 Jan 2020 09:18:15 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 2C525440987;
 Fri, 24 Jan 2020 09:18:14 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1579875494;
 bh=taqZVQTkTEkiZxp3LtZG16VWAJXcNGlABdVYbACFo1E=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=E/biZE0A7sIOOIpc4MdclPY0bm2kXqKXP/l7C5oJKSbuRoaaCYHLxFhFTvX7FqPGZ
 H+FHET/csACyGLgt/qi++P7K9hkm+SJVqiBHG0RXSolinqZaGAo5LFGGzL2VzpfuaH
 AEkfrKfgRgu/VdI8psEZhL/ymIpIQ7RkjSC/PtedPPWrfijYx8kVxyFqG1/D5Ur89I
 zrf4Yf6baTB1TR9zEar5laHjcgK+CAQ1sSle69S71CW8+LMXol9PJsVYu5O4z+EhPH
 htYymfbDNU3Ju4Hurr5QRmpP3yKZhi8UKtoRsM9izc2vGS34yo4ykVzi09BdfoXsxF
 UfGZhmw9N2mRg==
Received: from pastel (69-196-141-61.dsl.teksavvy.com [69.196.141.61])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id CBC3E120CD4;
 Fri, 24 Jan 2020 09:18:13 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwvmuadosb3.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
 <875zh13e5d.fsf@HIDDEN>
Date: Fri, 24 Jan 2020 09:18:06 -0500
In-Reply-To: <875zh13e5d.fsf@HIDDEN> (Juri Linkov's message of "Fri, 
 24 Jan 2020 02:13:18 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

>> Yes, it's definitely borderline.  I remember feeling a bit uneasy about
>> it at the time.  Maybe a better fix would be to be able to pass the
>> file-name to `set-auto-mode` (or some new function created for that
>> purpose) as an argument (instead of passing it via dynamic scoping in
>> `buffer-file-name`).
>
> The problem is that the right value of buffer-file-name is required
> also by other more deep functions that set local variables like
> dir-locals-collect-variables.

Passing it down as an arg is indeed problematic.
Maybe we should just add yet-another buffer-<foo>-filename and change
the corresponding places to so that instead of consulting

    buffer-file-name

they consult

    (or buffer-file-name buffer-<foo>-filename)

Maybe this could also be used for things like `vc-revision-other-window`.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 24 Jan 2020 00:15:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jan 23 19:15:50 2020
Received: from localhost ([127.0.0.1]:53326 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iumda-0003AY-Cn
	for submit <at> debbugs.gnu.org; Thu, 23 Jan 2020 19:15:50 -0500
Received: from egyptian.birch.relay.mailchannels.net ([23.83.209.56]:51173)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1iumdY-0003AP-4D
 for 39190 <at> debbugs.gnu.org; Thu, 23 Jan 2020 19:15:49 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id BB8056A1E59;
 Fri, 24 Jan 2020 00:15:46 +0000 (UTC)
Received: from pdx1-sub0-mail-a9.g.dreamhost.com
 (100-96-89-22.trex.outbound.svc.cluster.local [100.96.89.22])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 0A5A16A0C10;
 Fri, 24 Jan 2020 00:15:46 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a9.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); Fri, 24 Jan 2020 00:15:46 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Arch-Relation: 7455ad1e4dcc18c1_1579824946280_1926449678
X-MC-Loop-Signature: 1579824946280:3302374372
X-MC-Ingress-Time: 1579824946278
Received: from pdx1-sub0-mail-a9.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a9.g.dreamhost.com (Postfix) with ESMTP id 1D09D7EFAA;
 Thu, 23 Jan 2020 16:15:43 -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=sjqaAKGObz+zqoysSD8V+uIJDRk=; b=
 yFmES99Qatd53R5TkoAewc3GYJklhmSELJq9MLYVwJekhEhd/68/dW3yYK4iLscf
 WtqGlUFJjdwdm+SaQbfSdsHhAl549RoT1T8h4zkCDJfVYTAIcWcIfNnoymGzEnKh
 yigiiCNL1Mob0iflOwcvLOERIJBqCciPEmmUDPUte/o=
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@HIDDEN)
 by pdx1-sub0-mail-a9.g.dreamhost.com (Postfix) with ESMTPSA id 51EC47ED5E;
 Thu, 23 Jan 2020 16:15:39 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a9
From: Juri Linkov <juri@HIDDEN>
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
 <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
Date: Fri, 24 Jan 2020 02:13:18 +0200
In-Reply-To: <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN> (Stefan Monnier's message
 of "Mon, 20 Jan 2020 18:34:34 -0500")
Message-ID: <875zh13e5d.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrvdefgddtjecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddthedruddvieenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdphhgvlhhopehmrghilhdrjhhurhhtrgdrohhrghdpihhnvghtpeeluddruddvledruddthedruddviedprhgvthhurhhnqdhprghthheplfhurhhiucfnihhnkhhovhcuoehjuhhriheslhhinhhkohhvrdhnvghtqedpmhgrihhlfhhrohhmpehjuhhriheslhhinhhkohhvrdhnvghtpdhnrhgtphhtthhopehmohhnnhhivghrsehirhhordhumhhonhhtrhgvrghlrdgtrg
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Now I tried to repeat this problem with eglot and got such backtrace:

Debugger entered--Lisp error: (wrong-type-argument arrayp nil)
  substring(nil 0 1)
  file-truename(nil)
  eglot--path-to-uri(nil)
  eglot--TextDocumentIdentifier()
  eglot--signal-textDocument/didClose()
  kill-buffer(#<buffer  *temp*-492063>)
  (and (buffer-name temp-buffer) (kill-buffer temp-buffer))
  (unwind-protect (progn (insert text) (diff-syntax-fontify-props ...
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert text) (diff-syntax-fontify-props ...
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (insert text) ...
  (cond ((and file diff-default-directory ...) ...) ...)
  (let ((file (car (diff-hunk-file-names old)))) ...)
  (or (if (and diff-vc-backend (not (eq diff-font-lock-syntax 'hunk-only))) ...) ...)
  (let* ((hunk (buffer-substring-no-properties beg end)) ...) ...
  diff-syntax-fontify-hunk(10530 14909 t)
  diff-syntax-fontify(10530 14909)
  #f(compiled-function (beg end) #<bytecode 0x1cb64d70b7d4e0e5>)(10530 14909)
  diff--iterate-hunks(12505 #f(compiled-function (beg end) #<bytecode 0x1cb64d70b7d4e0e5>))
  diff--font-lock-syntax(12505)
  font-lock-fontify-keywords-region(11965 12505 nil)
  font-lock-default-fontify-region(11980 12480 nil)
  font-lock-fontify-region(11980 12480)
  #f(compiled-function (fun) #<bytecode 0x303b13b2afd8864>)(font-lock-fontify-region)
  run-hook-wrapped(#f(compiled-function (fun) #<bytecode 0x303b13b2afd8864>) font-lock-fontify-region)
  jit-lock--run-functions(11980 12480)
  jit-lock-fontify-now(11980 12480)
  jit-lock-function(11980)
  redisplay_internal\ \(C\ function\)()

>> Stefan, do you think diff-syntax-fontify-props should let-bind
>> after-change-major-mode-hook to nil to not allow running this hook
>> on an internal buffer.
>
> No, that's definitely not the right fix.  It's at best a weak
> workaround, but it won't handle the case where the code that depends on
> `buffer-file-name` is placed on `foo-mode-hook` rather than on
> `after-change-major-mode-hook`.

In fact, eglot recommends adding such hooks:

  (add-hook 'foo-mode-hook 'eglot-ensure)

where eglot-ensure relies on buffer-file-name, so such fix is not possible indeed.

>>> If I read correctly, diff-syntax-fontify-props sets buffer-file-name of
>>> a temporary buffer to an existing one.  This is not necessarily a bug,
>>> but it definitely looks strange that we have two buffers with different
>>> contents and the same buffer-file-name.
>
> Yes, it's definitely borderline.  I remember feeling a bit uneasy about
> it at the time.  Maybe a better fix would be to be able to pass the
> file-name to `set-auto-mode` (or some new function created for that
> purpose) as an argument (instead of passing it via dynamic scoping in
> `buffer-file-name`).

The problem is that the right value of buffer-file-name is required
also by other more deep functions that set local variables like
dir-locals-collect-variables.

> BTW, I see somewhat similar code in `xref--collect-matches`, so maybe
> there's a need for a more general solution (haven't looked any further,
> but I'd be surprised if there aren't other cases).

Another example is mm-display-inline-fontify in gnus/mm-view.el,
so the problem is more widespread, and perhaps not much could be done
more than already using temporary buffers as an indication
for external packages that these buffers are for internal use only.

>> Or it's the responsibility of the eglot package to check for the
>> leading space in the buffer name when its after-change-major-mode-hook
>> is called?
>
> The eglot package could protect itself from such things by making its
> `after-change-major-mode-hook` just add the buffer to a global var, and
> then process this global var in `post-command-hook` or in a timer.

Felician, do you think that the eglot package should take more care
to protect itself, so this report could be closed?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 20 Jan 2020 23:34:47 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 20 18:34:47 2020
Received: from localhost ([127.0.0.1]:46276 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1itgZD-0000a7-CM
	for submit <at> debbugs.gnu.org; Mon, 20 Jan 2020 18:34:47 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:8986)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1itgZA-0000Zr-UG
 for 39190 <at> debbugs.gnu.org; Mon, 20 Jan 2020 18:34:45 -0500
Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 547B144083D;
 Mon, 20 Jan 2020 18:34:37 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 13862440829;
 Mon, 20 Jan 2020 18:34:36 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1579563276;
 bh=xfZjbosy0aYTVqonqOZpC8jxpxB4I48n6zYKxmjXRZ4=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=fWNoL6n6f4CJep9r8Lcw3PAkUsK+oSw0oW/joB6bUJaLJLVwG7lYmYPu0xHDXyJ4G
 BWJWQeQjN3jZk9+s2MGDEInVtAQBm6KVohjd50CjhcUsxFzb0wLShdhZOSFbI5uEt9
 LL+cEZWXi+ez5R2dO6ajRFOCSn66C8LIiTk7Hk3r6sqDqJlrJ3HSCjm6qiQFT6iyV2
 z+rJVjwFejDDq4J7rqlaHUG0+e85eXUNIFogq2WtAoDyQ8wqdMOpRxC/b6ROhQCGW6
 5TDki8zBaypN54Bm+IBlb8n74miJhDLV2YE1spsds+WQG0oD8WEkT3TiVqE2rLIosw
 mwKR29HJt1XXA==
Received: from alfajor (unknown [45.72.156.100])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id CE2A7120748;
 Mon, 20 Jan 2020 18:34:35 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Juri Linkov <juri@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Message-ID: <jwvy2u17lwo.fsf-monnier+emacs@HIDDEN>
References: <875zh73dg8.fsf@HIDDEN> <8736c921s6.fsf@HIDDEN>
Date: Mon, 20 Jan 2020 18:34:34 -0500
In-Reply-To: <8736c921s6.fsf@HIDDEN> (Juri Linkov's message of "Tue, 
 21 Jan 2020 00:56:41 +0200")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL 0.015 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Felician Nemeth <felician.nemeth@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Stefan, do you think diff-syntax-fontify-props should let-bind
> after-change-major-mode-hook to nil to not allow running this hook
> on an internal buffer.

No, that's definitely not the right fix.  It's at best a weak
workaround, but it won't handle the case where the code that depends on
`buffer-file-name` is placed on `foo-mode-hook` rather than on
`after-change-major-mode-hook`.

>> If I read correctly, diff-syntax-fontify-props sets buffer-file-name of
>> a temporary buffer to an existing one.  This is not necessarily a bug,
>> but it definitely looks strange that we have two buffers with different
>> contents and the same buffer-file-name.

Yes, it's definitely borderline.  I remember feeling a bit uneasy about
it at the time.  Maybe a better fix would be to be able to pass the
file-name to `set-auto-mode` (or some new function created for that
purpose) as an argument (instead of passing it via dynamic scoping in
`buffer-file-name`).

BTW, I see somewhat similar code in `xref--collect-matches`, so maybe
there's a need for a more general solution (haven't looked any further,
but I'd be surprised if there aren't other cases).

> Or it's the responsibility of the eglot package to check for the
> leading space in the buffer name when its after-change-major-mode-hook
> is called?

The eglot package could protect itself from such things by making its
`after-change-major-mode-hook` just add the buffer to a global var, and
then process this global var in `post-command-hook` or in a timer.


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at 39190 <at> debbugs.gnu.org:


Received: (at 39190) by debbugs.gnu.org; 20 Jan 2020 23:12:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jan 20 18:12:32 2020
Received: from localhost ([127.0.0.1]:46246 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1itgDg-0006UT-5d
	for submit <at> debbugs.gnu.org; Mon, 20 Jan 2020 18:12:32 -0500
Received: from antelope.elm.relay.mailchannels.net ([23.83.212.4]:37992)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <juri@HIDDEN>) id 1itgDe-0006UK-R6
 for 39190 <at> debbugs.gnu.org; Mon, 20 Jan 2020 18:12:31 -0500
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from relay.mailchannels.net (localhost [127.0.0.1])
 by relay.mailchannels.net (Postfix) with ESMTP id 577635A121B;
 Mon, 20 Jan 2020 23:12:29 +0000 (UTC)
Received: from pdx1-sub0-mail-a67.g.dreamhost.com
 (100-96-206-166.trex.outbound.svc.cluster.local [100.96.206.166])
 (Authenticated sender: dreamhost)
 by relay.mailchannels.net (Postfix) with ESMTPA id 7A8385A12D2;
 Mon, 20 Jan 2020 23:12:28 +0000 (UTC)
X-Sender-Id: dreamhost|x-authsender|jurta@HIDDEN
Received: from pdx1-sub0-mail-a67.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); Mon, 20 Jan 2020 23:12:29 +0000
X-MC-Relay: Neutral
X-MailChannels-SenderId: dreamhost|x-authsender|jurta@HIDDEN
X-MailChannels-Auth-Id: dreamhost
X-Lettuce-Scare: 3f66653227838088_1579561949013_2818961259
X-MC-Loop-Signature: 1579561949013:4082896156
X-MC-Ingress-Time: 1579561949013
Received: from pdx1-sub0-mail-a67.g.dreamhost.com (localhost [127.0.0.1])
 by pdx1-sub0-mail-a67.g.dreamhost.com (Postfix) with ESMTP id 4478581DBD;
 Mon, 20 Jan 2020 15:12:23 -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=ANqO1dezZXK6hAvFq5nA+Ii1G+k=; b=
 MouMN1srN1zmupGO8yTUY8BAR/tG2WsVEsMiqPqipf/yX2TtwKY5E1JCBKrxFKkB
 WBF8sFchDEJtT6PIGSt38QukF0x3ElaTZYp0fpVwrYXEy0ZI6txU5Zr3iHBQO4ao
 GTi60R3mlLxtStt0O3xDjQMwpINC9QvO/zTkNsGvD6U=
Received: from mail.jurta.org (m91-129-103-201.cust.tele2.ee [91.129.103.201])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256
 bits)) (No client certificate requested)
 (Authenticated sender: jurta@HIDDEN)
 by pdx1-sub0-mail-a67.g.dreamhost.com (Postfix) with ESMTPSA id 3473081DA9;
 Mon, 20 Jan 2020 15:12:20 -0800 (PST)
X-DH-BACKEND: pdx1-sub0-mail-a67
From: Juri Linkov <juri@HIDDEN>
To: Felician Nemeth <felician.nemeth@HIDDEN>
Subject: Re: bug#39190: 28.0.50; two buffers with same buffer-file-name
 (diff-syntax-fontify-props)
Organization: LINKOV.NET
References: <875zh73dg8.fsf@HIDDEN>
Date: Tue, 21 Jan 2020 00:56:41 +0200
In-Reply-To: <875zh73dg8.fsf@HIDDEN> (Felician Nemeth's message of
 "Sun, 19 Jan 2020 12:14:47 +0100")
Message-ID: <8736c921s6.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.60 (x86_64-pc-linux-gnu)
MIME-Version: 1.0
Content-Type: text/plain
X-VR-OUT-STATUS: OK
X-VR-OUT-SCORE: -100
X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedugedrudejgddtgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucggtfgfnhhsuhgsshgtrhhisggvpdfftffgtefojffquffvnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpefhvffuohhfffgjkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecuffhomhgrihhnpehgihhthhhusgdrtghomhenucfkphepledurdduvdelrddutdefrddvtddunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrddutdefrddvtddupdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepfhgvlhhitghirghnrdhnvghmvghthhesghhmrghilhdrtghomh
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 39190
Cc: 39190 <at> debbugs.gnu.org, Stefan Monnier <monnier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

X-Debbugs-CC: Stefan Monnier <monnier@HIDDEN>

Stefan, do you think diff-syntax-fontify-props should let-bind
after-change-major-mode-hook to nil to not allow running this hook
on an internal buffer.  Or it's the responsibility of the eglot package
to check for the leading space in the buffer name when its
after-change-major-mode-hook is called?

> If I read correctly, diff-syntax-fontify-props sets buffer-file-name of
> a temporary buffer to an existing one.  This is not necessarily a bug,
> but it definitely looks strange that we have two buffers with different
> contents and the same buffer-file-name.
>
> Eglot (in ELPA) runs into problems because of this
> (https://github.com/joaotavora/eglot/pull/233).
>
> Is there a recommended way to check in an after-change-major-mode-hook
> whether the current buffer is or isn't a temporary diff buffer?  For
> example, to check if first character of buffer-name is space.




Information forwarded to monnier@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 19 Jan 2020 11:14:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Jan 19 06:14:57 2020
Received: from localhost ([127.0.0.1]:42704 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1it8Xg-0002zl-R1
	for submit <at> debbugs.gnu.org; Sun, 19 Jan 2020 06:14:57 -0500
Received: from lists.gnu.org ([209.51.188.17]:44429)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <felician.nemeth@HIDDEN>) id 1it8Xe-0002zd-Gt
 for submit <at> debbugs.gnu.org; Sun, 19 Jan 2020 06:14:55 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10]:53106)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <felician.nemeth@HIDDEN>) id 1it8Xd-0006gT-A7
 for bug-gnu-emacs@HIDDEN; Sun, 19 Jan 2020 06:14:54 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,FREEMAIL_FROM,
 URIBL_BLOCKED autolearn=disabled version=3.3.2
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <felician.nemeth@HIDDEN>) id 1it8Xc-0001Us-1Z
 for bug-gnu-emacs@HIDDEN; Sun, 19 Jan 2020 06:14:53 -0500
Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]:39741)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
 (Exim 4.71) (envelope-from <felician.nemeth@HIDDEN>)
 id 1it8Xb-0001U5-SJ
 for bug-gnu-emacs@HIDDEN; Sun, 19 Jan 2020 06:14:51 -0500
Received: by mail-wr1-x443.google.com with SMTP id y11so26628211wrt.6
 for <bug-gnu-emacs@HIDDEN>; Sun, 19 Jan 2020 03:14:51 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:subject:date:message-id:user-agent:face:mime-version;
 bh=jpxzev7NaXT38J1z1CiWWq7NOBFEWJZFW4TCz1oFoVI=;
 b=AZ0cyF/iBKtw+xFW/tZ3LJNRxkCXy6mSDox+64+09BYnl3ofFtqnSsft2/fOUJZS6j
 hrRGv+36/eT/WMZlyiK7rJErmqNtG8+FN+sGJfwRKCwO0WWuTr161vdjL//OfC6sBnW4
 IKwhSvWt+3y+HgQS87A+8oqIdEvXdYrwwyP3G8q8m411Q742t/wUCKYHcVsuZ28tQaFQ
 K5oSPUjsbZJFeg7FuwoqfCAdAOS9DkF90LGCbcmyxsj0/DpRXQvCd/wbUu5DtNr/Y9cP
 U98hZTdvdjSQHCsxmgT68gHHJaqcXhzkouiAZ0G0Jbes9m767mFGRYXEreQ6/nlapw4m
 Fx7w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:subject:date:message-id:user-agent:face
 :mime-version;
 bh=jpxzev7NaXT38J1z1CiWWq7NOBFEWJZFW4TCz1oFoVI=;
 b=VbjPv7Iv7LNQJt55C2lZzL5am4hV3VhQ0KyvxPND+mrMylJvxD/pmJuZxC9ktLs4f2
 0jaGkbwuhaPyXgZ375osooPu8bUPPPg8VHmbDFlruJAdIEUyRIyokZIO+kh9p13xGiui
 QwACihOawDg7TSnBxjWfAyUHRXnK+gvwT/M3jbP1gqbQ5apNyQne6rPHPiWyIhNRRslG
 eN5K+4KnRs1gqq3Ct8WSJ6JRwbge/p9ph7BYcpbzZpPpvlfXchLXkO7hopEB4rEqxo5M
 b+XjYyzMWjNE/DM+TVV40gFucXhwBPEqYHPKdhvAgHv+CJqySf810PnQr5M6v9UPZRzU
 nUNA==
X-Gm-Message-State: APjAAAXyRyMPLszblIRHH9ZcYmTy1wfIMitxCzIUN42el8w1re+r9bfm
 nC/58IjIDMY5Aw5wGi68+i9pHDgH
X-Google-Smtp-Source: APXvYqyskqI/IdvnXYW+oWBCjG3dEIYJEXXgIqYTB3Mx1ZTeZM4Rt0RSqAdNF9OUbas/l6RKYdFifA==
X-Received: by 2002:adf:e984:: with SMTP id h4mr13335334wrm.275.1579432490168; 
 Sun, 19 Jan 2020 03:14:50 -0800 (PST)
Received: from betli.gmail.com (catv-178-48-82-41.catv.broadband.hu.
 [178.48.82.41])
 by smtp.gmail.com with ESMTPSA id f127sm4251032wma.4.2020.01.19.03.14.48
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Sun, 19 Jan 2020 03:14:49 -0800 (PST)
From: Felician Nemeth <felician.nemeth@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 28.0.50;
 two buffers with same buffer-file-name (diff-syntax-fontify-props)
Date: Sun, 19 Jan 2020 12:14:47 +0100
Message-ID: <875zh73dg8.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)
Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAFVBMVEU2EgDVmFNHKAa4dz4q
 AwCDUSH2zWrE61tmAAACeklEQVQ4jU2UwY7jIAyGEZN5ABSFc9Ytcx6K6DmqmHsD8tyZKrz/I+xv
 yI6WKlHlj982tomiVckiWrUrgRU5jlqMpJKCkch5W419DQAiQGHDxdrWmm0/2kXCApiUmrZLq20s
 cjexq3VL25QuxjY7wOcJVEpb+jLeGLAK+OMyaa1hx9rFbkwHFWBVA2y8w1wHaLE7GuDdw5cEuOM5
 SLIdrpwBkN0ezwI7nYoiilqthbcYc89KgC5+NnaOHGbZz0T6BCEgOLJ0vmYXuNdPAIXgDZJhF2Yu
 fjnPNwAsoUTUN/P8q3AAyz4zB/xmifEfiIbvS4jh7b7QqZiSm4MJC5kXNpCRaOsoyQXAMN2XCJfs
 j94NKfo7ACKUEgKE3y+Sg4jibUZ1A0jgYpxtvYMC3gHaHPq6x32ACeALIZoZxB+l9VrRNIA1ncRg
 wwC8pvQIvYO+a2yt3VXMVyli6L0VV6aOrJa4CpilVQA+eHt0xavk61akih5BUMay/0BAqu783C5h
 FifY/3QsAIoWYk6PgpwAzLI652+96e2IfN2cF+BD1uT23F21Ghh5OUl4RlO15oh5A2iv+Zk2wsjZ
 2DtB5Sm3A4P0+kyb2vs4iEW7G9ohoN3Stl2kVat6MCkXldo6OKaE8P6GhmrKKxWZXQH1iklhhn+d
 iVeNf6mDdkV0ltFwApRbp+kXSGBFHGV2aPqnIIyQyzhD5n47khqKI08bIapcas4O+hPkct20NAEv
 ALRuZFUp3PrnQSAm+4lTdHCsYYZ/nGqQrM5z3NS3zefFxkfFPRFbsjpIfbTlvF3ibpVZQ9nzqv60
 F/KXSRLJ1AGappJulZll70N/qz6EfwEOCdYOuTHAzAAAAABJRU5ErkJggg==
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
 recognized.
X-Received-From: 2a00:1450:4864:20::443
X-Spam-Score: 0.7 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

If I read correctly, diff-syntax-fontify-props sets buffer-file-name of
a temporary buffer to an existing one.  This is not necessarily a bug,
but it definitely looks strange that we have two buffers with different
contents and the same buffer-file-name.

Eglot (in ELPA) runs into problems because of this
(https://github.com/joaotavora/eglot/pull/233).

Is there a recommended way to check in an after-change-major-mode-hook
whether the current buffer is or isn't a temporary diff buffer?  For
example, to check if first character of buffer-name is space.

Thank you.

In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.5, cairo version 1.16.0)
 of 2020-01-19 built on betli
Repository revision: 35a1a007bb7506c72ee6d9757a79014c679e7bae
Repository branch: emacs-27
Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
System Description: Debian GNU/Linux 10 (buster)





Acknowledgement sent to Felician Nemeth <felician.nemeth@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#39190; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 20 Feb 2020 01:00:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.