Previous: Setting Variables, Up: Other Customizations [Contents][Index]
For customizing Emacs, you need to put Lisp expressions in your init.el file. The following are some useful Lisp expressions. If you find any of them useful, just type them in your init.el file:
(setq c-tab-always-indent nil)
The value of the variable c-tab-always-indent
is usually ‘t’
for ‘true’. When this variable is true, then hitting the TAB
key always indents the current line.
(setq text-mode-hook 'turn-on-auto-fill)
This mode will automatically break lines when you type a space so that
the lines don’t become too long. The length of the lines is controlled
by the variable fill-column
. You can set this variable to a value
you wish. Look at the documentation for this variable to see its default
value. To change the value to 75 for example, use:
(setq-default fill-column 75)
This will change the value of this variable globally.
(put 'eval-expression 'disabled nil)
Now when you use eval-expression, it will print the value of the expression you specify in the echo area without confirming with you.
(global-set-key "\C-x\C-c" nil)
Now if you type C-x C-c, you won’t exit Emacs.
(global-set-key 'backspace [delete])
(setq-default case-fold-search nil)
If we use "setq" instead of "setq-default" then searches will be case-sensitive only in the current buffer’s local value. In this case the buffer would be the init.el file. Since this would not be too helpful and we want to have case-sensitive searches in all buffers, we have to use "setq-default".
(add-hook 'texinfo-mode-hook 'turn-on-font-lock)
See Minor Modes, for information on font-lock mode.
make-symbolic-link
:
(global-set-key "\C-xl" 'make-symbolic-link)
We use the single quote before "make-symbolic-link" because its a function name. You can also use the following expression which does the same thing:
(define-key global-map "C-xl" 'make-symbolic-link)
make-symbolic-link
in C mode only:
(define-key c-mode-map "C-xl" 'make-symbolic-link)
Instead of binding C-xl to run make-symbolic-link
, you can
bind the F1 key to run this function:
(define-key c-mode-map 'f1 'make-symbolic-link)
Here, you have to use lower case for naming function keys like F1.
undo
i.e. C-x u to any key, for
example to F2:
(global-set-key 'f2 'undo)
(display-time)
(setq line-number-mode t)
(setq zmacs-regions nil)
Now if you use a command like C-x C-p (mark-page
), the text
will not be highlighted.
buffers-menu-max-size
to
whatever value you wish. For example, if you want 20 buffers to be listed
when you select Buffers use:
(setq buffers-menu-max-size 20)
(setq frame-title-format "%S: %f")
(set-menubar nil)
(load "big-menubar")
If you want to write your own menus, you can look at some of the examples in /usr/local/share/sxemacs/xemacs-packages/lisp/edit-utils/big-menubar.el file.
For more information on initializing your init.el file, See Init File in SXEmacs User’s Manual. You should also look at /usr/local/share/sxemacs-VERSION/etc/sample.init.el, which is a sample init.el file. It contains some of the commonly desired customizations in Emacs.
Previous: Setting Variables, Up: Other Customizations [Contents][Index]