removing the emacs config that is now its own repo
This commit is contained in:
parent
4474122353
commit
7bc0fac00a
5 changed files with 0 additions and 332 deletions
11
emacs/.emacs.d/.gitignore
vendored
11
emacs/.emacs.d/.gitignore
vendored
|
@ -1,11 +0,0 @@
|
||||||
*
|
|
||||||
!.gitignore
|
|
||||||
!init.el
|
|
||||||
<<<<<<< HEAD
|
|
||||||
!/themes/**
|
|
||||||
!*.org
|
|
||||||
=======
|
|
||||||
!*.org
|
|
||||||
!themes
|
|
||||||
!themes/*
|
|
||||||
>>>>>>> 9ad15b2 (add local whitelist)
|
|
|
@ -1,308 +0,0 @@
|
||||||
#+TITLE: My literate Emacs config
|
|
||||||
* Introduction
|
|
||||||
This is my personal Emacs config, using org mode to make it easier to structure things and comment what section is used for exactly.
|
|
||||||
|
|
||||||
* Initialization
|
|
||||||
** General settings
|
|
||||||
Set the author name
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(setq user-full-name "Anthony Rodriguez")
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Remove the startup message
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(setq inhibit-startup-message t)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Disable some UI elements that I don't need
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(scroll-bar-mode -1)
|
|
||||||
(tool-bar-mode -1)
|
|
||||||
(tooltip-mode -1)
|
|
||||||
(menu-bar-mode -1)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Add space on the sides
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(set-fringe-mode 10)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Disable backup and auto save as I use git repositories a lot and I don't like having to ignore Emacs specific files
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(setq backup-inhibited t)
|
|
||||||
(setq auto-save-default nil)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
|
|
||||||
** Package management
|
|
||||||
I use [[https://github.com/radian-software/straight.el][straight.el]] for my package management, alongside [[https://github.com/jwiegley/use-package][use-package]] to make my configuration easier to maintain.
|
|
||||||
|
|
||||||
Initialize straight.el
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(defvar bootstrap-version)
|
|
||||||
(let ((bootstrap-file
|
|
||||||
(expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
|
|
||||||
(bootstrap-version 6))
|
|
||||||
(unless (file-exists-p bootstrap-file)
|
|
||||||
(with-current-buffer
|
|
||||||
(url-retrieve-synchronously
|
|
||||||
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
|
|
||||||
'silent 'inhibit-cookies)
|
|
||||||
(goto-char (point-max))
|
|
||||||
(eval-print-last-sexp)))
|
|
||||||
(load bootstrap-file nil 'nomessage))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Install use-package with straight.el
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(straight-use-package 'use-package)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Set use-package to always ensure (makes sure all of our packages download automatically)
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(setq use-package-always-ensure t)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Makes use-package use straight.el by default
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package straight
|
|
||||||
:custom
|
|
||||||
(straight-use-package-by-default t))
|
|
||||||
#+end_src
|
|
||||||
** Environment variables
|
|
||||||
One issue I had using Emacs was the fact that my environment variables were not available inside of the GUI version. This is because on some systems, mainly OS X, where graphical apps inherit a minimal set of environment variables, or setups running Emacs as a daemon, graphical apps may not have all of the available environment variables (mainly $PATH and ssh related variables). This is why we use [[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]], a handy library that will ensure we have access to the same stuff across Emacs and the terminal.
|
|
||||||
|
|
||||||
Here, we install the aforementioned package, and define a list of commonly needed variables to share with the Emacs instance.
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package exec-path-from-shell
|
|
||||||
:config
|
|
||||||
(dolist (var '("SSH_AUTH_SOCK" "SSH_AGENT_PID" "GPG_AGENT_INFO" "LANG" "LC_CTYPE" "NIX_SSL_CERT_FILE" "NIX_PATH"))
|
|
||||||
(add-to-list 'exec-path-from-shell-variables var)))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Share the path on OS X
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(when (memq window-system '(mac ns x))
|
|
||||||
(exec-path-from-shell-initialize))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Share the path on daemonized setups
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(when (daemonp)
|
|
||||||
(exec-path-from-shell-initialize))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Completion
|
|
||||||
*** Minibuffer completion
|
|
||||||
I use [[https://github.com/minad/vertico][vertico]] for my vertical/minibuffer completion. It's light, stays out of my way and works great out of the box, which is what I expect from all of my Emacs packages.
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package vertico
|
|
||||||
:init
|
|
||||||
(vertico-mode))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** which-key
|
|
||||||
I use [[https://github.com/justbur/emacs-which-key][which-key]], a small package that shows a window that describes available keybindings that follow the prefix I just hit. I just can't live without it, it's mandatory for me since I often don't remember which exact keybind I need to press to do a certain thing.
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package which-key
|
|
||||||
:config
|
|
||||||
(which-key-mode))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** expand-region
|
|
||||||
[[https://github.com/magnars/expand-region.el][expand-region]] is a really useful package that allows for selection regions of text in semantic units. It works with text (words, sentences, paragraphs), code etc.
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package expand-region
|
|
||||||
:bind
|
|
||||||
("C-=" . er/expand-region))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
* Appearance
|
|
||||||
** Theme
|
|
||||||
I use [[https://github.com/catppuccin][catppuccin]] as my theme (the mocha flavor).
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
;; set theme
|
|
||||||
(use-package catppuccin-theme
|
|
||||||
:custom
|
|
||||||
(catppuccin-flavor 'mocha)
|
|
||||||
:init
|
|
||||||
(load-theme 'catppuccin t)
|
|
||||||
(catppuccin-reload))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Font
|
|
||||||
I really like being able to use standard fonts, so I decided to set my Emacs font to my system monospace font.
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(add-to-list 'default-frame-alist '(font . "Monospace 15"))
|
|
||||||
(add-hook 'text-mode-hook 'visual-line-mode)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Mode-line
|
|
||||||
I use [[https://github.com/seagle0128/doom-modeline][doom-modeline]] as my mode-line, it's really slick and shows me all that I need to know at all times.
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package doom-modeline
|
|
||||||
:ensure t
|
|
||||||
:init (doom-modeline-mode 1)
|
|
||||||
:custom ((doom-modeline-height 15)))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
doom-modeline requires nerd-icons to be able to display icons. Don't forget to run nerd-icons-install-fonts to make it available on your system.
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package nerd-icons)
|
|
||||||
#+end_src
|
|
||||||
* Org mode
|
|
||||||
This section contains all of my org mode configuration. Over the course of learning Emacs, I learned to appreciate org-mode more and more, and I use it for a lot of various tasks, from writing documents and exporting them to pdf, to writing this exact config, or just taking notes.
|
|
||||||
** General settings
|
|
||||||
Export documents to A4 (I'm European, so US letter won't work for me)
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(with-eval-after-load 'ox-latex (add-to-list 'org-latex-classes
|
|
||||||
'("article" "\\documentclass[11pt,a4paper]{article}"
|
|
||||||
("\\section{%s}" . "\\section*{%s}")
|
|
||||||
("\\subsection{%s}" . "\\subsection*{%s}")
|
|
||||||
("\\subsubsection{%s}" . "\\subsubsection*{%s}")
|
|
||||||
("\\paragraph{%s}" . "\\paragraph*{%s}")
|
|
||||||
("\\subparagraph{%s}" . "\\subparagraph*{%s}"))))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Enable syntax highlighting in org source blocks
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(setq org-src-fontify-natively t)
|
|
||||||
#+end_src
|
|
||||||
** Publishing
|
|
||||||
I use org's [[https://orgmode.org/manual/Publishing.html][publishing feature]] to export all of my notes at once.
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(setq org-publish-project-alist
|
|
||||||
(list
|
|
||||||
'("notes"
|
|
||||||
:base-directory "~/org/notes"
|
|
||||||
:base-extension "org"
|
|
||||||
:publishing-directory "~/org/notes"
|
|
||||||
:publishing-function org-latex-publish-to-pdf
|
|
||||||
)))
|
|
||||||
#+end_src
|
|
||||||
** org-roam
|
|
||||||
I use [[https://github.com/org-roam/org-roam][org-roam]] for my note taking purposes. The [[https://en.wikipedia.org/wiki/Zettelkasten][Zettelkasten]] method works for me, and allows for flexibility as I really dislike very strict note-taking systems.
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package org-roam
|
|
||||||
:custom
|
|
||||||
(org-roam-directory "~/org/notes")
|
|
||||||
(org-roam-completion-everywhere t)
|
|
||||||
:config
|
|
||||||
(org-roam-setup)
|
|
||||||
:bind (("C-c n f" . org-roam-node-find)
|
|
||||||
(:map org-mode-map
|
|
||||||
(("C-c n i" . org-roam-node-insert)
|
|
||||||
("C-c n l" . org-roam-buffer-toggle)))))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** Spellchecking
|
|
||||||
I use [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Spelling.html][flyspell]], Emac's integated spellchecker.
|
|
||||||
|
|
||||||
Add different dictionaries for languages that I use
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(let ((langs '("american" "francais")))
|
|
||||||
(setq lang-ring (make-ring (length langs)))
|
|
||||||
(dolist (elem langs) (ring-insert lang-ring elem)))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Enable flyspell for text modes
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(dolist (hook '(text-mode-hook))
|
|
||||||
(add-hook hook (lambda () (flyspell-mode 1))))
|
|
||||||
(dolist (hook '(change-log-mode-hook log-edit-mode-hook))
|
|
||||||
(add-hook hook (lambda () (flyspell-mode -1)))
|
|
||||||
)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Cycle through languages with F6
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(defun cycle-ispell-languages ()
|
|
||||||
(interactive)
|
|
||||||
(let ((lang (ring-ref lang-ring -1)))
|
|
||||||
(ring-insert lang-ring lang)
|
|
||||||
(ispell-change-dictionary lang)))
|
|
||||||
(setq ispell-program-name "aspell")
|
|
||||||
|
|
||||||
(global-set-key [f6] 'cycle-ispell-languages)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Enable flyspell in comments for programming modes
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(add-hook 'prog-mode-hook
|
|
||||||
(lambda ()
|
|
||||||
(flyspell-prog-mode)))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Install [[https://github.com/tmalsburg/guess-language.el][guess-language.el]], which automatically detects the main language used and switches to that dictionary. It even works with documents written in multiple languages!
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package guess-language
|
|
||||||
:custom
|
|
||||||
(guess-language-languages '(en fr))
|
|
||||||
(guess-language-min-paragraph-length 35)
|
|
||||||
:hook
|
|
||||||
(text-mode . guess-language-mode))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** pdf-tools
|
|
||||||
[[https://github.com/vedang/pdf-tools][pdf-tools]] allows us to have a pdf viewer embedded inside of Emacs, which also works with org exports.
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package pdf-tools
|
|
||||||
:config
|
|
||||||
(pdf-tools-install)
|
|
||||||
(setq-default pdf-view-display-size 'fit-width))
|
|
||||||
#+end_src
|
|
||||||
* Development
|
|
||||||
This section contains all of my development related configuration. As a compsci student, it's absolutely mandatory for me to have a good editor experience and have it integrate well with all languages and frameworks I need to use in my day-to-day work.
|
|
||||||
** git
|
|
||||||
I use [[https://github.com/magit/magit][magit]] as my git client. It's incredible, it makes everything that you need to do in git available under a single prefix (C-x G), the diff interface is great and has genuinely made me more productive over the months of using it. Definitely prefer using it over the CLI.
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package magit)
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
** LSP
|
|
||||||
The following section contains the configuration of [[https://github.com/emacs-lsp/lsp-mode][lsp-mode]], which aims to provide an IDE like experience by leveraging different available language server protocols.
|
|
||||||
|
|
||||||
Install lsp-mode
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package lsp-mode
|
|
||||||
:ensure
|
|
||||||
:commands lsp
|
|
||||||
:custom
|
|
||||||
;; what to use when checking on-save. "check" is default, I prefer clippy
|
|
||||||
|
|
||||||
#+end_src
|
|
||||||
Install [[https://github.com/emacs-lsp/lsp-ui][lsp-ui]], which provides UI additions to lsp-mode such as code lenses, flycheck diagnostics etc.
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package lsp-ui
|
|
||||||
:after lsp-mode
|
|
||||||
:hook (lsp-mode . lsp-ui-mode))
|
|
||||||
#+end_src
|
|
||||||
Install [[http://company-mode.github.io/][company-mode]], a text completion framework for Emacs that integrates with LSP to provide in-buffer code completion, similar to VS Code and other text editors / IDEs
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package company
|
|
||||||
:after lsp-mode)
|
|
||||||
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
Install [[https://github.com/sebastiencs/company-box][company-box]], which adds icons to company-mode
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package company-box
|
|
||||||
:hook (company-mode . company-box-mode))
|
|
||||||
#+end_src
|
|
||||||
*** Rust
|
|
||||||
Install [[https://github.com/brotzeit/rustic][rustic]], an Emacs major mode for Rust
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(use-package rustic
|
|
||||||
:custom
|
|
||||||
(rustic-format-trigger 'on-save)
|
|
||||||
(rustic-analyzer-command '("rustup" "run" "stable" "rust-analyzer"))
|
|
||||||
:hook
|
|
||||||
(rustic-mode . display-line-numbers-mode))
|
|
||||||
#+end_src
|
|
||||||
**** LSP
|
|
||||||
Use [[https://github.com/rust-lang/rust-clippy][clippy]] as the watch command
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(setq lsp-rust-analyzer-cargo-watch-command "clippy")
|
|
||||||
(setq lsp-eldoc-render-all t)
|
|
||||||
(setq lsp-idle-delay 0.6)
|
|
||||||
#+end_src
|
|
|
@ -1 +0,0 @@
|
||||||
(org-babel-load-file (expand-file-name (concat user-emacs-directory "README.org")))
|
|
|
@ -1,9 +0,0 @@
|
||||||
[Desktop Entry]
|
|
||||||
Encoding=UTF-8
|
|
||||||
Version=1.0
|
|
||||||
Type=Application
|
|
||||||
NoDisplay=true
|
|
||||||
Exec=emacsclient --eval '(dired "%f")'
|
|
||||||
Name=Dired
|
|
||||||
Comment=Emacs Dired
|
|
||||||
MimeType=inode/directory;application/x-directory
|
|
|
@ -1,3 +0,0 @@
|
||||||
[MIME Cache]
|
|
||||||
application/x-directory=emacs-dired.desktop;
|
|
||||||
inode/directory=emacs-dired.desktop;
|
|
Loading…
Reference in a new issue