CSRaghunandan / .emacs.d
Projects that are alternatives of or similar to .emacs.d
- Rag .emacs.d My emacs config.
** Dependencies needed for compiling emacs28 from source
Below are the dependencies needed to compile emacs from source:
- =automake=, =gcc=, =make=: to build Emacs from source
- =imagemagick7=: for imagemagick integration
- =librsvg=: for rendering =SVG= files in emacs
- =mailutils=: for mailutils integration in emacs
- =gnutls=: for security
- =gtk3=: library for Gtk3
- =dbus=: library for integration of =dbus= with emacs
- =texinfo=: needed for documentation
- =libpng=, =libjpeg=, =libxpm=, =giflib=, =libtiff=: media dependencies
** Optional dependencies for running my emacs configuration
These are /optional/, but will definitely improve the experience for using emacs. I recommend installing all the below tools:
- [[https://cmake.org/][CMake]]: needed for =vterm.el= package
- =libvterm=: needed for =vterm.el= package
- [[https://github.com/watchexec/watchexec][watchexec]]: needed for watching for file changes for packages and running build to update the packages. This is needed for =straight.el=
- [[https://github.com/direnv/direnv][direnv]]: for getting =direnv= integration with Emacs
- [[https://github.com/BurntSushi/ripgrep][ripgrep]]: for faster search integration in Emacs
- [[https://github.com/sharkdp/fd/][fd]]: integrate =fd= into emacs for faster file searches
- [[https://poppler.freedesktop.org/][poppler]]: PDF rendering library. Needed for [[https://github.com/politza/pdf-tools][pdf-tools]]
** Installing and configuring Emacs
-
Install Emacs28 from source by running:
#+BEGIN_SRC bash 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 #+END_SRC
+ Optionally, you can also compile emacs native compilation branch, like so
#+BEGIN_SRC bash
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
#+END_SRC
+ Add the below line to =early-init.el=
#+BEGIN_SRC emacs-lisp
;; 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) #+END_SRC
+ Enable and run the systemd service for emacs:
#+BEGIN_SRC bash
systemctl --user enable emacs --now #+END_SRC
+ Change the =emacs.desktop= file to launch =emacsclient=, its located in
=/usr/local/share/applications/emacs.desktop=:
#+BEGIN_SRC conf
[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; #+END_SRC
+ Make =emacs= your default text editor by adding the below lines to your
=.zshenv= file:
#+BEGIN_SRC bash
export EDITOR="emacsclient -n -a """ export VISUAL="emacsclient -n -a """ #+END_SRC
+ Setup handy aliases for emacs by adding the below in your =.aliases= file:
#+BEGIN_SRC bash
alias ec='emacsclient -nc -a ""' alias eg='emacsclient -n -a ""' alias et='TERM=xterm-256color emacsclient -t -a ""' #+END_SRC + 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:
#+BEGIN_SRC bash
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
#+END_SRC
** Notes
- =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= and =Emacs 28= on =Linux= and =MacOS=.