dir-locals: apply our C settings in C++ also
Checks
Commit Message
We haven't been applying our settings to our C++. This patch fixes
that.
Sadly, it seems that the only documented way to apply settings to
multiple modes is to repeat them. I thought that we can provide a list
of modes to apply, but that seems to not be the case (even thought it
happened to work on my machine).
As a result, C-h C-v fill-column now shows:
This variable’s value is directory-local, set by the file
‘/home/arsen/gcc/pristine/.dir-locals.el’.
As this could affect peoples workflows, I'm posting as a heads-up and
sanity check.
OK for trunk?
TIA, have a lovely day.
---------- >8 ----------
This also works with Emacs 30 Tree-Sitter C and C++ modes, as they are
submodes.
ChangeLog:
* .dir-locals.el: Change c-mode to a list of C, C++ and ObjC
modes that Emacs currently provides.
---
.dir-locals.el | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
Comments
Arsen Arsenović <arsen@aarsen.me> writes:
> We haven't been applying our settings to our C++. This patch fixes
> that.
>
> Sadly, it seems that the only documented way to apply settings to
> multiple modes is to repeat them. I thought that we can provide a list
> of modes to apply, but that seems to not be the case (even thought it
> happened to work on my machine).
>
> As a result, C-h C-v fill-column now shows:
>
> This variable’s value is directory-local, set by the file
> ‘/home/arsen/gcc/pristine/.dir-locals.el’.
>
> As this could affect peoples workflows, I'm posting as a heads-up and
> sanity check.
>
> OK for trunk?
>
> TIA, have a lovely day.
> ---------- >8 ----------
> This also works with Emacs 30 Tree-Sitter C and C++ modes, as they are
> submodes.
>
> ChangeLog:
>
> * .dir-locals.el: Change c-mode to a list of C, C++ and ObjC
> modes that Emacs currently provides.
OK, thanks.
Richard
> ---
> .dir-locals.el | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/.dir-locals.el b/.dir-locals.el
> index fa031cbded99..2c12b3866633 100644
> --- a/.dir-locals.el
> +++ b/.dir-locals.el
> @@ -18,6 +18,10 @@
> (tcl-continued-indent-level . 4)
> (indent-tabs-mode . t)))
> (nil . ((bug-reference-url-format . "https://gcc.gnu.org/PR%s")))
> + ;; Please keep C and C++ in sync.
> (c-mode . ((c-file-style . "GNU")
> (indent-tabs-mode . t)
> - (fill-column . 79))))
> + (fill-column . 79)))
> + (c++-mode . ((c-file-style . "GNU")
> + (indent-tabs-mode . t)
> + (fill-column . 79))))
@@ -18,6 +18,10 @@
(tcl-continued-indent-level . 4)
(indent-tabs-mode . t)))
(nil . ((bug-reference-url-format . "https://gcc.gnu.org/PR%s")))
+ ;; Please keep C and C++ in sync.
(c-mode . ((c-file-style . "GNU")
(indent-tabs-mode . t)
- (fill-column . 79))))
+ (fill-column . 79)))
+ (c++-mode . ((c-file-style . "GNU")
+ (indent-tabs-mode . t)
+ (fill-column . 79))))