My emacs config.
Below are the dependencies needed to compile emacs from source:
automake
,gcc
,make
: to build Emacs from sourceimagemagick7
: for imagemagick integrationlibrsvg
: for renderingSVG
files in emacsmailutils
: for mailutils integration in emacsgnutls
: for securitygtk3
: library for Gtk3dbus
: library for integration ofdbus
with emacstexinfo
: needed for documentationlibpng
,libjpeg
,libxpm
,giflib
,libtiff
: media dependencies
These are optional, but will definitely improve the experience for using emacs. I recommend installing all the below tools:
- CMake: needed for
vterm.el
package libvterm
: needed forvterm.el
package- watchexec: needed for watching for file changes for packages and running
build to update the packages. This is needed for
straight.el
- direnv: for getting
direnv
integration with Emacs - ripgrep: for faster search integration in Emacs
- fd: integrate
fd
into emacs for faster file searches - poppler: PDF rendering library. Needed for pdf-tools
- Install Emacs28 from source by running:
git clone --depth 1 master https://github.com/emacs-mirror/emacs cd emacs sh autogen.sh ./configure --with-modules --with-rsvg --with-dbus \ --without-pop --with-xft --with-xml2 --with-libotf --with-mailutils \ --without-toolkit-scroll-bars --without-xaw3d \ CFLAGS="-O3 -mtune=native -march=native -fomit-frame-pointer" # replce -jX, X is the number of cores in your machine make -j8 make install
- Optionally, you can also compile emacs native compilation branch, like so
git clone --depth 1 master https://github.com/emacs-mirror/emacs -b feature/native-comp cd emacs sh autogen.sh ./configure --with-modules --with-rsvg --with-dbus \ --without-pop --with-xft --with-xml2 --with-libotf --with-mailutils \ --with-nativecomp --without-toolkit-scroll-bars --without-xaw3d \ CFLAGS="-O3 -mtune=native -march=native -fomit-frame-pointer" # replce -jX, X is the number of cores in your machine make -j8 make install
- Add the below line to
early-init.el
;; comment out this line if you are not using emacs native compilation branch ;; native compile elisp files as they are loaded (setq comp-deferred-compilation t)
- Add the below line to
- Enable and run the systemd service for emacs:
systemctl --user enable emacs --now
- Change the
emacs.desktop
file to launchemacsclient
, its located in/usr/local/share/applications/emacs.desktop
:[Desktop Entry] Name=Emacs GenericName=Text Editor Comment=Edit text MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++; Exec=/usr/local/bin/emacsclient -c -a '' %F Icon=emacs Type=Application Terminal=false Categories=Development;TextEditor; StartupWMClass=Emacs Keywords=Text;Editor;
- Make
emacs
your default text editor by adding the below lines to your.zshenv
file:export EDITOR="emacsclient -n -a \"\"" export VISUAL="emacsclient -n -a \"\""
- Setup handy aliases for emacs by adding the below in your
.aliases
file:alias ec='emacsclient -nc -a ""' alias eg='emacsclient -n -a ""' alias et='TERM=xterm-256color emacsclient -t -a ""'
- Now you can open emacs by conecting to the emacs daemon using
emacsclient using:
ec
- You can open a file on the existing emacs frame by:
eg file-name
- Emacs configuration for
vterm
integration:function vterm_printf() { if [ -n "$TMUX" ]; then # tell tmux to pass the escape sequences through # (Source: http://permalink.gmane.org/gmane.comp.terminal-emulators.tmux.user/1324) printf "\ePtmux;\e\e]%s\007\e\\" "$1" elif [ "${TERM%%-*}" = "screen" ]; then # GNU screen (screen, screen-256color, screen-256color-bce) printf "\eP\e]%s\007\e\\" "$1" else printf "\e]%s\e\\" "$1" fi } if [ -n "$INSIDE_EMACS" ]; then vterm_prompt_end() { vterm_printf "51;A$(whoami)@$(hostname):$(pwd)" } PROMPT=$PROMPT'%{$(vterm_prompt_end)%}' fi if [[ "$INSIDE_EMACS" = 'vterm' ]]; then alias clear='vterm_printf "51;Evterm-clear-scrollback";tput clear' fi
- Now you can open emacs by conecting to the emacs daemon using
emacsclient using:
- Optionally, you can also compile emacs native compilation branch, like so
Ivy
as the preferred completion frontend for emacs.- Very minimal theme with no toolbar, no scrollbars, no line numbers and use
Nord
theme. - Tested to work with
Emacs 27
andEmacs 28
onLinux
andMacOS
.