You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Repository navigation
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Automatically use hard tabs for Makefile buffers #3
Since makefiles require hard tabs, I'd like Atom to automatically use hard tabs whenever I'm editing a Makefile. Atom already detects the buffer type automatically.
Sublime Text accomplishes this via language-specific configuration files. So for example, I can independently specify 2 spaces default for javascript, 4 spaces default for python, and hard tab default for Makefiles. Not sure if this makes sense in Atom land but it seems like a simple way to do it.
Reacted by Nazmus Sakib, Esteban Echeverry, Mniak, DrColza, mathurinm and Michael Chirico
I ended up just writing this and placing it in my Atom > Init Script
path=require'path'# Set Makefile[.any extension] and '.mk' files to always use hard tabsatom.workspaceView.eachEditorView (editorView) ->editor=editorView.getEditor()
ifpath.basename(editor.getPath()) is'Makefile'editor.setSoftTabs(false)
ifpath.extname(editor.getPath()) is'.mk'editor.setSoftTabs(false)
@50Wliu I installed the language-make 0.19.0 with apm install language-make command, but still inserting spaces instead of tabs. :(
Console output:
$ apm install language-make
The language-make package is bundled with Atom and should not be explicitly installed.
You can run `apm uninstall language-make` to uninstall it and then the version bundled
with Atom will be used.
Installing language-make to C:\Users\[USERNAME]\.atom\packages done
I've been struggling like a nutbag with this in Atom 1.4.1. I've tried every possible setting of "Soft Tabs" and "Tab Type". I've tried to convert spaces to tabs. Whatever I do; when the Makefile is saved, it has spaces in it.
Checking "Show invisibles" reveals that I do get tabs when I press the tab key (represented by ») in the editor, but when I save, they are replaced with spaces.
I finally figured out what it was. The tabs to spaces package has a configuration that I obviously must have turned on at some point:
"tabs-to-spaces":
"onSave": "untabify"
This was being applied even when the package was disabled. Perhaps I need to restart Atom for the package's config to be ignored when the package is disabled? I don't know. I've tried to change the package's configuration to this:
But it doesn't help. I know this is beyond the scope of this issue, but I just wanted to mention it, for anyone else who stumble on to this with the same problem as I.
@asbjornu Are you able to reproduce the behavior in safe mode? atom --safe. Nothing in Atom (should) perform anything like this on save, so I'm guessing this is actually caused by the tabs-to-spaces package (which has "on save" behavior).
@thomasjo You're right. As I've updated my comment above, tabs-to-spaces and its onSave functionality is to blame. I was just dumbfounded that it was doing its thing even though I had disabled the package. Adjusting the configuration also doesn't help, so I'm creating an issue with it.
I am still having this issue, but not sure what package is causing it as I do not have tabs-to-spaces installed. I have tabs in my Makefile, but on save, I get 8 spaces instead.
How do I tell Atom which files are makefiles? I have some files like makefile.dev, makefile.inc,
and I'd like Atom to give me hard tabs, syntax highlighting, etc.
Activity
noseglid commentedon Apr 12, 2014
+1
iamdanfox commentedon Apr 19, 2014
👍 This was the first thing that forced me to switch back to Sublime Text!!
azhang commentedon May 10, 2014
👍 just ran into this problem now.
lost-carrier commentedon May 13, 2014
+1
OMG! Pain in the a... please fix this!!!
liangshan commentedon May 14, 2014
+1
kgrossjo commentedon May 14, 2014
+1
I will edit it in vim for the time being.
bral commentedon May 16, 2014
I ended up just writing this and placing it in my Atom > Init Script
Seems to be working so far
parabuzzle commentedon May 23, 2014
I'll look into creating a pull request for a fix for this
johnwebbcole commentedon May 30, 2014
+1
parabuzzle commentedon May 31, 2014
I wonder if anyone is going to review my pull request... 😕
yoshuawuyts commentedon Aug 13, 2014
@parabuzzle Have you started the PR? This bug is super annoying.
parabuzzle commentedon Aug 13, 2014
@yoshuawuyts the pull request has been open since May -> #8
parabuzzle commentedon Aug 13, 2014
@yoshuawuyts according to the PR referenced here for the core Atom code (atom/atom#2917) It appears that languages can specify hard tabs as an option.
I'll look into it today. If that's the case, I'll submit a new PR using this new option.
27 remaining items
rgbkrk commentedon Oct 15, 2015
Could my own settings be overriding this somehow? I'm still ending up with spaces by default.
rgbkrk commentedon Oct 15, 2015
To answer my own question, it's a result of
softbeing set instead ofautoin settings under "Tab Type":thomasjo commentedon Oct 16, 2015
@rgbkrk The language settings should win, and in the case of language-make, the tab type is set
hard.@atom/feedback Can any of you repro this?
winstliu commentedon Oct 16, 2015
I believe it's because Make 0.18.0 (which added the scoped setting) isn't installed on Atom 1.0.19.
https://github.com/atom/atom/blob/7229d1a4295dd0fcb644b7c891a64e6836b2c3b2/package.json#L138
LantosIstvan commentedon Oct 25, 2015
@50Wliu I installed the language-make 0.19.0 with
apm install language-makecommand, but still inserting spaces instead of tabs. :(Console output:
asbjornu commentedon Jan 27, 2016
I've been struggling like a nutbag with this in Atom 1.4.1. I've tried every possible setting of "Soft Tabs" and "Tab Type". I've tried to convert spaces to tabs. Whatever I do; when the
Makefileis saved, it has spaces in it.Checking "Show invisibles" reveals that I do get tabs when I press the tab key (represented by
») in the editor, but when I save, they are replaced with spaces.I finally figured out what it was. The tabs to spaces package has a configuration that I obviously must have turned on at some point:
This was being applied even when the package was disabled. Perhaps I need to restart Atom for the package's config to be ignored when the package is disabled? I don't know. I've tried to change the package's configuration to this:
But it doesn't help. I know this is beyond the scope of this issue, but I just wanted to mention it, for anyone else who stumble on to this with the same problem as I.
thomasjo commentedon Jan 27, 2016
@asbjornu Are you able to reproduce the behavior in safe mode?
atom --safe. Nothing in Atom (should) perform anything like this on save, so I'm guessing this is actually caused by the tabs-to-spaces package (which has "on save" behavior).asbjornu commentedon Jan 27, 2016
@thomasjo You're right. As I've updated my comment above, tabs-to-spaces and its
onSavefunctionality is to blame. I was just dumbfounded that it was doing its thing even though I had disabled the package. Adjusting the configuration also doesn't help, so I'm creating an issue with it.sunjay commentedon Feb 26, 2017
For anyone who ends up here from Google and sees @asbjornu's configuration, it needs to look like this:
This was addressed in: lee-dohm/tabs-to-spaces#42
braadworst commentedon Jul 17, 2017
@sunjay, ace! I couldnt figure out what the scope key name was for makefiles.
bennabiy commentedon Nov 17, 2017
I am still having this issue, but not sure what package is causing it as I do not have tabs-to-spaces installed. I have tabs in my Makefile, but on save, I get 8 spaces instead.
bennabiy commentedon Nov 17, 2017
I may be dense, but where do I set those settings to make it work?
dcburleigh commentedon Nov 29, 2017
How do I tell Atom which files are makefiles? I have some files like makefile.dev, makefile.inc,
and I'd like Atom to give me hard tabs, syntax highlighting, etc.
winstliu commentedon Dec 3, 2017
@dcburleigh you can use the Grammar Selector (Ctrl+Shift+L on Windows/Linux, cmd-shift-L on macOS), or follow the instructions at https://discuss.atom.io/t/how-do-i-make-atom-recognize-a-file-with-extension-x-as-language-y/26539.
richardPFisk commentedon Feb 20, 2018
I had some joy using
.editorconfigwith this setting: