Emacs for All, All for Emacs

Emacs for All, All for Emacs

Emacs for All, All for Emacs

It has been a long time since I began working with emacs, one of the greatest editors in Linux systems. It is really hard for a beginner to learn how to use it, especially for those who are addicted to the GUI, using emacs means that all the work done by clicking the mouse before is replaced by the various key strikes. I can still remember I had a difficult time adjusting to emacs, but It turns out that the more I learn about emacs, the more I feel I need to learn. Nearly all the work can be done under it (with the help of numerous plug-ins), So, in this article, I will record my emacs configuration and the useful tools I find during the past two years of using emacs. I do this because I want to have an easy time next time when I re-install the OS, or I can easily set up the familiar environment when I work with others somewhere not on my own computer.

As always, I will take the Q&A form of writing styles, to make it clean and simple, most of all, make it useful to not only myself but the vast majority who are using emacs.

1 How to enable Chinese input in emacs?

2 Is it possible to use version control tools like svn, git, cvs…?

As long as you can think, there are always some ".el" files waiting for you on the Internet, you can easily find them, and the good news is emacs enable you use svn, cvs directly, it will automatically recognize the version-ed files and you can use simple commands(key strikes) to update, commit and add files to your repository.
The most often used commands of svn:

And the corresbonding key strokes:

3 How do I make emacs recognize the version-controlled files?

The only thing to do is to open these files with emacs:
For example:

svn co https:172.31.8.31:4430/svn/project

will checkout the files from a svn server, and emacs will recognize them automatically.

4 How to use latex in emacs?

5 where can I get the configuration files of emacs?

svn checkout http://emcs-bk.googlecode.com/svn/trunk/ emcs-bk-read-only

The above link is available, and can be checked out with svn.

6 The most common command used in Linux eshell

uncompress *.tar.bz2 file: tar -jxvf *.tar.bz2

7 How to make fast switch between dual monitors?

It is necessary to start a new frame in emacs so that the emacs will keep a single input stream for all the frames. The command to use is C-x 5 2, or File->New Frame.
After creating a new frame, bind the short key for switching the frame.

(global-set-key (kbd "M-RET") ‘other-frame)

8 How to install another font to Ubuntu and Fedora?

Recently, I learned about a programming-friendly font named M+, and I want to use it in emacs, the following steps should be done to do this:

sudo apt-get install fonts-mplus (or yum install)

In .emacs file, add/modify the following line:

(set-default-font "M+ 2c 13")))

9 How to use tramp to make local emacs capable of editing remote files?

Open file in remote machine:

c-x c-f /ssh:[email protected]:~/work/somefile

When the files changed in remote directory, it is likely that emacs tramp will not be able to stay synchronized with the latest change, that means, the command c-x c-f will not find the newly added files or directories. In this case, the ido auto-complete should be refreshed, using the following command:

"M-x ido-reread-directory"

10 Use multi-term mode in emacs for full-functioning terminal emulation.

The eshell tries to provide the simple operations of a standard shell like bash, but it lacks some basic functions like input redirection, so I changed the eshell to multi-term in my configure file.

  ;;目的是开一个shell的小buffer,用于更方便地测试程序(也就是运行程序了),我经常会用到。
;;f8就是另开一个buffer然后打开shell,C-f8则是在当前的buffer打开shell,shift+f8清空eshell
(defun open-eshell-other-buffer ()
  "Open eshell in other buffer"
  (interactive)
  (split-window-vertically)
  (eshell))
;;I changed the eshell to multi-term, because multi-term is much more functional than eshell
(defun open-term-other-buffer ()
  "Open eshell in other buffer"
  (interactive)
  (split-window-vertically)
  (multi-term))

Author: wujing

Created: 2014-10-18 六 11:09

Emacs 24.3.1 (Org mode 8.2.6)

Validate

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。