Skip to content

Nidish96/emacstarter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Basic Emacs Configuration for Engineers

./ewokswemacs.png

This is a basic config file we’ve created to make it easy to start with emacs. It’s actually a little more than just “basic”. It should have most of the immediate needs for usage. It uses elpaca for package management. I decided on elpaca after much thought and trials with package.el , quelpa, straight.el, and combinations thereof.

Instructions

  1. Ensure you have the latest emacs installed. This config is tested with Emacs 29.1 on Ubuntu 23.10, and Emacs 30.2 on Ubuntu 25.10.
  2. Install some general utilities
    # Almalinux
    yum install autoconf automake gcc libpng-devel make pkgconfig poppler-devel poppler-glib-devel zlib-devel clang cmake libtool libvterm-devel
    
    # Ubuntu
    apt install autoconf automake gcc libpng-dev make pkgconf libpoppler-dev libpoppler-glib-dev zlib1g-dev clang cmake libtool libvterm-dev libtree-sitter-dev python3-venv
        
  3. Create a directory called “org-roam” in your home.
    mkdir ~/org-roam
        
  4. Install python language servers with pip. pyenv setups are possible. You don’t need all of these, read more on what you need before doing this. If you’re not sure, start with python3-lsp.
    pip install 'python-language-server[all]' python-lsp-server debugpy pyright
    
    sudo apt install python3-pylsp
        
  5. I’d recommend installing Texlive for compiling latex documents. Also install latexmk for compilation “on the fly”. The following is a recommended configuration for latexmk, which you can put in ~/.latexmkrc
    $pdf_mode = 1;
    # For pdflatex
    $pdflatex = 'pdflatex -synctex=1 -halt-on-error %O --shell-escape %S';
    
    # Custom dependency and function for nomencl package 
    add_cus_dep( 'nlo', 'nls', 0, 'makenlo2nls' );
    sub makenlo2nls {
    system( "makeindex -s nomencl.ist -o \"$_[0].nls\" \"$_[0].nlo\"" );
    }
    
    $pdf_previewer = "cat > /dev/null";
        
  6. Clone the contents of this repository into your ~/.emacs.d folder.
    cd ~
    git clone git@github.com:Nidish96/emacstarter.git
    mv emacstarter .emacs.d
        
  7. Fire up emacs a couple times to ensure everything is installed properly.

Note on treesit modes

The config uses treesit.el extensively for syntax highlighting and navigation. You might have to install some of these grammars manually with M-x treesit-install-language-grammar .

List of Features Included in Config

The following are the list of features enabled by the config in addition to emacs defaults.

  1. Packages:
    • ~elpaca~ is used for package management.
  2. Utilities
    • helm is installed as the navigation engine throughout.
    • magit is installed as the front-end for git.
    • yasnippet is installed for snippet expansion. A basic set of snippets are also installed.
    • iedit is installed for editing multiple occurrences of the same string.
    • company is installed as the completion framework.
    • dired-subtree is installed for directory navigation.
  3. Org-Mode Ecosystem
    • A dev branch of org is installed. This provides live latex previews.
    • The look and feel of org files is improved with fancy bullets and colors
    • Org roam is installed as a personal knowledge management system
    • Org tree slide is installed for presenting org files
    • A useful “local” capture template for org-agenda is included
  4. Programming/Development IDEs
    • A Latex IDE is setup using AucTeX and pdf-tools
    • A MATLAB IDE is setup using matlab-mode
    • A Python IDE is setup using the Language Server Protocol (LSP or eglot may be used).
    • A Julia IDE is setup using julia-snail.
    • A Typst IDE is setup using typst-ts-mode.
  5. Miscellanies
    • The openfoam package is installed for editing openfoam input files.
    • csv-mode is installed to work with csv files.
    • Etc.
  6. The whole config is written in an org file that is automatically tangled into elisp code. This makes it easier to maintain the emacs config.

Usage Tips and Tricks

  1. Some files may not have extensions but you may still want them to open in a particular mode. Add the following line at the beginning of the file for this
    # -*- mode: <modename> -*-
        

    The first character(s) can be any appropriate comment character. Read the emacs documentation entry on this for more.

  2. To make tramp work with zsh shells, add the following to the beginning of you .zshrc file:
    [[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return
        
  3. You can bind the following shell script to a keybinding (I like using Ctrl-Alt-e) to conditionally launch an emacs client with the daemon (or create a new daemon if it doesn’t already exist).
    #!/usr/bin/bash
    
    source ~/.profile
    
    emacsclient -ce '(lambda () (interactive) previous-buffer)'
    if [ $? -ne 0 ]; then
      emacs --daemon
      emacsclient -c
    fi
        

More Packages to add

  1. Live plotting capabilities (possibly linked to some data files)? (Should be achievable with gnuplot)

About

A starter emacs config for my line of work

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors