Skip to content

Use 'set filetype' to set filetype once again #467

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

Merged
merged 1 commit into from
Feb 12, 2019

Conversation

jparise
Copy link
Contributor

@jparise jparise commented Dec 30, 2018

The s:setf() helper function was originally introduced to avoid setting the filetype multiple times (375e9e1). I believe this covered the case where a file had an .ex or .exs extension and also include "elixir" in the shebang line (such that s:DetectElixir() would match and call set filetype redundantly).

c56bd82 removed the existing &filetype check in s:setf(), relying on the &filetype global and ftdetect framework to avoid redundant updates.

I believe we can simplify this even further by using just set filetype in the file extension-based autocommands and including a guard against (re)setting filetype in s:DetectElixir().

Also, use explicit case-insensitive comparison operators. This isn't a good place to make assumptions about ignorecase.

The s:setf() helper function was originally introduced to avoid setting
the filetype multiple times (375e9e1). I believe this covered the case
where a file had an .ex or .exs extension and also include "elixir" in
the shebang line (such that s:DetectElixir() would match and call 'set
filetype' redundantly).

c56bd82 removed the existing &filetype check in s:setf(), relying on the
&filetype global and ftdetect framework to avoid redundant updates.

I believe we can simplify this even further by using just 'set filetype'
in the file extension-based autocommands and including a guard against
(re)setting filetype in s:DetectElixir().

Also, use explicit case-insensitive comparison operators. This isn't a
good place to make assumptions about 'ignorecase'.
@jbodah jbodah merged commit 3abb0f4 into elixir-editors:master Feb 12, 2019
@jbodah
Copy link
Collaborator

jbodah commented Feb 12, 2019

Sorry for the delay on this. Must've missed it during the holidays

@jparise jparise deleted the ftdetect branch February 12, 2019 21:18
kelvinst pushed a commit to kelvinst/vim-elixir that referenced this pull request Aug 21, 2019
The s:setf() helper function was originally introduced to avoid setting
the filetype multiple times (375e9e1). I believe this covered the case
where a file had an .ex or .exs extension and also include "elixir" in
the shebang line (such that s:DetectElixir() would match and call 'set
filetype' redundantly).

c56bd82 removed the existing &filetype check in s:setf(), relying on the
&filetype global and ftdetect framework to avoid redundant updates.

I believe we can simplify this even further by using just 'set filetype'
in the file extension-based autocommands and including a guard against
(re)setting filetype in s:DetectElixir().

Also, use explicit case-insensitive comparison operators. This isn't a
good place to make assumptions about 'ignorecase'.
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

Successfully merging this pull request may close these issues.

2 participants