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: Wed, 29 Jan 2020 19:13:14 +0200 Message-ID: <83tv4embit.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> Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="71457"; 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 Wed Jan 29 18:14:36 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 1iwqvE-000IV5-8A for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jan 2020 18:14:36 +0100 Original-Received: from localhost ([::1]:49304 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwqvD-0001lg-Bd for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 29 Jan 2020 12:14:35 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53884) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iwquh-0001SE-IJ for bug-gnu-emacs@gnu.org; Wed, 29 Jan 2020 12:14:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iwqug-0007dY-HZ for bug-gnu-emacs@gnu.org; Wed, 29 Jan 2020 12:14:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56809) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iwqug-0007dT-EO for bug-gnu-emacs@gnu.org; Wed, 29 Jan 2020 12:14:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iwqug-0000kb-As for bug-gnu-emacs@gnu.org; Wed, 29 Jan 2020 12:14: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: Wed, 29 Jan 2020 17:14: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.15803180072821 (code B ref 39190); Wed, 29 Jan 2020 17:14:02 +0000 Original-Received: (at 39190) by debbugs.gnu.org; 29 Jan 2020 17:13:27 +0000 Original-Received: from localhost ([127.0.0.1]:34549 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwqu6-0000jP-VS for submit@debbugs.gnu.org; Wed, 29 Jan 2020 12:13:27 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:44767) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iwqu5-0000jD-11 for 39190@debbugs.gnu.org; Wed, 29 Jan 2020 12:13:25 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:50580) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1iwqtz-0007Cn-7I; Wed, 29 Jan 2020 12:13:19 -0500 Original-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 ) id 1iwqtw-0008Sw-GM; Wed, 29 Jan 2020 12:13:17 -0500 In-reply-to: (message from Stefan Monnier on Tue, 28 Jan 2020 18:17:23 -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:175400 Archived-At: > From: Stefan Monnier > Cc: juri@linkov.net, 39190@debbugs.gnu.org, felician.nemeth@gmail.com > 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.