Skip to content

IntelDan/emacs.d

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Help me, Help you

You can make this setup better.

Checklist

Before continue, please read this checklist at first.

  • I recommend Emacs 24.3.1
  • If you want to start immediately please read the section “Install stable version in easiest way”
  • Emacs 24.4 is supported
  • I use Vim key bindings. See the section Tips if you prefer native key bindings
  • People in (China, North Korea, Cuba, Iran …) need goagent to download packages. Run command “http_proxy=http://127.0.0.1:8087 emacs -nw” in shell after starting goagent server
  • C++ developers need set up the directories to seach C++ header files. Please see the section `clang`.
  • I suggest windows users using Cygwin. But the setup is still usable in native windows version if you set up environment variable HOME.
  • My first priority is stable. So I whitelist packages from melpa-unstable. It means packages from melpa-unstable are invisible by default. Modify variable melpa-include-packages in lisp/init-elpa.el if you need install any package from melpa-unstable.
  • Bug report should include details (OS, Emacs version …) and the output of `emacs –debug-init` at minimum
  • If a package is not installable through melpa, you can place its code at ~/.emacs.d/site-lisp. There are already some samples there
  • Remove bundled emacs 22 at first if you are using OS X!
  • If you use unicode in the setup, please make sure your locale is UTF-8 compatible. For example, if I type `locale` in shell, I will get the correct output containing string “zh_CN.UTF-8”

General

Most popular languages are supported (C/C++/Java/Ruby/Perl/Python/C#/Lua/Javascript …).

Tested with v23.4, v24.3.1, v24.4

Please contact the original developer if you have any issue with some plugin. EmacsWiki can help, btw.

A short tutorial for newbie is at section Emacs quick guide.

If you need a detailed guide, check my Master Emacs in One Year.

Features

  • 100% usable in terminal
  • Real time HTML syntax checker
  • git or subversion is NOT required. You don’t need run `git submodule update`
  • optimized for cross-platform C++ development with CMake
  • emacs-w3m (console web browser)
  • eim (Chinese pinyin input method), check the FAQ for installation
  • the setup work on ALL platforms (Linux/Cygwin/Mac).
  • The setup usable with Emacs 23
  • evil-mode and its plugins (Vim key binding) bundled
  • yasnippet bundled

Install

If you prefer the method described in the section “Install stable version in easiest way”, you don’t need read this section..

Please remove the file “$HOME/.emacs”.

Uninstall any system Emacs plugins. For example, run “apt-get uninstall emacs-w3m” in Debian/Ubuntu to remove emacs-w3m. It’s because all plugins will be placed at “$HOME/.emacs.d” from now on.

Download this zip file and extract its content into ~/.emacs.d .

Or run command “cd ~; git clone https://github.com/redguardtoo/emacs.d.git .emacs.d” in terminal.

Ensure that the init.el contained in this repo ends up at ~/.emacs.d/init.el.

You can use stable version of my setup only. Stable version has been regression tested by volunteers from time to time. “cd ~/.emacs.d/;git checkout stable” to get the stable version.

You possibly need run below command at the terminal at least once to update the content from package repositories:

emacs -nw --batch -l ~/.emacs.d/init.el -f package-refresh-contents

The command “package-refresh-content” will fetch the latest package list from remote servers. It has to be done manually. It’s not reasonable to automatically fetch the list for a normal text editor.

Emacs quick guide

Step 1, Learn OS basics

Read wikipedia in order to know,

  • What is environment variable
  • What is pipe, stdout, stdin

Step 2, Read official tutorial at least once

Press “C-h t” (C means Ctrl) to read tutorial.

At minimum you need know:

  • How to move cursor
  • How to open help. Press “C-h v” and “C-h f”.

Step 3, Know org-mode basics

Org-mode is a for notes-keeping and planning. Please watch the Carsten Dominik’s talk. It’s really simple. The only hot key you need remember is “Tab”.

Step 4, Solve your first specific problem

For that specific problem, you can visit EmacsWiki for the solution. Newbies can ask for help on http://www.reddit.com/r/emacs/.

Directory structure

init.el is the main file. It includes all the other *.el files.

“lisp/init-elpa.el” defines how and what packages will be installed from elpa/marmalade/melpa by package manager.

The package manager will extract packages into ~/.emacs.d/elpa/.

I also manually download and extract some packages into ~/.emacs.d/site-lisp/. Packages in ~/.emacs.d/site-lisp/ is not visible to Emacs package manager.

My own snippets for Yasnippet is at ~/.emacs.d/snippets.

Other directories do not matter.

Third party command line tools

They are OPTIONAL. Your Emacs will not crash if they are not installed.

w3m (web browser in console)

  • needed by `w3m` (w3m is emacs package name written in elisp)
  • install through OS package manager
  • please note only emacs with GUI can display image

lua

  • required by `flymake-lua`
  • install through OS package manager

aspell or hunspell

  • needed by `flyspell`
  • hunspell is the alternative of `aspell`. So you need only one of them.
  • install through OS package manager
  • for aspell, you may need its dictionary like aspell-en
  • I force the dictionary to “en_US” in init-spelling.el. You can modify it in init-spelling.el.
  • I recommend aspell for programmers

sbcl (lisp environment)

  • needed by lisp `slime`
  • install through OS package manager

tidy or html5-tidy

  • needed by `web-mode` for real time HTML syntax check
  • install through OS package manager
  • For html5-tidy, you need download its source code and build it manually
  • I recommend html5-tidy because it supports html5

csslint

  • install `node.js` through OS package manager, then `sudo npm install -g csslint`

zip and unzip

  • needed by `org-mode` to export org file to odt file
  • install through OS package manager

jshint

  • install `node.js` through OS package manager, then `sudo npm install -g jshint`
  • required by js-mode
  • by default I use js2-mode which does NOT need jshint

xsel

  • needed by my clipboard command `copy-to-x-clipboard` and `paste-from-x-clipboard` under Linux
  • install through OS package manager
  • needed by `cpputils-cmake`, `company-clang`
  • install through OS package manager
  • If you use `cpputils-cmake` and `cmake`, `cpputils-cmake` will do all the setup for you. You don’t need read next item! But please spend a few minutes to learn the basics of cmake! There is a one minute step-by-step-guide in README of cpputils-cmake to teach you how to use cmake.
  • If you use `company-clang`, add `(setq company-clang-arguments ‘(“-I/example1/dir” “-I/example2/dir”))` into ~/.emacs.d/init.el

GCC/Make

  • needed by `flymake`
  • install through OS package manager
  • needed by MozRepl
  • used by Firefox
  • needed by `ggtags.el`
  • it creates index files for code navigation
  • more advanced than ctags, supports references and better performance
  • install through OS package manager

pyflakes

  • You need pyflakes for real time python syntax checker like `flymake-python`
  • Install pip through OS package manager, then `pip install pyflakes`
  • On cygwin you need install `setuptool` in order to install `pip`.

libreoffice

  • Only one executable `soffice` needed when converting odt file into doc (Microsoft Word 97)
  • conversion will happen automatically when exporting org-mode to odt
  • The conversion command is in variable `org-export-odt-convert-processes`
  • Install through OS package manager

js-beautify

  • To beautify javascript code (insert extra space, for example)
  • Install pip through OS package manager, then `pip install jsbeautifier`

syntaxerl

What is “OS package manager”

  • apt-cyg at Cygwin
  • homebrew at Mac
  • any package manager at Linux (apt-get at Ubuntu, yum at Redhat, pacman at Arch, emerge at Gentoo …)

Install stable version in easiest way

You don’t need git or network any more. All you need are only two zip files.

Here are the exact steps you need follow:

  • Remove the file “~/.emacs”.
  • Uninstall any system Emacs plugins. For example, run “apt-get uninstall emacs-w3m” in Debian/Ubuntu to remove emacs-w3m. It’s because all plugins will be placed at “$HOME/.emacs.d” from now on.
  • Download https://github.com/redguardtoo/emacs.d/archive/1.2.zip
  • Extract its content into empty directory “~/.emacs.d” (“~” means HOME directory). After extraction, there will be a file named “init.el” in “~/.emacs.d”
  • Download https://github.com/redguardtoo/myelpa/archive/1.2.zip
  • Extract the zip somewhere, say “~/projs/myelpa”.
  • Double check that there is a file named “archive-contents” in the directory “~/projs/myelpa”
  • Uncomment below code in ~/.emacs.d/lisp/init-elpa.el and start Emacs now!
(setq package-archives '(("myelpa" . "~/projs/myelpa/")))

That’s it. You will never need internet in the future. I tested it on Emacs 24.3.93.1, Emacs 24.3.1 and Emacs 23.4.

Please note that your packages are locked. So you cannot upgrade package online in the future unless you comment out above code line.

I don’t recommend advanced users locking their packages.

Report bug

Please file bug report at https://github.com/redguardtoo/emacs.d. Don’t email me directly!

Tips

By default EVIL (Vim emulation in Emacs) is used. You can comment out line containing “(require ‘init-evil)” in init.el to unload it.

Some package cannot be downloaded automatically because of network problem.

You need manually `M-x list-packages` and install it or just `M-x package-refresh-content` and restart Emacs.

If you use `gnus` for email (Gmail, for example). Check ~/.emacs.d/init-gnus.el which includes my most settings except my private stuff. Here is my Gnus tutorial.

To toggle Chinese input method (eim, for example), run command `M-x toggle-input-method`.

FAQ

Please contact the original plugin developer if you find any plugin bug. My answer may be outdated soon.

Why auto-completion/intellisense does not work?

I assume you use company-mode. Other plugins have similar setup.

At minimum:

  • You need install clang
  • Make sure your code is syntax correct at the beginning
  • assign reasonable value into company-clang-arguments

Here is sample setup in ~/.emacs:

(setq company-clang-arguments '("-I/home/myname/projs/test-cmake" "-I/home/myname/projs/test-cmake/inc"))

In “friendly” Visual C++, you need do similar setup.

Use color theme in the terminal

TERM=xterm-256color emacs -nw

Avoid Emacs maximized when it starts up

Comment out below line in init-misc.el:

(add-hook 'window-setup-hook 'maximize-frame t)

Preview&apply a color theme?

Check http://emacsthemes.caisah.info/.

Write down the name of color theme (for example, molokai).

Insert below code into ~/.emacs.d/init.el,

(require 'color-theme-molokai)
(color-theme-molokai)

“M-x color-theme-select” may not work in this setup. It’s because of some design flaw in Emacs.

Update from my latest setup

I suggest pulling from the version tagged as “stable”:

git pull https://github.com/redguardtoo/emacs.d.git stable

If you don’t like some of my commits, you can revert them:

# always start from the latest related commit
git revert commit-2014-12-01
git revert commit-2014-11-01

Eim pinyin word file

By default, the word files path is at “~/.eim/py.txt”. I put it out of the emacs setup folder in order to protect your privacy.

The path can be changed in ~/.emacs.d/lisp/init-eim.el

A sample py.txt can be downloaded at HERE.

My personal custom.el (OPTIONAL)

It’s publicized at http://blog.binchen.org/?p=430. It contains my personal stuff which is useless to you.

About Emacs 23

Emacs 23 support will be dropped on <2015-04-24 Thu>. Currently Emacs 23 does not support following packages:

  • helm
  • org-mode and its third party packages
  • company-mode
  • git-gutter
  • yasnippet
  • ggtags-mode

About

purcell's emacs configuration plus C/C++ support

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Emacs Lisp 82.0%
  • Common Lisp 15.5%
  • Scheme 1.8%
  • Perl 0.2%
  • Ruby 0.2%
  • Makefile 0.1%
  • Other 0.2%