* Pre-init ** Add my own, version controlled ~lisp~ directory to ~load-path~ #+begin_src emacs-lisp (add-to-list 'load-path (expand-file-name (convert-standard-filename "lisp/") user-emacs-directory)) #+end_src ** Do the same with the local ~site-lisp~ if it’s there #+begin_src emacs-lisp (let ((site-lisp-dir "/usr/local/share/emacs/site-lisp")) (when (file-directory-p site-lisp-dir) (dolist (elt (directory-files site-lisp-dir)) (unless (or (string= elt ".") (string= elt "..")) (add-to-list 'load-path (expand-file-name elt site-lisp-dir)))))) #+end_src ** Load ~xdg-paths~ I prefer using freedesktop’s desktop specification everywhere. #+begin_src emacs-lisp (load "xdg-paths") #+end_src * Set up the package manager I’m a ~package.el~ user. Don’t package-shame me! ** Set up the package archives #+begin_src emacs-lisp (require 'package) (add-to-list 'package-archives '("gnu" . "https://elpa.gnu.org/packages/")) (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/") t) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) (add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t) (package-initialize) #+end_src ** Set up ~use-package~ It is built-in since 29.1, and let’s hope I never get back using older versions, but let’s stay on the safe side for now. #+begin_src emacs-lisp (unless (package-installed-p 'use-package) (package-refresh-contents) (package-install 'use-package)) (require 'use-package) (use-package use-package :custom (use-package-always-ensure t) (use-package-verbose nil)) (use-package bind-key) #+end_src *** Install Quelpa so we can add packages not present in MELPA yet #+begin_src emacs-lisp (unless (package-installed-p 'quelpa) (with-temp-buffer (url-insert-file-contents "https://raw.githubusercontent.com/quelpa/quelpa/master/quelpa.el") (eval-buffer) (quelpa-self-upgrade))) #+end_src *** Finally, combine the powers of use-package and quelpa #+begin_src emacs-lisp (quelpa '(quelpa-use-package :fetcher git :url "https://github.com/quelpa/quelpa-use-package.git")) (require 'quelpa-use-package) #+end_src * Emacs configuration ** Set up the really basic things #+begin_src emacs-lisp (use-package emacs :ensure nil :init (defun crm-indicator (args) (cons (format "[CRM%s] %s" (replace-regexp-in-string "\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" "" crm-separator) (car args)) (cdr args))) (advice-add #'completing-read-multiple :filter-args #'crm-indicator) :custom (user-full-name "Gergely Polonkai") (user-mail-address "gergely@polonkai.eu") (kill-read-only-ok t) (use-dialog-box nil) (cursor-type 'bar) (echo-keystrokes .01) (fill-column 80) (initial-scratch-message "") (minibuffer-prompt-properties '(read-only t cursor-intangible t face minibuffer-prompt)) (enable-recursive-minibuffers t) :hook (minibuffer-setup . cursor-intangible-mode)) #+end_src ** Set up some default faces #+begin_src emacs-lisp (use-package faces :ensure nil :custom-face (default ((t (:family "Fira Code Retina" :foundry "simp" :slant normal :weight normal :height 110 :width normal)))) (trailing-whitespace ((t (:inherit nil :background "red3"))))) #+end_src ** Use ligatures #+begin_src emacs-lisp (use-package ligature :config ;; Enable the "www" ligature in every possible major mode (ligature-set-ligatures 't '("www")) ;; Enable traditional ligature support in eww-mode, if the ;; `variable-pitch' face supports it (ligature-set-ligatures 'eww-mode '("ff" "fi" "ffi")) ;; Enable all Cascadia and Fira Code ligatures in programming modes (ligature-set-ligatures 'prog-mode '(;; == === ==== => =| =>>=>=|=>==>> ==< =/=//=// =~ ;; =:= =!= ("=" (rx (+ (or ">" "<" "|" "/" "~" ":" "!" "=")))) ;; ;; ;;; (";" (rx (+ ";"))) ;; && &&& ("&" (rx (+ "&"))) ;; !! !!! !. !: !!. != !== !~ ("!" (rx (+ (or "=" "!" "\." ":" "~")))) ;; ?? ??? ?: ?= ?. ("?" (rx (or ":" "=" "\." (+ "?")))) ;; %% %%% ("%" (rx (+ "%"))) ;; |> ||> |||> ||||> |] |} || ||| |-> ||-|| ;; |->>-||-<<-| |- |== ||=|| ;; |==>>==<<==<=>==//==/=!==:===> ("|" (rx (+ (or ">" "<" "|" "/" ":" "!" "}" "\]" "-" "=" )))) ;; \\ \\\ \/ ("\\" (rx (or "/" (+ "\\")))) ;; ++ +++ ++++ +> ("+" (rx (or ">" (+ "+")))) ;; :: ::: :::: :> :< := :// ::= (":" (rx (or ">" "<" "=" "//" ":=" (+ ":")))) ;; // /// //// /\ /* /> /===:===!=//===>>==>==/ ("/" (rx (+ (or ">" "<" "|" "/" "\\" "\*" ":" "!" "=")))) ;; .. ... .... .= .- .? ..= ..< ("\." (rx (or "=" "-" "\?" "\.=" "\.<" (+ "\.")))) ;; -- --- ---- -~ -> ->> -| -|->-->>->--<<-| ("-" (rx (+ (or ">" "<" "|" "~" "-")))) ;; *> */ *) ** *** **** ("*" (rx (or ">" "/" ")" (+ "*")))) ;; www wwww ("w" (rx (+ "w"))) ;; <>