Skip to content
Open
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion editorconfig.el
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ This hook will be run even when there are no matching sections in
(meson-mode meson-indent-basic)
(mips-mode mips-tab-width)
(mustache-mode mustache-basic-offset)
(nix-ts-mode nix-ts-mode-indent-offset)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If nix-ts-mode followed the convention of using FOO-indent-offset (instead of FOO-mode-indent-offset), your patch would not be needed. So I suggest a bug report to the nix-ts-mode maintainers.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have send a bug report upstream.
nix-community/nix-ts-mode#69

Copy link

@purcell purcell Feb 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Stefan, I'm a committer on nix-ts-mode, and I could conceivably help get this changed via aliasing and deprecation, but I've seen the same pattern in other popular modes out there, e.g. toml-ts-mode. It seems strange to require the -mode- not to be there, as that is a reasonable part of a variable name. I personally think it would be better to adjust the heuristic here.

(nxml-mode . editorconfig--get-indentation-nxml-mode)
(objc-mode c-basic-offset)
(octave-mode octave-block-offset)
Expand Down Expand Up @@ -266,12 +267,15 @@ This hook will be run even when there are no matching sections in
(templ-ts-mode go-ts-mode-indent-offset js-indent-level)
(toml-ts-mode toml-ts-mode-indent-offset)
(typescript-ts-base-mode typescript-ts-mode-indent-offset)
(typst-ts-mode typst-ts-indent-offset)
(verilog-mode verilog-indent-level
verilog-indent-level-behavioral
verilog-indent-level-declaration
verilog-indent-level-module
verilog-cexp-indent
verilog-case-indent)
(vhdl-mode . editorconfig--get-indentation-vhdl-mode)
(vhdl-ts-mode vhdl-ts-indent-level)
(web-mode . editorconfig--get-indentation-web-mode)
(yaml-ts-mode yaml-indent-offset))
"Alist of indentation setting methods by modes.
Expand Down Expand Up @@ -305,7 +309,7 @@ When variable `buffer-file-name' matches any of the regexps, then
(with-eval-after-load 'recentf
(add-to-list 'editorconfig-exclude-regexps
(rx-to-string '(seq string-start
(eval (file-truename (expand-file-name recentf-save-file))))
(eval (file-truename (expand-file-name recentf-save-file))))
t)))

(defcustom editorconfig-trim-whitespaces-mode
Expand Down Expand Up @@ -413,6 +417,11 @@ Make a message by passing ARGS to `format-message'."
(t t))
`((lisp-indent-offset . ,size))))

(defun editorconfig--get-indentation-vhdl-mode (size)
"Set VHDL indentation to SIZE and handle its custom indent-tabs-mode."
`((vhdl-basic-offset . ,size)
(vhdl-indent-tabs-mode . ,indent-tabs-mode)))

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you have (vhdl-indent-tabs-mode . ,indent-tabs-mode) here?
As for vhdl-basic-offset it should be auto-discovered by editorconfig--default-indent-size-function.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vhdl-indent-tabs-mode overrides indent-tabs-mode , so if it is not also set then it can override a configuration with space.

vhdl-indent-tabs-mode is a variable defined in ‘vhdl-mode.el’.

Its value is nil

Non-nil means indentation can insert tabs.
Overrides local variable ‘indent-tabs-mode’.

From line 4471.

      If option `vhdl-indent-tabs-mode' is nil, spaces are used instead of
    tabs.  \\[tabify] and \\[untabify] allow the conversion of spaces to
    tabs and vice versa.

(cl-defun editorconfig--should-set (symbol)
"Determine if editorconfig should set SYMBOL."
(display-warning '(editorconfig editorconfig--should-set)
Expand Down