From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#39190: 28.0.50; two buffers with same buffer-file-name (diff-syntax-fontify-props) Date: Wed, 29 Jan 2020 16:33:31 -0500 Message-ID: References: <875zh73dg8.fsf@betli.tmit.bme.hu> <8736c921s6.fsf@mail.linkov.net> <875zh13e5d.fsf@mail.linkov.net> <87imkwfnyv.fsf@mail.linkov.net> <83blqontlu.fsf@gnu.org> <837e1bo499.fsf@gnu.org> <83y2trmitb.fsf@gnu.org> <83tv4embit.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="27433"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: 39190@debbugs.gnu.org, felician.nemeth@gmail.com, juri@linkov.net To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 29 22:42:35 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iwv6Y-000743-Lh for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jan 2020 22:42:34 +0100 Original-Received: from localhost ([::1]:51868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwv6X-0000ui-Nw for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jan 2020 16:42:33 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34570) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwuyJ-0005SJ-2V for bug-gnu-emacs@gnu.org; Wed, 29 Jan 2020 16:34:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iwuyH-0004ZP-WF for bug-gnu-emacs@gnu.org; Wed, 29 Jan 2020 16:34:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56925) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iwuyH-0004ZB-SQ for bug-gnu-emacs@gnu.org; Wed, 29 Jan 2020 16:34:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iwuyH-0000de-Pu for bug-gnu-emacs@gnu.org; Wed, 29 Jan 2020 16:34:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 29 Jan 2020 21:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39190 X-GNU-PR-Package: emacs Original-Received: via spool by 39190-submit@debbugs.gnu.org id=B39190.15803336282435 (code B ref 39190); Wed, 29 Jan 2020 21:34:01 +0000 Original-Received: (at 39190) by debbugs.gnu.org; 29 Jan 2020 21:33:48 +0000 Original-Received: from localhost ([127.0.0.1]:34665 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwuy3-0000dC-Sw for submit@debbugs.gnu.org; Wed, 29 Jan 2020 16:33:48 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:39131) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwuy2-0000cz-9E for 39190@debbugs.gnu.org; Wed, 29 Jan 2020 16:33:46 -0500 Original-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) Original-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== Original-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) In-Reply-To: <83tv4embit.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 29 Jan 2020 19:13:14 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:175413 Archived-At: > 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