Table of Contents
- jcs-emacs
- Philosophy
- π° News
- πΎ Installation
- π Startup Time
- π Features
- Highlight
- Details
- π Package Archives
- π Powered by
- Functionalities
- File Modes
- Key Bindings
- Themes
- Default
- Customization
- Font
- π¨ Optimization
- Write your own customization
- π Supported Emacs versions
- β FAQ
Consistent Emacs configuration for all platforms.
This is Jen-Chieh Shen's emacs configuration. This configuration started from Casey Muratori's Emacs configuration. It has been repeatedly utilized and modified since 2015 and is now very different to his configuration.
I wouldn't claim this is the best Emacs config, but this is the best config to myself. If you wish to learn Emacs, this could be a good start, because this configuration has been rewritten basically from scratch. Hopefully, this config will help someone who is new or struggle to Emacs. This configuration should work on most OSs, indicates Windows, macOS, and Linux.
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 / Agda / AppleScript / Assembly Language
- BASIC / Batchfile
- C / C++ / C# / Clojure / CMake / COBOL / CSS
- Dart / Dockerfile
- Elixir / Elm / Emacs Lisp / Erlang
- F# / Fountain
- GLSL / Go / Godot Script / Groovy
- Haskell / Haxe / HTML
- INI
- Java / JavaScript / JSON / JSX
- Kotlin
- LESS / Lisp / Lua
- Makefile / Markdown
- Nix
- Object Pascal (Delphi) / Objective-C
- Pascal / Perl / PHP / PowerShell / Properties / Python
- R / Ruby / Rust
- Sass / Scala / SCSS / Shader / Shell script / SQL / Swift
- Text / TOML / TSX / TypeScript
- Verilog / Vim script / Vue
- 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.
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.
Here is the list of few important and recent changes to this configuration.
6.5.1
- Switch from quickhelp to box for company frontend.6.5.0
- Add pinned archive feature to package module.6.4.2
- You can now resolve package dependency graph while deleting package.6.4.1
- Start withtree-sitter
support.6.4.0
- Switched fromprojectile
to built-inproject
for project management.6.3.1
- Replaceddocstring
module to externaldocstr
package.6.2.5
- Userecipes
folder instead to specify manually installed packages in the configuration.6.2.4
- Replaced ag silver searcher to searcher.6.2.2
- Correct upgrade logic for manually installed packages.6.1.5
-feebleline
is now fully compatible to terminal.
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.git
# change current directory to project directory
$ cd jcs-emacs
# copy init file to home
$ cp ./.emacs ~/
# copy core directories to home
$ cp -r ./.emacs.d ~/
$ cp -r ./.emacs.jcs ~/
Then startup Emacs; it will automatically installs all necessary packages due to this configuration.
ββ [ATTENTION] ββ -- MAKE SURE YOU INSTALLED THE CORRECT VERSION OF EMACS!
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.
π P.S. The above cases are tested on Windows. Other OS that are not Windows should start up under a second.
Here is the list of the major highlights to this configuration. Hope you would like my taste!
- Out of the box - Out of the box anywhere.
- Cross Platform - Work on all operating system including terminal.
- Fast Startup - Lazy loading for all unnecessary packages on startup.
- Old-Fashioned - Doesn't use any beatiful GUI because it may not work in terminal.
- Multiple Languages - Support multiple programming languages.
- Consistent - Having the same coding experience in different major mode.
- Easy to use - Design close to other modern text editors. Shouldn't spend you too much time.
- Dual Windows - Design to people who like multiple windows opened simultaneously.
- Keyboard Focused - You can do everything by using keyboard and mouse are just optional.
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.
- Auto Install Package - Automatically installs the package that this config relies on.
Auto Truncate Lines - Automatically enable/disable(has move to atl-markup)truncate-lines-mode
depends on certain situation. (markup language only)- Better Dashboard - Implementation for improving experiences using dashboard.
- Buffer Menu Search - Able to search in the
*Buffer List*
buffer. - Build Run - Implementation for executing script for building and running the software.
- Capital Word - You can navigate/kill word by seeing capital letter.
- Changelog Helper - Help to create changelog while creating
CHANGELOG
file using template. - Consistent Key Bindings - Has consistent key bindings across all modes.
- Curly Bracket Modes - Use curly bracket depends on different mode.
- Display File - Utility function to use to view a file on the other window.
- Charset Table - Built-in functions that displays character sets.
Docstring Completion - Some standard docstring completion implementations built-in to this configuration.(has move to docstr)- Enhanced Multiple Cursors
- Similar Multiple Cursors - Mark with cursor by similarity.
- VS Multiple Cursors - VSCode like methods to
mark
andunmark
multiple cursor. - Fast Incremental Search - Fast keys for incremental search forward/backward to the cursor is currently pointing.
- Feebleline Design - Personal displayed design for
feebleline
. - Indent Control - Generic control the indentation level for each mode, for more information see indent-control.
- Previous/Next Keys
- Normal Move - Act like other normal editors.
- Indent Move - Automatically indent when cursor moves up and down.
- Smart-Move - Smart enough to move cursor to the beginning of the line.
- Line Numbers Modding - Mixed used of
linum
anddisplay-line-numbers-mode
base on the file usage. - License Helper - Help to create license while creating
LICENSE
file using template. - Mini State - Mini mode state use to visually see what backend is the config currently running. (Deprecated)
- Auto Switch State - Automatcially switch mini state depends on certain circumstances.
Mode Line Toggle - Toggle toshow
orhide
the mode line.- Modern Text Editor - Design to have the preset settings close to modern text editors but faster.
- Multiple Output - Handle multiple output/compilation buffers.
- Navigate Blank Line - Use
C-<up>
andC-<down>
to navigate previous and next blank line. - Navigate Table - Navigate
org-mode
's table easier by using arrow keys. - Preview HTML - Preview rendered HTML file on the other window.
- Simulate Shell - Completely simulate shell behaviors, make better user experience when using shell in Emacs.
- Switch Window - Fast keys switch between windows quickly.
- Tabify/Untabify Modes - Tabify or Untabify the file depends on the mode you currently in.
Transparent Window - Keys to increase/decrease the transparency of the frame.(has move to transwin)- Trim Trailing Whitespace - Remove trailing spaces and tabs automatically on save.
- Video Player - Play media on the top window.
- Visualize Undo/Redo - Improved the user experience on undoing and redoing by showing the
undo-tree-visualizer
at the other window. - VS Curly Bracket - Visual Studio IDE like curly bracket implementation.
- VS Multiple Terminal - VSCode like multiple shell control.
- VS Navigate Word - Visual Studio IDE like navigating between word implementation.
A list of package archives that this configuration uses.
- CELPA - Conao3βs Emacs Lisp Package Archive (Nonstandard)
- ELPA - Emacs Lisp Package Archive (Standard)
Marmalade - where users upload their own packages (Nonstandard)- MELPA - Milkypostmanβs Emacs Lisp Package Archive (Nonstandard)
π 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.
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.
- Abbreivation Definition - powered by project-abbrev.
- Alt-Codes - powered by alt-codes.
- Auto Completion - powered by company.
- Auto Highlight Symbol - powered by auto-highlight-symbol-mode.
- Banner - powered by dashboard.
- Binary/Hex Editor - powered by nhexl-mode.
- Collaborative Editing - powered by togetherly.
- Context Menu - powered by right-click-context.
- Document String - powered by docstr.
- End of Line - powered by show-eol.
- Execute Commands - powered by compile.
- File Explorer - powered by treemacs.
- File Header - powered by file-header.
- Folding/Unfolding - powered by ts-fold.
- Font - powered by use-ttf.
- Goto Char - powered by goto-char-preview.
- Goto Declaration/Definition - powered by dumb-jump.
- Goto Line - powered by goto-line-preview.
- Highlight Indentation - powered by highlight-indent-guides.
- Highlight Matched Pairs - powered by show-paren-mode.
- Highlight Same Region - powered by region-occurrences-highlighter.
- Indentation Management - powered by indent-control.
- Language Server Protocol - powered by lsp-mode.
- Line Annotation - powered by line-reminder.
- Line Numbers - powered by display-line-numbers and linum.
- Minimap - none, originally powered by
sublimity. - Mode Line - powered by powerline.
- Multiple Cursor - powered by iedit and multiple-cursors.
- Multiple Terminal - powered by multi-shell.
- Music Player - powered by ffmpeg-player; might change to something else.
- Navigation/Searcher - powered by searcher and isearch-project.
- Package Archive - see here.
- Package Management - powered by leaf and quelpa.
- PDF Viewer - powered by doc-view-mode and ghostscript.
- Project Management - powered by project.
- Recent Files - powered by recentf.
- Regexp - powered by re-builder and visual-regexp.
- Restart Emacs - powered by restart-emacs.
- Scroll Bar - powered by yascroll.
- Shell - powered by shell and exec-path-from-shell.
- Simplify Usage - powered by ivy.
- Smooth Scrolling - none, originally powered by
sublimity. - Snippet - powered by yasnippet.
- Source Control Management - powered by magit.
- Startup Screen - powered by dashboard.
- Syntax Check - powered by flycheck.
- Tab Bar - powered by centaur-tabs.
Tags - powered by gtags.- Text Editing - powered by org-mode.
- Theme - powered by vs-dark-theme and vs-light-theme. (For more info see here)
- Todo - powered by hl-todo.
- Toggle Mode Line - powered by feebleline.
- Undo/Redo - powered by undo-tree.
- Video Player - powered by ffmpeg-player.
- White Space - powered by whitespace.
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.
π 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!
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 modified 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 toC-x
andC-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 oftencut
andcopy
, is awkward that I solved this by adding the same key stroke once again, hence thecut
key isC-x C-x
and thecopy
key isC-c C-c
.
Edit 1: After version 5.8.3
, the cut
and copy
keys had been corrected
and no longer the hassle to this configuration. Thanks to use-package
again,
letting me bind C-x
and C-c
keys for higher precedence.
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 |
---|---|
![]() |
![]() |
In common, you can install any theme you want as long it is available on the internet. You can check out the Emacs Theme Gallery site here. For instance, vs-dark-theme and vs-light-theme are now individual packages built outside from this configuration.
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(leaf use-ttf)
section. - For more details about the font settings in this configuration, check out the
use-ttf
package repo.
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)"
You are able to customize the configuration by editing the file locate at
~/.emacs.jcs/jcs-config.el
. You should put all your own customize code there,
then other than that are the core files.
The config should run on Emacs 27.1 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.
Here is the list of Frequently Asked Questions.