From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel 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 19:10:05 +0200 Message-ID: <874jc2y2ky.fsf@gmail.com> 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> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19918"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 70136@debbugs.gnu.org, monnier@iro.umontreal.ca To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Apr 15 19:11:14 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 1rwPrO-0004w9-Qp for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 15 Apr 2024 19:11:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rwPr5-0003UC-TO; Mon, 15 Apr 2024 13:10:55 -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 1rwPr1-0003QS-Cy for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 13:10:52 -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 1rwPr0-0000XG-Dk for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 13:10:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rwPrB-0006Y3-KZ for bug-gnu-emacs@gnu.org; Mon, 15 Apr 2024 13:11:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 15 Apr 2024 17:11:01 +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.171320103024876 (code B ref 70136); Mon, 15 Apr 2024 17:11:01 +0000 Original-Received: (at 70136) by debbugs.gnu.org; 15 Apr 2024 17:10:30 +0000 Original-Received: from localhost ([127.0.0.1]:38396 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwPqe-0006Sz-Nt for submit@debbugs.gnu.org; Mon, 15 Apr 2024 13:10:30 -0400 Original-Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:44196) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rwPqb-0006SI-MG for 70136@debbugs.gnu.org; Mon, 15 Apr 2024 13:10:27 -0400 Original-Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-57013379e17so1987846a12.0 for <70136@debbugs.gnu.org>; Mon, 15 Apr 2024 10:10:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713201008; x=1713805808; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=+JbVqhUhdUIE/lrB7eTlgVj5SXnWsiX2jm5m/4tMP+Q=; b=VFX4FBxeFnb1NBXhgPf8acS8wjSp02lz9U3zD4BbEjvs7I/cJut7h6AuhOGq8RxxuL UIfD61NvHk8rpneVsyowfz89yUSBSWVHCNGqZ6/gyLEd0eeiO1b2SoJw4LB5uLi1xy95 tLzSTqWmrnmS4ul1SUGu5shh4SG7GMjpjEM+nc2TCEjmM2XYE5MhRhYCRfS3uz0r9xb3 zS9ziCigfmf4KohCh6YOUoYn/GNRbgtzNOYsq8r3wZ7FYhMtHjZUl3APaKd0L1WLpd7C eINxFKeHJ/NXVwkqgl2cy0Z3ZrHpj3iaH+doRpdasnU9zhD5xEg+/GoxZ7TveXA7g431 jkZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713201008; x=1713805808; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+JbVqhUhdUIE/lrB7eTlgVj5SXnWsiX2jm5m/4tMP+Q=; b=JUCTgEHVK443wJaxO+hfDlCsVZOIea/wpgCnl01uy0I7zGQuuFJLp3fQw/6+V006SV 6Jz7bJpMSCBR2P0KmbpwG69PtfRLKWCTmv+vwAWaHgZQPrL0EE5RJnotIk56u5RpeSi5 9cX4IbxVpJFc/uhTiZJehrFPbOZqZzELHggM7RYxi+JJk6EKDhNT7wPCet4V73ZaBjrD cWBhECOXY7apT4C5qrEoAaxkV5kJn46zYekOMII7kxwNFQnPElOCj3obpi0dqQrgzNxU 93pNyP03Lp4MQxTZCJYe01WidwjL5yDnTNynsSvlQTtDD+3NCouh5/dB8Qeo2xrOrw1a 3vNw== X-Gm-Message-State: AOJu0YwvxsTYyUk2j1qgeR9Eiexv/q7axsMeolTPe1/mFFyofEbRZ4Cy MR6ncS/R1KNI6DlGfHDxSjgq2H7RHaeuSnMvnbhmvq1hvMVWd+gg X-Google-Smtp-Source: AGHT+IFXj+G6gsqA6fkdg5aA62Pv2GdH1/Bdnyma318HHuvYnQFhySlWkzJU7r1Vym5lxWLSOhuC8g== X-Received: by 2002:a50:9f2b:0:b0:56e:2ebc:5c4 with SMTP id b40-20020a509f2b000000b0056e2ebc05c4mr8186283edf.20.1713201006975; Mon, 15 Apr 2024 10:10:06 -0700 (PDT) Original-Received: from ars3 ([2a02:8109:8a87:ff00::6223]) by smtp.gmail.com with ESMTPSA id ee42-20020a056402292a00b005701550ddc5sm2739388edb.90.2024.04.15.10.10.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 10:10:06 -0700 (PDT) In-Reply-To: <86v84kmeh0.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 14 Apr 2024 13:21:47 +0300") 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:283386 Archived-At: 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? 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 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? > 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.