Emacs Tips

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

CommandsComments
C-q C-jinsert 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 ESCrepeat-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 kdescribe-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 l100 keystrokes
Lists the last 100 keystrokes.
C-h fdescribe-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 vdescribe-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-modeHex 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 calendarCalendar
A calendar.
M-x calculatorCalculator
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.

 

From : http://www.khngai.com/emacs/tips.php

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值