eintr: Miscellaneous
16.13 Miscellaneous Settings for a ‘.emacs’ File
================================================
Here are a few miscellaneous settings:
− Set the shape and color of the mouse cursor:
; Cursor shapes are defined in
; '/usr/include/X11/cursorfont.h';
; for example, the 'target' cursor is number 128;
; the 'top_left_arrow' cursor is number 132.
(let ((mpointer (x-get-resource "*mpointer"
"*emacs*mpointer")))
;; If you have not set your mouse pointer
;; then set it, otherwise leave as is:
(if (eq mpointer nil)
(setq mpointer "132")) ; top_left_arrow
(setq x-pointer-shape (string-to-int mpointer))
(set-mouse-color "white"))
− Or you can set the values of a variety of features in an alist,
like this:
(setq-default
default-frame-alist
'((cursor-color . "white")
(mouse-color . "white")
(foreground-color . "white")
(background-color . "DodgerBlue4")
;; (cursor-type . bar)
(cursor-type . box)
(tool-bar-lines . 0)
(menu-bar-lines . 1)
(width . 80)
(height . 58)
(font .
"-Misc-Fixed-Medium-R-Normal--20-200-75-75-C-100-ISO8859-1")
))
− Convert ‘<CTRL>-h’ into <DEL> and <DEL> into ‘<CTRL>-h’.
(Some older keyboards needed this, although I have not seen the
problem recently.)
;; Translate 'C-h' to <DEL>.
; (keyboard-translate ?\C-h ?\C-?)
;; Translate <DEL> to 'C-h'.
(keyboard-translate ?\C-? ?\C-h)
− Turn off a blinking cursor!
(if (fboundp 'blink-cursor-mode)
(blink-cursor-mode -1))
or start GNU Emacs with the command ‘emacs -nbc’.
− When using ‘grep’
‘-i’ Ignore case distinctions
‘-n’ Prefix each line of output with line number
‘-H’ Print the filename for each match.
‘-e’ Protect patterns beginning with a hyphen character, ‘-’
(setq grep-command "grep -i -nH -e ")
− Find an existing buffer, even if it has a different name
This avoids problems with symbolic links.
(setq find-file-existing-other-name t)
− Set your language environment and default input method
(set-language-environment "latin-1")
;; Remember you can enable or disable multilingual text input
;; with the toggle-input-method' (C-\) command
(setq default-input-method "latin-1-prefix")
If you want to write with Chinese GB characters, set this instead:
(set-language-environment "Chinese-GB")
(setq default-input-method "chinese-tonepy")
Fixing Unpleasant Key Bindings
..............................
Some systems bind keys unpleasantly. Sometimes, for example, the <CTRL>
key appears in an awkward spot rather than at the far left of the home
row.
Usually, when people fix these sorts of keybindings, they do not
change their ‘~/.emacs’ file. Instead, they bind the proper keys on
their consoles with the ‘loadkeys’ or ‘install-keymap’ commands in their
boot script and then include ‘xmodmap’ commands in their ‘.xinitrc’ or
‘.Xsession’ file for X Windows.
For a boot script:
loadkeys /usr/share/keymaps/i386/qwerty/emacs2.kmap.gz
or
install-keymap emacs2
For a ‘.xinitrc’ or ‘.Xsession’ file when the <Caps Lock> key is at the
far left of the home row:
# Bind the key labeled 'Caps Lock' to 'Control'
# (Such a broken user interface suggests that keyboard manufacturers
# think that computers are typewriters from 1885.)
xmodmap -e "clear Lock"
xmodmap -e "add Control = Caps_Lock"
In a ‘.xinitrc’ or ‘.Xsession’ file, to convert an <ALT> key to a <META>
key:
# Some ill designed keyboards have a key labeled ALT and no Meta
xmodmap -e "keysym Alt_L = Meta_L Alt_L"