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.
Related
Did I mess with the setting or is this a new feature?
You might have changed your tab indentation value. Look at the status bar (bottom right) and see how many spaces your tab is set to. You can click on the status bar to change it, or press cmd+shift+p (OS X) or ctrl+shift+p (Windows) to open the command pallete and type Indent to find the Indent Using Spaces option and set it to 4 (or 8, whatever you like).
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?
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.
With (menu-bar-mode 0) in my .emacs-file, Emacs (in a terminal) seems to be starting with the menu bar visible, and then within a fraction of a second, the bar disappears.
Is there a way to make Emacs not show the menu bar at all?
No: Emacs first starts by setting up its "frame" (which includes some initial display), then reads the .emacs file. That's why you see this flashing of the menu-bar. Emacs could read the .emacs first, but if the .emacs outputs any message or signals an error, there'd only be stderr to display it, whereas with the current setup, those messages are displayed in the minibuffer and the error can be caught in the "normal" way.
If you're runinng Linux (and I guess any system where Emacs runs in an X server), you can use X resources to tell Emacs you don't want the menu bar. Just put this in your ~/.Xresources file:
emacs.menuBar: off
These resources are used to customize frames appearance and are therefore read by Emacs at the very beginning.
See also:
Emacs manual: Menu Bars
Emacs manual: Table of Resources
man xrdb(1)
In Emacs when I hit tab anywhere on a line, the line will indent correctly (or at least to the mode settings). When I hit tab again it will move back to the next block. When programming Python this really helps since closing a block is done by lowering the indention level.
Is there a way to configure Eclipse to do the same?
Currently, I have to erase the leading white space then hit tab.
This question is a reposting of a superuser question.
Try ctrl-i (Cmd-i on osx) to indent the current line or a selection inside eclipse (if you're using default key binds as opposed to emacs). Or, if you want a different key bind, go to Appearances > General > Keys and change the bind for Correct Indentation to key(s) of your choice
In Eclipse, go to Windows -> Preference -> Java -> Formatter.
In Active Profile drop down box, select any profile, click Edit on right of it.
In Profile Dialog box opened, you can change a lot of things like Indentation, New Line, Braces, White Spaces etc.
Alternatively, if your profile is altogether different than standard one, Create a new active profile and then edit it accordingly.