* Emacs config ** Packages #+begin_src scheme :tangle home/emacs-packages.scm (define-public emacs-parinfer-rust-mode (package (name "emacs-parinfer-rust-mode") (version "0.8.6") (source (origin (method url-fetch) (uri (string-append "https://stable.melpa.org/packages/parinfer-rust-mode-" version ".tar")) (sha256 (base32 "0pg0xrwi6w5xbpm85hbpapj0x12s0npyvfg1x0bvwghmcsn9y4xr")))) (build-system emacs-build-system) (home-page "https://github.com/justinbarclay/parinfer-rust-mode") (synopsis "An interface for the parinfer-rust library") (propagated-inputs (list parinfer-rust)) (description "An intuitive editor mode to make paren management fun and easy without sacrificing power. How it works: Parinfer users the state of the buffer combined with the current mode (paren, indent, or smart) to either balance an s-expression's indentation, paren, or to do both. Let's go over some light examples to get a sense of how parinfer works. I am going to use `|` to indicate the cursor and `_` to indicate the a space that's been added either by the user or parinfer. Paren Mode gives you full control of parens, while Parinfer corrects indentation. For example, if we start off with the cursor before `(foo` ``` |(foo bar) ``` and the user inserts a space ``` _|(foo bar) ``` then parinfer will maintain, infer, that a space is needed in front of `bar)` to maintain indentation ``` |(foo _bar) ``` Indent Mode gives you full control of indentation, while Parinfer corrects or inserts close-parens where appropriate. Now the cursor is before `4` ``` (foo [1 2 3] |4 5 6) ``` and the user inserts a space ``` (foo [1 2 3] _|4 5 6) ``` then parinfer will adjust the `]` and move it down to the follow line to enclose the 4 5 6 ``` (foo [1 2 3 |4 5 6]) ``` Smart Mode is like Indent Mode, but it tries to preserve the structure too. This roughly translates to it treating everything before the cursor as indent-mode and every after the cursor as paren-mode. The cursor is before `(+` ``` (let [x (fn [])] |(+ 1 2) x) ``` and the user add several spaces to the sexp ``` (let [x (fn [])] ________|(+ 1 2) x) ``` Smart-Mode will move a ) and a ] to enclose the addition function call and move the 2 to maintain structure ``` (let [x (fn [] |(+ 1 _________2))] x) ``` To find out more about how parinfer works go to: https://shaunlebron.github.io/parinfer/ `parinfer-rust-mode` provides an interface between the `parinfer-rust` library and Emacs. As such it's primary role is to capture meta information about the buffer and transfer it to the parinfer-rust API. As such parinfer-rust-mode requires that your version of Emacs supports modules.") (license #f))) (define emacs-packages (list emacs-all-the-icons emacs-all-the-icons-dired emacs-company emacs-company-box emacs-company-quickhelp emacs-counsel emacs-crux emacs-dracula-theme emacs-geiser emacs-geiser-guile emacs-gerbil-mode emacs-guix emacs-ivy emacs-ivy-rich emacs-kbd emacs-ligature emacs-magit emacs-meow emacs-org-roam emacs-org-superstar emacs-parinfer-rust-mode ;; emacs-polymode ;; emacs-polymode-org emacs-swiper emacs-telephone-line emacs-which-key emacs-yasnippet)) #+end_src ** Config #+begin_src emacs-lisp :tangle home/init.el (menu-bar-mode -1) (tool-bar-mode -1) (scroll-bar-mode -1) (use-package parinfer-rust :custom ((parinfer-rust-library-directory "/home/skylar/.guix-home/profile/lib/") (parinfer-rust-library "/home/skylar/.guix-home/profile/lib/libparinfer_rust.so")) :hook (emacs-lisp-mode scheme-mode lisp-mode geiser-mode)) (use-package ivy :config (ivy-mode t)) (use-package counsel :config (counsel-mode t)) (use-package swiper :bind ("C-x /" . swiper)) (use-package company :config (global-company-mode t)) (use-package company-quickhelp :config (company-quickhelp-mode 1)) (use-package mu4e :config (setq mu4e-sent-folder "/posteo/Sent" mu4e-drafts-folder "/posteo/Drafts" mu4e-trash-folder "/posteo/Trash" mu4e-get-mail-command "offlineimap" mu4e-update-interval 3000)) (use-package dracula-theme :config (load-theme 'dracula :no-confirm)) (use-package org :hook (org-superstar-mode)) ;; (use-package poly-org ;; :config ;; (pm-around-advice #'org-babel-tangle #'polymode-with-current-base-buffer) ;; (pm-around-advice #'org-babel-demarcate-block #'polymode-with-current-base-buffer) ;; :bind (:map poly-org-mode-map ;; ("C-c C-v C-t" . org-babel-tangle) ;; ("C-c C-v t" . org-babel-tangle) ;; ("C-c C-v C-d" . org-babel-demarcate-block) ;; ("C-c C-v d" . org-babel-demarcate-block)) ;; :hook ((poly-org-mode . (lambda () (setq-local org-src-fontify-natively t))) ;; (org-mode . poly-org-mode))) (use-package geiser-guile :config (add-to-list 'geiser-guile-load-path "~/software/guix")) (use-package yasnippet :config (add-to-list 'yas-snippet-dirs "~/software/guix/etc/snippets/yas/")) (setq user-full-name "Skylar Hill" user-mail-address "stellarskylark@posteo.net") (load-file "~/software/guix/etc/copyright.el") (use-package smtpmail :config (setq message-send-mail-function 'smtpmail-send-it smtpmail-stream-type 'ssl smtpmail-smtp-server "posteo.de" smtpmail-smtp-service 465)) (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"))) ;; <>