3 ms·
I first heard of this technique a long time ago--it made sense then and it makes sense now. But for it to be actually usable it would need some good editor supp
by __david__ 17y ago
I first heard of this technique a long time ago--it made sense then and it makes sense now. But for it to be actually usable it would need some good editor support (I'm not about to micro-manage my editor and alternate between spaces and tabs manually). I would love to see some Emacs code that integrates with c-mode and perl mode. Short of that I have to say banning tabs completely from your source is the only way to make it look consistent across editors.
- jrockway 17y agoEmacs does what the author wants out of the box, I think. It indents with tabs until that is no longer possible, then it switches to spaces. I don't really see what this buys anyone (except confusion), so I disable it and only use spaces. This article did not convince me to change my mind. (It did convince me that the author knows nothing about Emacs, like most Vim users.)
- acon 17y agoWhat you describe is not what the author (and I) want. You should not use tabs until it is no longer possible, you should only use tabs to indicate the indentation level. To perform further alignment beyond the indentation, for example to align arguments to a function after the opening parenthesis you use spaces.
- whatusername 17y agoUnless you're using Python of course :)
- jrockway 17y agoIn most cases, the behavior is identical. I think as you implement what the article describes, you will find it to be tedious and impractical in real-world use.
- philh 17y agoMost cases isn't good enough. Exceptions are still frequent, such as this example FTA: SomeClass::SomeClass() _____.:.InheritingClass(false, false _____...................5, 10, true, _____...................bleh, blah) As compared to SomeClass::SomeClass() _____.:.InheritingClass(false, false ____________________....5, 10, true, ____________________....bleh, blah) Which will no longer align if tabstops are changed. I've set up emacs to do the right thing in c-mode, and possibly in other modes which inherit from it. It's not hard to find a solution online, but it's certainly not "out of the box".
- __david__ 17y ago> I've set up emacs to do the right thing in c-mode Would you mind posting a .emacs snippet? I've tried to do it in the past and got the impression it was not possible. I'd love to see what you did.
- philh 17y agoWhat I use is here: http://philh.net/smart-tab.el http://philh.net/smart-tab.el Which is a (very slightly) modified version of what I foud here: http://bytes.inso.cc/wp/2009/01/07/dot-emacs-smarter-indentation-with-tabs-and-spaces/ http://bytes.inso.cc/wp/2009/01/07/dot-emacs-smarter-indenta... This seems to be a more language-agnostic approach: http://www.emacswiki.org/emacs/SmartTabs http://www.emacswiki.org/emacs/SmartTabs
- jart 17y agoWow, people have been telling me this was impossible for years. Thanks :D