From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#70136: 30.0.50; compilation-mode [was: comint-mode] doesn't call hack-dir-local-variables-non-file-buffer Date: Mon, 15 Apr 2024 21:27:35 +0300 Message-ID: <86sezmjxbc.fsf@gnu.org> References: <87zfuc48d5.fsf@gmail.com> <86msqc9dsa.fsf@gnu.org> <874jcjeuac.fsf@gmail.com> <86edbnajfp.fsf@gnu.org> <87mspwcn0f.fsf_-_@gmail.com> <86v84kmeh0.fsf@gnu.org> <874jc2y2ky.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26083"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 70136@debbugs.gnu.org, monnier@iro.umontreal.ca To: Augusto Stoffel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 15 20:28:19 2024 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 1rwR3y-0006XD-5r for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Apr 2024 20:28:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rwR3g-0006NP-Nc; Mon, 15 Apr 2024 14:28:00 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rwR3Z-0006Lk-Dj for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 14:27:55 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rwR3Y-0007RG-9d for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 14:27:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rwR3k-0000Gw-1O for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 14:28:04 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Apr 2024 18:28:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70136 X-GNU-PR-Package: emacs Original-Received: via spool by 70136-submit@debbugs.gnu.org id=B70136.17132056811016 (code B ref 70136); Mon, 15 Apr 2024 18:28:04 +0000 Original-Received: (at 70136) by debbugs.gnu.org; 15 Apr 2024 18:28:01 +0000 Original-Received: from localhost ([127.0.0.1]:38871 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwR3g-0000GK-OI for submit@debbugs.gnu.org; Mon, 15 Apr 2024 14:28:01 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:59434) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwR3e-0000GA-5i for 70136@debbugs.gnu.org; Mon, 15 Apr 2024 14:27:58 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rwR3L-0007QB-LQ; Mon, 15 Apr 2024 14:27:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=1I+Z8tF58rdFUDRScxK0baZlDfgJcP7C8UK3NtRAQCE=; b=qlJalxGH9GGx KbLP5Hc5YVNyrcLN6gK2aUuVjWeKz5Mz+LhtAwCSQTTpnmKn564d27Pi0eTrUdkKJNVLx64C+xmbI uTuD/3eF5PtTiAyacccSrdnxR1PEXmi8Yl5loy4nVdQ/qVhqGfPp4gdwoI0MzATRsk8kY3uF/8KmX xwvZsJSpyOCJ2Ub9rdkF2xzSxoDuhwL5eo43U36FLn9qKzCdH6gfax7Li2k2nuNOvzXoXpjZqIL83 O3v3hq602pFXPgecf38wlPBIueKT5jsmx7sePwMW5hIY2LllF3/nBVHaZb3ZPDRGeYME5/j3KqtQC GO0kzK1nJz/lxGtXpgZFRg==; In-Reply-To: <874jc2y2ky.fsf@gmail.com> (message from Augusto Stoffel on Mon, 15 Apr 2024 19:10:05 +0200) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283389 Archived-At: > From: Augusto Stoffel > Cc: 70136@debbugs.gnu.org, monnier@iro.umontreal.ca > Date: Mon, 15 Apr 2024 19:10:05 +0200 > > On Sun, 14 Apr 2024 at 13:21, Eli Zaretskii wrote: > > >> From: Augusto Stoffel > >> Cc: 70136@debbugs.gnu.org, Stefan Monnier > >> Date: Sun, 14 Apr 2024 11:27:28 +0200 > >> > >> Since compilation buffers go as far as to print the directory they're > >> running on at the top of the buffer, I think it's pretty clear they > >> should receive dir-local variables. > >> > >> So I'd suggest the attached patch, which does that and also removes a > >> more limited mechanism I added some time ago to allow compilation with > >> project-specific settings. I've CC'ed Stefan since at the time he kind > >> of supported the changes I'm now suggesting to remove. > > > > Thanks, but I think this should be optional behavior, by default off, > > because it could cause trouble in directory trees which already have > > .dir-locals.el that were not intended to affect compilation-mode (and > > its descendants, like Grep). > > This seems rather hypothetical to me. Do you have a concrete example? You are entitled to your opinions, but this is clearly a change in behavior that will affect a lot of users (since compilation-mode and its descendants are very popular and widely used). Therefore, I don't understand why you need concrete examples: the issue is crystal clear just by thinking about it. > The dir locals mechanism is very precise and easy to use. Anything not > intended to affect compilation buffers should be put under prog-mode (or > a descendant), text-mode, or whatever else it's actually intended for. On the contrary, .dir-locals.el affects every file in a directory, so it is quite a blunt weapon. > On the other hand, imagine this situation: you're working on a project > with very long lines in some files, so you want your grep buffers to > look more compact. Then you type > > M-x add-dir-local-variable RET grep-mode RET truncate-lines RET t RET > > Wouldn't you be very confused that this doesn't work? No, I would not. > > > Also, this needs a NEWS entry, I think. > > > >> + (unless (buffer-file-name) > >> + (let ((sym (make-symbol "hack-dir-local-variables-non-file-buffer"))) > >> + (set sym #'hack-dir-local-variables-non-file-buffer) > >> + ;; Ensure hack-dir-locals is called only after a derived mode is set. > >> + (push sym delayed-mode-hooks))) > > > > Why such a complicated way of using the symbol of a function that's > > defined in a preloaded Lisp file? Am I missing some subtlety here? > > This is because delayed-mode-hooks is a _list of hooks_, not a hook. > Adding (the name of) a function to it doesn't work. I'm asking mainly about the need to use make-symbol.