all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Augusto Stoffel <arstoffel@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 70136@debbugs.gnu.org, monnier@iro.umontreal.ca
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	[thread overview]
Message-ID: <874jc2y2ky.fsf@gmail.com> (raw)
In-Reply-To: <86v84kmeh0.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 14 Apr 2024 13:21:47 +0300")

On Sun, 14 Apr 2024 at 13:21, Eli Zaretskii wrote:

>> From: Augusto Stoffel <arstoffel@gmail.com>
>> Cc: 70136@debbugs.gnu.org,  Stefan Monnier <monnier@iro.umontreal.ca>
>> 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.





  reply	other threads:[~2024-04-15 17:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-02  5:54 bug#70136: 30.0.50; comint-mode doesn't call hack-dir-local-variables-non-file-buffer Augusto Stoffel
2024-04-02 11:58 ` Eli Zaretskii
2024-04-02 14:03   ` Augusto Stoffel
2024-04-02 15:11     ` Eli Zaretskii
2024-04-14  9:16       ` Augusto Stoffel
2024-04-14 10:08         ` Eli Zaretskii
2024-04-14  9:27       ` bug#70136: 30.0.50; compilation-mode [was: comint-mode] " Augusto Stoffel
2024-04-14 10:21         ` Eli Zaretskii
2024-04-15 17:10           ` Augusto Stoffel [this message]
2024-04-15 18:27             ` Eli Zaretskii
2024-04-16 21:49               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-17  2:34                 ` Eli Zaretskii
2024-04-17  2:58                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-17  8:31                     ` Augusto Stoffel
2024-04-17 13:03                       ` Eli Zaretskii
2024-04-17 13:29                         ` bug#70436: 30.0.50; Fail to enter the debugger when using prin1 (instead of cl-prin1) Bruno Barbier
2024-04-20  8:24                           ` Eli Zaretskii
2024-04-20  8:28                             ` Eli Zaretskii
2024-04-20 15:24                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-25 16:37                                 ` Eli Zaretskii
2024-04-27 10:29                                   ` Bruno Barbier
2024-04-27 14:45                                     ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-20 13:57                             ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-17 12:36                     ` bug#70136: 30.0.50; compilation-mode [was: comint-mode] doesn't call hack-dir-local-variables-non-file-buffer Eli Zaretskii
2024-04-17 12:59                       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-17 13:16                         ` Eli Zaretskii
2024-04-17 17:55                           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-17 18:18                             ` Eli Zaretskii
2024-04-17 18:24                               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-04-16  6:33             ` Juri Linkov
2024-04-16 12:37               ` Eli Zaretskii
2024-04-17  8:16               ` Augusto Stoffel
2024-04-17 13:00                 ` Eli Zaretskii
2024-05-02  6:17         ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874jc2y2ky.fsf@gmail.com \
    --to=arstoffel@gmail.com \
    --cc=70136@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.