Emacs Tips
Some of the useful Emacs features are not obvious to users.
Here are just some things that I have figured out the hard way.
Get Around Backspace Problem During Search
If you have used XEmacs before, you would have noticed
while typing a search word in GNU Emacs, hitting the backspace key will
not modify the search word, but delete a charater in the
edit buffer. This is sometime annoying. Here is the fix.
(define-key isearch-mode-map '[backspace] 'isearch-delete-char)
Useful Emacs Commands
Commands |
Comments |
C-q C-j |
insert new line
This will insert a newline character in the buffer.
It is especially useful when trying to insert a newline
in the minibuffer.
|
M-: |
eval-expression
After typing the command, you can invoke an interactive
lisp command with argument. For example, (forward-char 10).
|
C-x ESC ESC |
repeat-complex-command
After typing the command, you will see "Redo: (....)"
at the mini buffer. the (....) is the last command
you have executed through the mini buffer. You may
press enter to execute the command. Or you may press
alt-p or alt-n to select from the history of commands
that you have executed through the mini buffer.
|
C-h k |
describe-key
After typing the command, you will see the "Describe Key:"
prompt in the mini buffer. Now you can press any combination of
keys to check what function is bound to the keys.
|
C-h l |
100 keystrokes
Lists the last 100 keystrokes.
|
C-h f |
describe-function
After typing the command, you will see the "Describe Function:"
prompt in the mini buffer. Now you can enter a function name,
for example forward-char. The description of the function
will be shown in another buffer.
|
C-h v |
describe-variable
After typing the command, you will see the "Describe Variable:"
prompt in the mini buffer. Now you can enter a variable name,
for example inhibit-read-only. The description of the variable
will be shown in another buffer.
|
M-x hexl-mode |
Hex Editor Mode
While viewing a file, you may invoke the command to view the file
in Hex/Binary mode. It allows you to "hex edit" the file. To insert
a hex string, use "M-x hexl-insert-hex-char" or "M-x hexl-insert-hex-string".
The external program used is distributed together with GNU Emacs.
This means no additional installation is required.
|
M-x calendar |
Calendar
A calendar.
|
M-x calculator |
Calculator
This is a handy calculator. You can do number conversion
with the following commands.
D - to decimal
X - to hexadecimal
O - to octal
B - to binary
|
M-x occur |
Find the occurence of a specified string
While visiting a buffer, this utility allows you to list
out all the occurence of a specified regular expression.
|
|