Skip to content
An Emacs configuration bundle.
Branch: master
Clone or download
Latest commit 0fd2804 Jul 20, 2019

README.md

Build Status Emacs Release Tag License Support me

jcs-emacs-init

An Emacs configuration bundle.

This is Jen-Chieh Shen's emacs configuration. Repeatedly utilized and modified since 2015. Hopefully this will help someone who is new or struggling with Emacs. This configuration should works on most OSs, indicates Windows, Linux and MacOS.

Emacs itself supports multiple programming languages. I managed all the programming languages I personally used. I dabble in numerous technologies, incorporate hardware, firmware and software. Here is the list of programming languages I know and are extended from this configuration.

  • ActionScript 2.0 or 3.0 / Assembly Language
  • BASIC / Batchfile
  • C / C++ / C# / Clojure / CMake / COBOL / CSS
  • Dart
  • Elixir / Emacs Lisp / Erlang
  • GLSL / Go / Godot Script
  • Haskell / Haxe / HTML
  • INI
  • JSON / Java / JavaScript
  • Lisp / Lua
  • Makefile / Markdown
  • Object Pascal (Delphi) / Objective-C
  • Pascal / Perl / PHP / Properties / Python
  • Ruby / Rust
  • Sass / Scala / SCSS / Shader / Shell script / SQL / Swift
  • Text / TypeScript
  • Verilog / Vim script
  • XML
  • YAML

This configuration polished and goes toward to the modern text editor, or even better, it goes beyond modern IDE. e.g. Atom, Brackets, Sublime Text 2 or 3, Visual Studio Code, etc.

Philosophy

I have experienced many different kinds of IDEs and text editors. But I’ve had a hard time finding the best tool to use. I’ve jumped from one working field to another trying to find something that suits my needs. So instead of struggling with the tool itself, I chose Emacs and configured the entire thing from scratch, to suit my needs.

Here are a few goals that I want this config to accomplished.

  • Having the same set of key bindings across different IDEs and text editors as many as possible.
  • Having the same font and theme across different OSs and environments.
  • Automating trivial or redundant tasks.
  • Improve user experiences approach to modern text editor or IDE.
  • Make compatible to most features work inside terminal as well.

Having these implementations makes my life easier, and having a genuinely portable workspace, which is great because it lets me work on different machine efficiently, without having to get used to an new IDE.

Startup Time

The average startup time for this configuration is around 15 to 25 seconds. You can use command emacs-init-time to check the startup time on your machine. Not quite sure what causes that much of performance, hopefully, I'm able to lower the startup time down to 5 to 15 seconds.

Edit 1: After version 5.3.2, the average startup time is around 5 to 15 seconds. Solved this issue by removing unnecessary require keyword load file and use :defer keyword with use-package package to delay some packages load time.

P.S. Here is a great article about Speeding Up Emacs written by Anurag Peshne.

Edit 2: If you compiled the source code then the startup time can lower down more from 0.5 to 1.5 seconds.

Edit 3: Using esup package to test and optimize the configuration. Call package-refresh-contents only when package installation is needed. By doing thing, lower the startup time from around 4 to 8 seconds.

P.S. Some good hints from one StackExchange question, What can I do to speed up my start-up? answered by Jordon Biondo.

Features

This is the list of features that are built-in to this configuration. These features are heavily base on my personal habits, and so these could be very tiny things. But I believed detials make things better and make life smoother.

Package Archives

A list of package archives that this configuration uses.

  • elpa - The default package repository for GNU Emacs.
  • marmalade - Marmalade is an ELPA compatible package repository that allowed users to upload their own packages.
  • melpa - MELPA is a growing collection of package.el-compatible Emacs Lisp packages built automatically on our server from the upstream source code using simple recipes.

P.S. Here is a good talk comparing all package archives from a StackExchange question, What are the practical differences between the various Emacs Package Repositories? answered by Tikhon Jelvis.

Powered by

Here is the list of all packages that powered and make this configuration works. Thanks to all the package maintainers; this configuration cannot be made without them, and if you wish to support them you can go to this elisp-maintainers repo/site and search for the maintainer you want to support. There should be some kind of methods that you could support the maintainer you want.

Functionalities

File Modes

If you want to change the default mode to certain file type, you might want to checkout the ./.emacs.jcs/jcs-mode.el file. You will see a list of mode that are opened by default mode to certain extension.

Programming Modes

Language Mode Description Version
ActionScript 2.0 or 3.0 actionscript-mode A simple mode for editing Actionscript 3 files MELPA
Assembly Language nasm-mode NASM x86 assembly major mode MELPA
BASIC basic-mode major mode for editing BASIC code MELPA
Batchfile bat-mode Major mode for editing Dos scripts (batch files) Builtin
C c-mode Major mode for editing C code. Builtin
C++ c++-mode Major mode for editing C++ code. Builtin
C# charp-mode A major-mode for editing C# in emacs MELPA
Clojure clojure-mode Major mode for Clojure code MELPA
CMake cmake-mode major-mode for editing CMake sources MELPA
COBOL cobol-mode Mode for editing COBOL code Builtin
CSS css-mode Major mode to edit CSS files Builtin
Dart dart-mode Major mode for editing Dart files MELPA
Elixir elixir-mode Major mode for editing Elixir files MELPA
Emacs Lisp elisp-mode Emacs Lisp mode Builtin
Erlang erlang-mode Major modes for editing and running Erlang MELPA
GLSL glsl-mode major mode for Open GLSL shader files MELPA
Go go-mode Major mode for the Go programming language MELPA
Godot Script gdscript-mode Major mode for editing Godot GDScript files MELPA
Haskell haskell-mode A Haskell editing mode MELPA
Haxe haxe-mode An Emacs major mode for Haxe MELPA
HTML web-mode major mode for editing web templates MELPA
INI ini-mode Improved JavaScript editing mode MELPA
JSON json-mode Major mode for editing JSON files. MELPA
Java java-mode Major mode for editing Java code. Builtin
JavaScript js2-mode Improved JavaScript editing mode MELPA
Lisp lisp-mode Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp. Builtin
Lua lua-mode a major-mode for editing Lua scripts MELPA
Makefile makefile-mode A major mode for editing makefiles. Builtin
Object Pascal (Delphi) opascal-mode major mode for editing Object Pascal source in Emacs Builtin
Objective-C objc-mode Major mode for editing Objective C code. Builtin
Pascal pascal-mode Major mode for editing Pascal source in Emacs. Builtin
Perl perl-mode Major mode for editing Perl code. Builtin
PHP web-mode major mode for editing web templates MELPA
Properties conf-javaprop-mode Conf Mode starter for Java properties files. Builtin
Python python-mode Python major mode MELPA
Ruby ruby-mode Major mode for editing Ruby code. Builtin
Rust rust-mode A major emacs mode for editing Rust source code MELPA
Shader shader-mode Major mode for shader MELPA
Sass ssass-mode Edit Sass without a Turing Machine MELPA
Scala scala-mode Major mode for editing Scala MELPA
SCSS scss-mode Major mode for editing SCSS files MELPA
Shell script sh-mode Major mode for editing shell scripts. Builtin
SQL sql-mode Major mode to edit SQL. Builtin
Swift swift-mode Major-mode for Apple's Swift programming language. MELPA
TypeScript typescript-mode Major mode for editing typescript MELPA
Verilog verilog-mode Major mode for editing Verilog code. Builtin
Vim script vimrc-mode Major mode for vimrc files MELPA
XML nxml-mode Major mode for editing XML. Builtin
YAML yaml-mode Simple mode to edit YAML. MELPA

Other Modes

Language Mode Description Version
gitattributes gitattributes-mode Major mode for editing .gitattributes files MELPA
gitconfig gitconfig-mode Major mode for editing .gitconfig files MELPA
gitignore gitignore-mode Major mode for editing .gitignore files MELPA
Markdown markdown-mode Major mode for Markdown-formatted text MELPA
Org org-mode Outline-based notes management and organizer Builtin

P.S. The awesome-emacs is a list of Emacs package that you can choose other alternatives to replace any similar packages listed here. Is also a good place to seek and learn what's inside Emacs!

Key Bindings

This configuration have all modes bind to the same set of key bindings. It benefits the developer would not need to change their key bindings while after the mode swichted. The key bindings set can be check in ./.emacs.jcs/jcs-key.el file.

P.S.

  • My work requires me to use Visual Studio IDE that being said the key bindings set are most likely compatible to Visual Studio IDE.
  • Excepts keys that bind to C-x and C-c, Emacs are deeply binds to these two keys, and many packages also use these two keys for there preset keys. As you may know these two keys are often cut and copy, is awkward that I solved this by adding the same key stroke once again, hence the cut key is C-x C-x and the copy key is C-c C-c.

Themes

The theme was to design close to Visual Studio IDE preset light/dark theme. I believed Microsoft has a great UI/UX team, since I don't have any experience or work related to UI/UX, I would just like to have the theme color as close to it as possible. Anyway, if you want to customize the theme yourself, then check out the ./.emacs.jcs/jcs-theme.el file. All the theme related variables can be found in that file.

Light Theme Dark Theme

Font

Font uses use-ttf package to keep cross OS consistency. The default font is Ubuntu Mono and loaded by using UbuntuMono-R.ttf located under ./.emacs.jcs/fonts/ folder. If you don't like the this font, you can add your own .ttf file and add the path to use-ttf-default-ttf-fonts list. Lastly, set the name of the .ttf file to use-ttf-default-ttf-font-name variable.

P.S.

  • See the file ./.emacs.jcs/jcs-plugin.el to see how the font is been set in (use-package use-ttf) section.
  • For more details about the font settings in this configuration, check out the use-ttfpackage repo.

Installation

There are two ways to install the configuration on to your machine; it depends on if the internet is available to you.

With Internet

To install, clone this repo and copy the core files/directories to the emacs config directory accordingly. Make sure you backup your own configuration before you start the installation.

# clone this repo
$ git clone https://github.com/jcs090218/jcs-emacs-init.git

# change current directory to project directory
$ cd jcs-emacs-init

# copy init file to home
$ cp ./.emacs ~/

# copy core directories to home
$ cp -r ./.emacs.d ~/
$ cp -r ./.emacs.jcs ~/

Then startup Emacsm then it will start asking you to install all necessary packages due to this configuration.

!! [ATTENTION] !! -- MAKE SURE YOU INSTALLED THE CORRECT VERSION OF EMACS!

Without Internet

If the internet isn't available to you, just download a copy of the configuration from the release tab here . You will see these following files, and extract them to your HOME directory or the directory that Emacs will start loading initialize files.

  • .emacs [FILE]
  • .emacs.d [DIRECTORY]
  • .emacs.jcs [DIRECTORY]

Install it this way; you wouldn't need to be asked to install all necessary packages. So this may be faster or benefits to you.

Optimization

If you would like to optimize the configuration, you can run the following command compile all the source code to byte code so Emacs can run faster during both initial time and run time.

# change directory to the `jcs` config directory
$ cd ./.emacs.jcs

# compile all the config source code
$ emacs --batch --eval "(byte-recompile-directory \"./\" 0)"

Supported Emacs versions

The config should run on Emacs 24.3 or higher, but I will recommend to always run on the latest Emacs version available on your machine. The ultimate goal is to design to have each version of config can run on their each according Emacs version base on the version what I'm currently running on my present machine. For each version record, you can check the version_record file at the root of the project directory.

You can’t perform that action at this time.