views:

127

answers:

3

I was learning Vim and now I'm experimenting with Emacs. In Vim, for instance, I could hide the toolbar by adding a "set" command in the _vimrc file.

How is the customization approach in Emacs, for instance, if I want to hide the toolbar?

+1  A: 

I presume you did not try

M-x customize

which is just about the most obvious choice -- and also accessible via the menu.

Edit: If you want to hide the toolbar, try the menu via Options -> Show/Hide -> Toolbar.

Dirk Eddelbuettel
I don't think that is at all obvious to someone new to emacs. Learning to use "C-h a <search>" is really useful though. This calls `apropos' and finds any functions that match the name. So if you want to learn how to do something then apropos is a good starting point.
justinhj
+9  A: 

Emacs is customised using scripts written in it's own variant of the lisp programming language called elisp.

The usual way emacs power users make customisations is to write snippets that will achieve the desired effect and in a .emacs file situated in their home areas. This file gets loaded up when emacs starts (similar to the .vimrc file for vim).

Hiding the tool bar for example is accomplished using

(tool-bar-mode nil) 

In your .emacs

I'd recommend that you first go through the manual and then if you're feeling curious the emacs lisp tutorial.


Alternatively, if you're not comfortable editing elisp, you can use the inbuilt customisation system. You can launch it using M-x customize RET (RET is "hit enter" in emacs speak and M-x is done by holding down (normally) the alt key and hitting x).

The customisation interface allows you to use select the features you want to enable disable (although the sheer number of these can get overwhelming) and 'save' the settings (which just writes out elisp code for the settings you selected into your .emacs file).

Noufal Ibrahim
Me, I use both, depending on my mood.
jae
I would *recommend* `customize`. I just wanted to point out that it's there. :)
Noufal Ibrahim
No only is `customize` a little overwhelming, but it does not allow to change everything you can change with plain old elisp. When I was introduced to Emacs, there were second-year students you could copy the `.emacs` from to get an idea of what was possible. This method is not available to everyone and it has its drawbacks (transient-mark-mode for instance is in retrospect somewhat of a crutch best done without), but it is still close to the best way...
Pascal Cuoq
when I hit customize there are a lot of groups like browse, face, group, variable...where can I find hidetoolbar?
janoChen
There's no straightforward way really. It's similar to asking how do you know which variable to `set` in your `.vimrc`. You can however do `M-x customize-variable` and then type `tool` and hit <tab> for completions. `tool-bar-mode` should show up and that's fairly self explanatory.
Noufal Ibrahim
thanks Noufal Ibrahim. It worked.
janoChen
I'd recommend you hang around on emacswiki.org and on the IRC channel #emacs on freednode. I learnt most of my Emacs-fu from those places. In case it helps, Emacs has an inbuilt chat client called `erc` (`M-x erc-select RET`) to use it.
Noufal Ibrahim
A: 

This answer addresses where Emacs stores customized settings, and how you can write your own customization settings to be loaded each time you start Emacs.

First, there's a file designated by the variable user-init-file that designates which user-specific file to load upon starting. Its value is usually the file .emacs within your home directory. Some versions of Emacs have used mangled names on Windows like _emacs on the assumption that the leading dot was intolerable. Somewhat confusingly, you can customize that variable too.

Absent a change to the normal behavior, Emacs will save customizations you make through its menus into this file. Hence, many users like to keep the customization ELisp code they've written by hand in a different file that Emacs won't disturb.

At the head of my ~/.emacs file, I have the following form:

(load-file "~/.emacs.d/init.el")

In a separate directory, ~/.emacs.d, I had a slew of ELisp files that the aforementioned init.el references, loading them under different conditions.

When running Emacs on a shared system (Linux, for example), there are usually site-related customization files that Emacs loads as well. That way, an administrator can make some settings available to all users, who can later override and extend those site-related settings in their own customization files.

seh