From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#39190: 28.0.50; two buffers with same buffer-file-name (diff-syntax-fontify-props) Date: Thu, 30 Jan 2020 16:17:54 +0200 Message-ID: <83imktm3jh.fsf@gnu.org> References: <875zh73dg8.fsf@betli.tmit.bme.hu> <8736c921s6.fsf@mail.linkov.net> <875zh13e5d.fsf@mail.linkov.net> <87imkwfnyv.fsf@mail.linkov.net> <83blqontlu.fsf@gnu.org> <837e1bo499.fsf@gnu.org> <83y2trmitb.fsf@gnu.org> <83tv4embit.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="110193"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 39190@debbugs.gnu.org, felician.nemeth@gmail.com, juri@linkov.net To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 30 15:19:15 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 1ixAf4-000Sbt-VG for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 Jan 2020 15:19:14 +0100 Original-Received: from localhost ([::1]:33208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixAf3-0005Bk-TX for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 30 Jan 2020 09:19:13 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32963) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ixAet-00057M-JX for bug-gnu-emacs@gnu.org; Thu, 30 Jan 2020 09:19:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ixAes-0006fF-Fv for bug-gnu-emacs@gnu.org; Thu, 30 Jan 2020 09:19:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57359) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ixAes-0006fA-CE for bug-gnu-emacs@gnu.org; Thu, 30 Jan 2020 09:19:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ixAes-0005Ry-7y for bug-gnu-emacs@gnu.org; Thu, 30 Jan 2020 09:19:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 30 Jan 2020 14:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 39190 X-GNU-PR-Package: emacs Original-Received: via spool by 39190-submit@debbugs.gnu.org id=B39190.158039388220859 (code B ref 39190); Thu, 30 Jan 2020 14:19:02 +0000 Original-Received: (at 39190) by debbugs.gnu.org; 30 Jan 2020 14:18:02 +0000 Original-Received: from localhost ([127.0.0.1]:35099 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ixAdt-0005QG-In for submit@debbugs.gnu.org; Thu, 30 Jan 2020 09:18:01 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:51875) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ixAdr-0005Q3-MZ for 39190@debbugs.gnu.org; Thu, 30 Jan 2020 09:18:00 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:39518) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ixAdm-0005pp-En; Thu, 30 Jan 2020 09:17:54 -0500 Original-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 ) id 1ixAdl-00050x-Oq; Thu, 30 Jan 2020 09:17:54 -0500 In-reply-to: (message from Stefan Monnier on Wed, 29 Jan 2020 16:33:31 -0500) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:175437 Archived-At: > From: Stefan Monnier > Cc: juri@linkov.net, 39190@debbugs.gnu.org, felician.nemeth@gmail.com > 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.