Category: Emacs

emacs 注册经常访问文件

Posted by – July 19, 2016

如果你也像我那样经常用emacs访问相同的文件的话,用emacs的Register来注册你经常访问的文件,就可以用快捷键来访问他们了。不用每次都Ctrl+x Ctrl+F 找文件了。

(set-register r '(file . name))
(set-register ?e (cons 'file "~/.emacs"))
打开~/.emacs 就可以用命令 Ctrl+x r j e

Emacs manual

Emacs cheat sheet

Posted by – March 7, 2013

Some handy emacs command you may want to know for improving your speed of coding.

backward-kill-sexp, this command Kill the balanced expression preceding point.  It is bound to ESC <C-backspace>. For example,

if (n > 0) {
   transfer(n - 1, pegs, use, to, from);

To remove the whole block of the code in the if condition, place your cursor at the end of the closing bracket and run the command backward-kill-sexp, The whole block of code will be deleted.

if (n > 0) 

backward-up-list, this command ‘Move backward out of one level of parentheses.’

Set mark and pop mark. This combination of commands allows you to navigate code easily by setting a mark. <C-SPC> which sets the mark and then  <C-u C-SPC> which jumps to the last one.

How to Delete up to Non-Whitespace Characters in Emacs

Posted by – October 10, 2011

I often want to delete a lot whitespaces between one word and another and had to hit the “Delete” buttons many times. Now I just discovered this command M-^ (delete-indentation &optional arg) works perfectly for my need.

  • Category: Emacs
  • Comments Closed

Multiple Emacs Shell Buffers

Posted by – September 25, 2007

Having my work changed a lot during the last year, from a Lunix developer to a half developer half support and now are purely support, I do not have many chance to use Emacs that often anymore, but I keep to use to it as much as possible. After all it’s my first editor in my programmer career. One thing I like is its shell buffers. Unfortunately, It only support one shell as I thought before. Because if you type M-x shell to open a new shell buffer, if you already have one open that will just switch to the existing one.


Use Regular Expressions in Emacs

Posted by – April 13, 2006

What is Regular Expression? A regular expression is a special text string for describing a certain amount of text. Generally, A regular expression contains a few special characters and ordinary characters. If you have used Linux/Windows systems, you will probably familiar with wildcard notations such as *.txt to find all text files in a folder. That’s a simple regular expression example (Thanks for netcasper’s correcting . The regex equivalent to “.txt” is .*.txt). Nowadays, Most of the text editors support regular expression such as vi, emacs and Ultra Editor(not a free software). Today, I would like introduce some basic knowledge about regular expression and use it in Emacs to improve the efficiency of your coding work.


Some commands that I often use in Emacs

Posted by – August 18, 2005

Before the end of June, 2005. I never heard of `Emacs‘ despite graduating with a computer science degree. Thanks to Daniel who told me such an excellent Editor and who taught me lots of tricks.