Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I have to manually apply EditorConfig settings for .spec files #197

Closed
audreytoskin opened this issue Apr 20, 2019 · 5 comments
Closed

I have to manually apply EditorConfig settings for .spec files #197

audreytoskin opened this issue Apr 20, 2019 · 5 comments
Assignees

Comments

@audreytoskin
Copy link

The problem

I maintain several small RPM packages. When I first open an RPM .spec within a project which has an .editorconfig settings file, editorconfig-mode seems to apply some settings but not others. insert_final_newline and trim_trailing_whitespace work as expected, but max_line_length does not.

When I check the editorconfig-display-current-properties command, I get "Properties are not applied to the current buffer yet." Unless or until I run editorconfig-apply. After that, the EditorConfig settings work perfectly, but I have to redo this every time I open a .spec file in a new Emacs session. So far I've only noticed it for .spec files --- .md and other files in my projects have no issue.

My system setup

  • Fedora 29 Workstation x86_64
  • GNU Emacs 26.1 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.23.2) of 2018-08-13
  • editorconfig 20190405.1405 (from Melpa)
  • EditorConfig C Core 0.12.1 (manually compiled to ~/.local/ with ~/.local/bin/ in my $PATH)

My Emacs config

(custom-set-variables
 [...]
 '(editorconfig-mode t)
 [...]
 '(package-enable-at-startup t)
    '(package-selected-packages
         (quote
             ([...] editorconfig rpm-spec-mode [...])))

[...]
(editorconfig-mode t)

The variable editorconfig-exec-path is left at the default value editorconfig since I assume that uses whichever binary is in my environment's $PATH. But I did try replacing it with the actual absolute path, and it didn't make any difference.

My .editorconfig file for this RPM project

[*]
charset                  = utf-8
end_of_line              = lf
indent_size              = 4
indent_style             = space
insert_final_newline     = true
max_line_length          = 80
tab_width                = 4
trim_trailing_whitespace = true

[*.{md,mdown,markdown,spec,txt}]
max_line_length = 72
@10sr
Copy link
Member

10sr commented Apr 21, 2019

Thaks for your details report.
I got the same result! Very strange...

This definitely is a bug and I'll look into and try to solve this, but I think following code can be used as a workaround for this:

  (add-hook 'rpm-spec-mode-hook
            'editorconfig-mode-apply)

@xuhdev
Copy link
Member

xuhdev commented Jun 2, 2019

@10sr I'm also having a hard time finding out the culprit commit. When loading v0.8.0 or master with emacs -q, things do work normally. However, I have to manually apply if I use it in spacemacs.

@10sr 10sr self-assigned this Jun 3, 2019
@10sr
Copy link
Member

10sr commented Jun 3, 2019

@terrycloth I just fixed this so could you check the latest version?
rpm-spec-mode is defined slight differently from other modes (it does not use define-derived-mode for its definitions), so it requires explicit support...

@xuhdev Thanks! I'm not really familiar with spacemacs, but it seems there are no problem with current master branch... I hope the recent commits fix this, too.
Please tell me if the problem still happens in your environment. 😖

@xuhdev
Copy link
Member

xuhdev commented Jun 4, 2019

It looks like a mistest on my end. Thanks @10sr ! Feel free to close this issue if @terrycloth agrees

@audreytoskin
Copy link
Author

Sorry for the delayed response. But yes, after updating to editorconfig-20190603.1124 from MELPA, I no longer have to run M-x editorconfig-mode-apply. Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants