Skip to content

vedang/emacs-up

Repository files navigation

Emacs Up: My personal El-get based Emacs configuration

This starter kit provides:

  1. Working and well-tuned configurations for:
    • Clojure Programming (CIDER + other minor modes)
    • Emacs Lisp Programming (ElSpice + other minor modes)
    • Note-taking and Task-tracking through Org Mode
    • Email through Emacs (Notmuch + mbsync + msmtp)
  2. Other minor but important additions:
    • Avy Mode (Jumping and Navigation)
    • Company Mode (Completion)
    • Helm Mode (Navigation)
    • Magit (Git Interface)
    • Multiple Cursors (Editing)
    • Paredit (Editing Lispy things)
    • YASnippets (Templating and Boiler Plate)
    • Correct path manipulation on OS X (System)
  3. Better defaults than “pure” Emacs. And a number of other small but beautiful packages.

Pre-requisites

The following tools should be installed and available on the system:

Make sure that they are on $PATH.

  1. On a Mac, these can all be installed through Homebrew as follows:
    brew install git mercurial aspell automake texinfo subversion shellcheck
        
  2. On Ubuntu, these can all be installed through Apt as follows:
    apt install git mercurial aspell automake texinfo subversion shellcheck
        

The following tools are optional, but recommended / needed for particular modes to work correctly.

  • notmuch: My preferred email client.
  • prettier: Provides formatting of JS code on save.
  • delta: Beautiful and fast diff tool.
  • zoxide: A smarter cd command
  • clj-kondo: A linter for Clojure code that sparks joy.
  • cljstyle: A tool for formatting Clojure code.

First-time installation instructions / Optional Pre-requisites

Org Mode:

For org-mode to work, you’ll have to set your org-directory. To do this, add the line

(setq org-directory "/path/to/org/directory")

somewhere in your Emacs config. I recommend that you create the file ~~/.emacs.d/personal.el~ and add the code to that file.

For more information about the org config, take a look at vedang/org-mode-crate

Clojure interactive development through Cider

cider needs a one time setup of cider-nrepl, refactor-nrepl middleware in order to work properly. Please follow the installation instructions in the respective repos to install cider-nrepl and refactor-nrepl.

Installation Instructions

  1. Clone the repository and move it to your .emacs.d folder
    $ cd /tmp/
    $ git clone https://github.com/vedang/emacs-up.git
    $ mv emacs-up ~/.emacs.d
        
  2. Make sure you’ve followed the One-Time installation instructions before proceeding.
  3. Start Emacs. Make yourself a cup of tea. The first boot will trigger a (one-time) download of all the packages that Emacs-Up needs. This can take a lot of time. Sometimes (rarely) Emacs will stop and throw an error. If this happens, try re-starting Emacs. If the error is still being thrown, file an issue with me. Don’t forget to include the stacktrace. Don’t worry, your perfect environment is being baked with love.
  4. Profit!

Post-Installation instructions

All the Icons

This configuration installs all-the-icons for pretty icons. All the Icons requires special fonts to be installed, which can be done with M-x all-the-icons-install-fonts

Upgrading to the latest version of emacs-up from an older version

  1. Close running emacs session
  2. Fetch the latest changes from vedang/emacs-up
  3. Start emacs and run the following code:
    M-x el-get-self-update
    M-x el-get-update-all
        
  4. Restart emacs

Features currently in experimental mode

Using Tree Sitter with emacs-up

emacs-up now uses the new tree-sitter support that Emacs 29+ brings for many programming modes (see list below). Getting this to work requires installing tree-sitter and the language grammars. I consider this as experimental at the moment, you can skip this setup if you do not care of any of these languages.

The pre-requisite for this to work is that you need to install tree-sitter on your system. You can do this as follows:

git clone https://github.com/tree-sitter/tree-sitter
cd tree-sitter/
make
sudo make install

Here is the list of languages that use tree-sitter in this config, along with where we clone the grammars from:

'((bash "https://github.com/tree-sitter/tree-sitter-bash")
  (c "https://github.com/tree-sitter/tree-sitter-c")
  (cpp "https://github.com/tree-sitter/tree-sitter-cpp")
  (clojure "https://github.com/sogaiu/tree-sitter-clojure")
  (cmake "https://github.com/uyha/tree-sitter-cmake")
  (css "https://github.com/tree-sitter/tree-sitter-css")
  (elisp "https://github.com/Wilfred/tree-sitter-elisp")
  (html "https://github.com/tree-sitter/tree-sitter-html")
  (java "https://github.com/tree-sitter/tree-sitter-java")
  (javascript "https://github.com/tree-sitter/tree-sitter-javascript" "master" "src")
  (json "https://github.com/tree-sitter/tree-sitter-json")
  (make "https://github.com/alemuller/tree-sitter-make")
  (markdown "https://github.com/ikatyang/tree-sitter-markdown")
  (python "https://github.com/tree-sitter/tree-sitter-python")
  (rust "https://github.com/tree-sitter/tree-sitter-rust")
  (toml "https://github.com/tree-sitter/tree-sitter-toml")
  (tsx "https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")
  (typescript "https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")
  (yaml "https://github.com/ikatyang/tree-sitter-yaml"))

This list is maintained in the variable vedang/treesit-grammars, in case you are interested in modifying it.

Make sure you are using Emacs 29+ with tree-sitter support enabled. You can check this with C-h v system-configuration-features. The output should have TREE_SITTER in it.

emacs-up will install tree-sitter grammars automatically. We use code inspired from the combobulate README to do this. Check vedang/install-treesit-grammars-and-modes if you are curious.