Wenshan's emacs configuration
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Initial commit Oct 22, 2018
.gitmodules Remove awesome-tab: turned out not to use it much, also it slows down… Feb 15, 2019
LICENSE Initial commit Oct 22, 2018
README.org Remove awesome-tab: turned out not to use it much, also it slows down… Feb 15, 2019


GNU Emacs Configuration of Wenshan Ren


  • clone this repository and run git submodule update --init to clone submodules.
  • in ~/.emacs (replace <path-to-wenshan-emacs> with the actual path):
         (defvar wenshan-emacs-root-dir (file-truename "<path-to-wenshan-emacs>/site-lisp"))
         (defun add-subdirs-to-load-path (dir)
    	"Recursive add directories to `load-path'."
    	(let ((default-directory (file-name-as-directory dir)))
    	  (add-to-list 'load-path dir)
         (add-subdirs-to-load-path wenshan-emacs-root-dir)
         (require 'init)
  • start emacs, some external programs such as python-pylint are required for certain features, but you can install them when needed.

Add New Extensions

  • select the sub init file it should go into, e.g. init-startup.el.
  • find the extension’s git url and add it by M-x magit-submodule-add (path: wenshan-emacs/site-lisp/extensions/<library-name>, name: <library-name>).
  • if needed, add corresponding keybindings to init-keybinding.el.

Remove an Extension

  • M-x magit-submodule-popup, tick Force, then press k, followed with the extension path.
  • it requires git v2.12.0


  • ~/.emacs add all sub directories of wenshan-emacs/site-lisp to load-path.
  • and ~/.emacs requires wenshan-emacs/site-lisp/config/init.el: the central configuration file.
  • init.el calls a list of sub configuration files that are in wenshan-emacs/site-lisp/config/.
  • extensions are in wenshan-emacs/site-lisp/extensions/: some of them are git submodules.
  • static data (dictionaries, etc) are in wenshan-emacs/site-lisp/data/.
  • keybindings are placed in wenshan-emacs/site-lisp/config/init-keybinding.el: easier for maintenance and lookup.

Major Features and Reasoning

General Setup

No theme

I tried various color themes in the past, now I just want to use the default Emacs theme to avoid troubles because any well-designed extension should support the default theme.

Modify Emacs Defaults

  • disable tool bar, menu bar and scroll bar, I don’t use them.
  • answer y/n instead of yes/no, less typing.
  • disable bell, it’s annoying.
  • type gpg password inside emacs, rather than in a pop-up window, it’s troublesome when Emacs is full-screen.
  • set fill-column to 120, which suits my screen size better.
  • disable cursor blinking, it’s too distracting.
  • remember recently opened files
  • remember windows configuration: see winner-mode’s manual for details
  • use spaces for indentation instead of tabs: make it consistent
  • turn on org-mode for txt files: most of my txt files are in org format

Auto Save


After using auto-save for a while, I decided to switch back to super-save.

I don’t need to save files on idle, e.g. when working on a nodejs project with nodemon enabled, I don’t want auto-save triggers re-run all the time.


I use lazycat’s auto-save extension, it saves the buffer if Emacs has been idle for 1 second (by default, customizable). I prefer it over super-save because:

  • can be configured to be silent -> I don’t like seeing the message again and again in the mini-buffer
  • does smart white space trailing
  • works out of box

Cursor Moving


I don’t use it very often, going to find out more about it.

Find it is useful when bundled with vi-navigate. I bound it to /, so in read-only modes such as Info-mode, I can press /, followed with two keystrokes to get to where I want (so I can then press y to trigger sdcv for translation).


It’s easier for me to press single keys to move around in read only modes, vi-navigate adds keybindings to a list modes that are supposed to be read-only.

e for previous page, space for next page, and jklh for four directions.

Also, Emacs has a built-in view-mode, I’ve changed its keybindings to match vi-navigate.


Watch Emacs Rocks to find out its awesomeness.


Move things up and down, sometimes it’s easier than kill and yank.


It’s distracting to use a laptop when you touch the touch-pad without intention and it changes where your cursor is all the time.

Buffers And Windows Switching


Label each window with a number and press M-<num> to jump to it, best way of windows switching in my opinion.

awesome-tab: don’t use it often after trying for a while.

An improved version of tabbar, I use it in combination with helm buffer switching. It reduces the burden of remembering opened buffer names.


Undo And Redo


Emacs has a powerful undo system, undo-tree makes it easier to use by visualizing edits history as a tree.

Font Settings

Dejavu Sans Mono for English and Wenquanyi (文泉驿) for Chinese, reasons:

  • available on Debian GNU/Linux
  • free software
  • can be aligned nicely in org-mode tables

Self Defined Functions


Edit any text areas in Firefox/Chrome, need to install corresponding browser plugins.

Version Control


The best git interface.


Media Player


I use mplayer as its player and emms just works out of box.

Project Interaction





I like eshell and aweshell is an enhanced eshell.


parenthesis completion

I prefer paredit over smartparens for its simplicity. Then Lazycat published awesome-pair based on the idea of paredit and I switched to it.


code folding

Used to use yafoding, but it seems hs-minor-mode is sufficient after configuration.


Trying out for python hacking. => replaced by lsp, which provides better python hacking experience.


replaced by lsp

lsp language server protocol

  • emacs-lsp integrates well with flycheck, native completion-at-point, eldoc, imenu, and xref-find-definition/references.
  • it also provides some refactoring features.
  • can be used with dap-mode to provide better debugging experience.


I use Anki to help remembering things: reading notes, ideas, etc.

anki-editor provides a way to add Anki card from Emacs.



在 GNU/Linux 下,经常碰到 Emacs 无法调用系统输入法的问题。我之前自己改写了 eim,以便使用双拼,后来发现了源于 eim 的 pyim,简单易用且支持双拼,于是换用 pyim。



王勇写的星际译王插件,可以在 Emacs 中调用字典查词。




All keybindings are set in site-lisp/config/init-keybinding.el. This is to have a central place for finding keybindings.

Besides that, hydra is used to provide “menus”, by default you can press s-c to start the top menu.


  • one-key from lazycat, I do forget keybindings from time to time. -> hydra seems to work fine
  • expand-region
  • yafolding, need to compare the existing code folding extensions first -> built-in hs-minor-mode seems to be sufficient