Emacs smart tabs mode formatting with function parameters - emacs

Smart tabs mode is supposed to use tabs for indentation and spaces for alignment.
Here is a picture of what it is currently doing:
In my mind this appears to be backwards, the spaces should precede the tabs because the tabs are alignment relative to the anonymous function on the dosomething(); line.
Is there some tweak to smart tabs mode to behave like that, or am I off base?

Related

How to change caret and newline rendering behavior of Gtk3 TextView?

For example, I want to render caret in underline style (like some console), instead of thin vertical bar. And show a particular char at where there is a "newline" (like some editors do). How can I reach that goal? Is overriding its methods the only way?

GitHub markdown tab size

A little confused at the purpose of the "tab size" in GitHub's markdown editor. When changing the value in the dropdown, it seems to have an effect in the "Edit File" tab but not the "Preview" tab. Nor does it have an effect after saving.
Bottom line, I'd like my tab size to be 2 when displayed in my repository readme, instead of 8 which makes the markup seem disorganized.
Thanks for your help.
You need to manually convert all the existing tabs to spaces in the document.
Changing the setting in your editor/IDE or on GitHub (to use spaces) does not change any existing text in the document. It only affects any new text you add to the document. If the existing content includes tab characters, you need to convert those to spaces for consistency. While you would need to manually change each instance on GitHub, your local editor/IDE should have a function to do that document wide from a single command (usually called something like "convert tabs to spaces").
By way of explanation, when a tab is inserted in a document, all that happens is a tab character is inserted. No information is included indicating how wide that tab character should be. Each document viewer will have its own setting indicating how wide a tab character should be and if those settings do not match, then the document will display differently in each context. For example, the GitHub editor can be configured to be different that the default. However, the rendered preview does not have any settings so you only get the default tab wide (8 chars on GitHub).
For that reason, most editors/IDEs include a setting to insert spaces when you type the tab key. That insures that every tab is exactly the same width across all viewers anywhere. However, the "spaces" feature of editors works by intercepting the press of the tab key on your keyboard and replacing the tab with the set number of spaces. Therefore, actual space characters get inserted into your document and there are no tab characters (the editor hides this by also intercepting backspace key presses). The important thing to note is that this feature works by intercepting and altering key presses on the keyboard. Therefore, it has no effect on text already in the document. Which is why you need to convert the existing text. Fortunately, the "convert tabs to spaces" feature of most editors/IDEs will use the tabs/spaces settings when doing the conversion, so running that command once should fix the entire document as long as your settings are configured properly.
Most editors/IDEs also have a "show whitespace" (or "view whitespace)" feature, which can be used to confirm the conversion was done properly. When "show whitespace" is turned on, tabs display as an arrow and spaces as dots (usually a lighter gray than the surrounding text). If you have converted your entire document. you should see no tab arrows anywhere, only dots for spaces. Once you are satisfied that no tabs exist, you can then turn "show whitespace" off. Unfortuntely, GitHub's online editor does not offer this feature, so you'll need to use your local editor.

C/C++ editors different indents using tab key compare to tab chars already embedded

In Eclipse Mars and later, I want tab characters that are already present in the text to display as 8 spaces, but whenever I press the tab key I want to insert 2 real space characters. Is it possible to set eclipse to display embedded tab chars as one indent setting and yet insert spaces on a different indent setting?
In general, no. The only available generic and common settings are in Preferences > General > Text Editor, and you have:
Displayed tab width which allows to set the number of spaces used to render tabs (if you indent with tabs), or the number of spaces to insert on tab (if you indent with spaces)
insert spaces for tabs to decide whether to indent with tabs or spaces.
But some specific editors (HTML, XML, CSS...) allows to somehow override this settings and give more control on tabs. You can usually find them in Preferences, then searching for tab or formatter. Those settings are specific to one kind of editor and not propagated across all editors. But maybe that can be enough for your use-case.
If you want something more generic, feel free to open an enhancement request to bugs.eclipse.org.

Tell Emacs never to insert Tabs

I know how I can make it so that hitting doesn't insert a tab, but spaces.
However, Emacs keeps using tabs for indentation, like:
space space
space space space
tab tab space space
tab tab tab space space space
It's a messy mix, how can I configure it so that it never inserts tabs, for anything?
Add this to your .emacs:
(setq-default indent-tabs-mode nil)
Check the variable indent-tabs-mode. If you set it to nil then emacs will use spaces to indent to the tab-stop when you press tab and never convert spaces to tabs.

Eclipse: Make Tabs visible, Spaces invisible

Usually I'd like to edit files with Spaces only.
But when I open files with Tabs, I'd like to see them (for example as arrows ->). With such files I do my edits careful, so not to destroy the original authors coding style -- usually I insert tabs by hand when needed.
So, I want to see Tabs all the time, but using the General, Editors, Text Editors, Show Whitespace Characters option, I get distracted by all the whitespace-dots.
How can I reduce this distraction by Spaces, but at the same time see the Tabs?
Can I change the font color for the visualized whitespaces to a brighter color? currently they are medium gray, but I can not find an option to change that.
Or can I choose different setting for Tabs and for Spaces (and Paragraph signs, for that matter)?
The way I used to have it in my goo' ol' editor would be: Change the background color of Tab to light-yellow (without display the -> for tabs or the dots for Spaces). This makes Tabs wuite visible, without harming my "normal" source visualization. This would be my favorite. I did that by adding the Tab to be a keyword in all languages, and then change the keyword background color to a bright yellow.
According to the Eclipse 3.7M3 New and noteworthy you can customize the Show Whitespace Characters to show only tabs but not spaces.
Unfortunately the stable version of Eclipse 3.7 is expected in 2011 summer but if that feature is a 'must' for you you can try that milestone.