Compare commits

...

10 commits

2 changed files with 86 additions and 111 deletions

View file

@ -1,6 +1,7 @@
#+title: Emacs Config #+title: Emacs Config
#+author: Evie Litherland-Smith #+author: Evie Litherland-Smith
#+email: evie@xenia.me.uk #+email: evie@xenia.me.uk
#+startup: content
#+property: header-args:emacs-lisp :results silent #+property: header-args:emacs-lisp :results silent
Personal Emacs configuration. Clone to =~/.config/emacs/= (or Personal Emacs configuration. Clone to =~/.config/emacs/= (or
=~/.emacs.d/=) and install specified plugins using [[file:install.el][the install script]]. =~/.emacs.d/=) and install specified plugins using [[file:install.el][the install script]].
@ -69,6 +70,17 @@ Bind mouse keys to expected movement commands
(keymap-global-set "<mouse-8>" #'previous-buffer) (keymap-global-set "<mouse-8>" #'previous-buffer)
(keymap-global-set "<mouse-9>" #'next-buffer) (keymap-global-set "<mouse-9>" #'next-buffer)
#+end_src #+end_src
Set custom location for backups
#+begin_src emacs-lisp
(setq backup-directory-alist '(("." . "~/.local/state/emacs/backups")))
#+end_src
** Secrets
#+begin_src emacs-lisp
(use-package secrets)
#+end_src
** UI and Appearance ** UI and Appearance
Configure the look and feel of Emacs Configure the look and feel of Emacs
@ -127,7 +139,12 @@ Configure the look and feel of Emacs
(plist-get base16-current-theme-colors :base01)) (plist-get base16-current-theme-colors :base01))
;; Set `org-hide' face to actually match background colour ;; Set `org-hide' face to actually match background colour
(set-face-attribute 'org-hide nil :foreground (set-face-attribute 'org-hide nil :foreground
(plist-get base16-current-theme-colors :base00))) (plist-get base16-current-theme-colors :base00))
(with-eval-after-load 'org-noter
(set-face-attribute 'org-noter-no-notes-exist-face nil :foreground
(plist-get base16-current-theme-colors :base08))
(set-face-attribute 'org-noter-notes-exist-face nil :foreground
(plist-get base16-current-theme-colors :base0B))))
(require 'server) (require 'server)
(add-hook 'after-init-hook (add-hook 'after-init-hook
@ -175,7 +192,7 @@ Configure the look and feel of Emacs
(add-to-list 'package-selected-packages 'visual-fill-column) (add-to-list 'package-selected-packages 'visual-fill-column)
(use-package visual-fill-column (use-package visual-fill-column
:if (package-installed-p 'visual-fill-column) :if (package-installed-p 'visual-fill-column)
:hook (((org-src-mode org-agenda-mode) . (lambda () (visual-fill-column-mode +1))) :hook (((dired-mode org-src-mode org-agenda-mode) . (lambda () (visual-fill-column-mode +1)))
((doc-view-mode image-mode) . (lambda () (visual-fill-column-mode -1)))) ((doc-view-mode image-mode) . (lambda () (visual-fill-column-mode -1))))
:custom :custom
(visual-fill-column-width 160) (visual-fill-column-width 160)
@ -194,14 +211,11 @@ Configure the look and feel of Emacs
:config :config
(ligature-set-ligatures (ligature-set-ligatures
'(text-mode prog-mode org-mode) '(text-mode prog-mode org-mode)
'("<---" "<--" "<<-" "<-" "->" "-->" "--->" "<->" "<-->" "<--->" "<---->" "<!--" '(("<" (rx (= 1 "=")))
"<==" "<===" "<<=" "<=" "=>" "=>>" "==>" "===>" ">=" "<=>" "<==>" "<===>" "<====>" "<!---" (">" (rx (= 1 "=")))
"<~~" "<~" "~>" "~~>" "::" ":::" "==" "!=" "===" "!==" ("-" (rx (* "-") (= 1 ">")))
":=" ":-" ":+" "<*" "<*>" "*>" "<|" "<|>" "|>" "+:" "-:" "=:" "<******>" "++" "+++" ("=" (rx (* "=") (? ">")))
"<:" "*=" "*+" "<." "<.>" ".>" "+*" "=*" ":>" ("!" (rx (+ "=")))))
"(*" "*)" "/*" "*/" "[|" "|]" "{|" "|}" "|-" "-|"))
(ligature-set-ligatures 'markdown-mode '(("=" (rx (+ "=") (? (| ">" "<"))))
("-" (rx (+ "-")))))
(global-ligature-mode +1)) (global-ligature-mode +1))
#+end_src #+end_src
*** Font Showcase *** Font Showcase
@ -349,7 +363,7 @@ Rules and packages for buffer management and window navigation.
(khalel-add-capture-template) (khalel-add-capture-template)
:custom :custom
(khalel-default-alarm "10") (khalel-default-alarm "10")
(khalel-default-calendar "calendar") (khalel-default-calendar nil)
(khalel-import-org-file (expand-file-name "calendar/khal.org" org-directory)) (khalel-import-org-file (expand-file-name "calendar/khal.org" org-directory))
(khalel-import-org-file-read-only nil) (khalel-import-org-file-read-only nil)
(khalel-import-org-file-confirm-overwrite nil) (khalel-import-org-file-confirm-overwrite nil)
@ -449,6 +463,7 @@ Configure email with iCalendar event support, to integrate with
:match-func (lambda (msg) (when msg (string-prefix-p "/Proton" (mu4e-message-field msg :maildir)))) :match-func (lambda (msg) (when msg (string-prefix-p "/Proton" (mu4e-message-field msg :maildir))))
:vars '( :vars '(
(user-mail-address . "e.litherlandsmith@proton.me") (user-mail-address . "e.litherlandsmith@proton.me")
(khalel-default-calendar . "personal")
(mu4e-sent-folder . "/Proton/Sent") (mu4e-sent-folder . "/Proton/Sent")
(mu4e-trash-folder . "/Proton/Trash") (mu4e-trash-folder . "/Proton/Trash")
(mu4e-refile-folder . "/Proton/Archive") (mu4e-refile-folder . "/Proton/Archive")
@ -461,6 +476,7 @@ Configure email with iCalendar event support, to integrate with
:match-func (lambda (msg) (when msg (string-prefix-p "/iCloud" (mu4e-message-field msg :maildir)))) :match-func (lambda (msg) (when msg (string-prefix-p "/iCloud" (mu4e-message-field msg :maildir))))
:vars '( :vars '(
(user-mail-address . "e.litherlandsmith@icloud.com") (user-mail-address . "e.litherlandsmith@icloud.com")
(khalel-default-calendar . "other")
(mu4e-sent-folder . "/iCloud/Sent Messages") (mu4e-sent-folder . "/iCloud/Sent Messages")
(mu4e-trash-folder . "/iCloud/Deleted Messages") (mu4e-trash-folder . "/iCloud/Deleted Messages")
(mu4e-refile-folder . "/iCloud/Archive") (mu4e-refile-folder . "/iCloud/Archive")
@ -473,6 +489,7 @@ Configure email with iCalendar event support, to integrate with
:match-func (lambda (msg) (when msg (string-prefix-p "/Outlook" (mu4e-message-field msg :maildir)))) :match-func (lambda (msg) (when msg (string-prefix-p "/Outlook" (mu4e-message-field msg :maildir))))
:vars '( :vars '(
(user-mail-address . "evie.litherland-smith@ukaea.uk") (user-mail-address . "evie.litherland-smith@ukaea.uk")
(khalel-default-calendar . "work")
(mu4e-sent-folder . "/Outlook/Sent") (mu4e-sent-folder . "/Outlook/Sent")
(mu4e-trash-folder . "/Outlook/Trash") (mu4e-trash-folder . "/Outlook/Trash")
(mu4e-refile-folder . "/Outlook/Archive") (mu4e-refile-folder . "/Outlook/Archive")
@ -639,6 +656,22 @@ Configure email with iCalendar event support, to integrate with
(setq mu4e-notification-support t)) (setq mu4e-notification-support t))
#+end_src #+end_src
*** IRC *** IRC
#+begin_src emacs-lisp
(use-package erc
:commands erc-compute-nick
:custom
(erc-nick (user-login-name))
(erc-user-full-name (user-full-name)))
(defun my/libera-chat-connect ()
"Connect to irc.libera.chat directly."
(interactive)
(require 'erc)
(require 'secrets)
(erc-tls
:server "irc.libera.chat"
:password (secrets-get-secret "default" "IRC libera.chat")))
#+end_src
** Other ** Other
** Initial copy from =init.el= ** Initial copy from =init.el=
#+begin_src emacs-lisp #+begin_src emacs-lisp
@ -652,12 +685,6 @@ Configure email with iCalendar event support, to integrate with
(mouse-wheel-progressive-speed nil) (mouse-wheel-progressive-speed nil)
(mouse-wheel-follow-mouse t)) (mouse-wheel-follow-mouse t))
;; Function for calling `gsync'
(defun my/gsync ()
"Run shell command `gsync' asynchronously."
(interactive)
(async-shell-command "gsync" "*gsync*" "*git-sync-errors*"))
;; Make shebang (#!) file executable when saved ;; Make shebang (#!) file executable when saved
(add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) (add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p)
@ -665,8 +692,6 @@ Configure email with iCalendar event support, to integrate with
(keymap-global-set "<remap> <upcase-word>" 'upcase-dwim) (keymap-global-set "<remap> <upcase-word>" 'upcase-dwim)
(keymap-global-set "<remap> <downcase-word>" 'downcase-dwim) (keymap-global-set "<remap> <downcase-word>" 'downcase-dwim)
(setq backup-directory-alist '(("." . "~/.local/state/emacs/backups")))
(use-package savehist (use-package savehist
:demand :demand
:config :config
@ -1000,6 +1025,7 @@ Configure email with iCalendar event support, to integrate with
(org-icalendar-combined-name "org-mode") (org-icalendar-combined-name "org-mode")
(org-icalendar-combined-description "Emacs org-mode combined export")) (org-icalendar-combined-description "Emacs org-mode combined export"))
(add-to-list 'package-selected-packages 'org-noter)
(use-package org-noter (use-package org-noter
:if (package-installed-p 'org-noter) :if (package-installed-p 'org-noter)
:disabled t :disabled t
@ -1009,7 +1035,7 @@ Configure email with iCalendar event support, to integrate with
(org-noter-always-create-frame nil) (org-noter-always-create-frame nil)
(org-noter-kill-frame-at-session-end nil) (org-noter-kill-frame-at-session-end nil)
(org-noter-auto-save-last-location t) (org-noter-auto-save-last-location t)
(org-noter-default-notes-file-names '("noter.org")) (org-noter-default-notes-file-names '("notes.org"))
(org-noter-doc-property-in-notes t) (org-noter-doc-property-in-notes t)
(org-noter-notes-search-path (org-noter-notes-search-path
(list (expand-file-name "notes" org-directory) (list (expand-file-name "notes" org-directory)
@ -1576,31 +1602,6 @@ Configure email with iCalendar event support, to integrate with
:custom :custom
(bbdb-file (locate-user-emacs-file "bbdb.gpg"))) (bbdb-file (locate-user-emacs-file "bbdb.gpg")))
(use-package erc
:commands erc-compute-nick
:custom
(erc-nick (user-login-name))
(erc-user-full-name (user-full-name)))
(defun my/libera-chat-connect ()
"Connect to irc.libera.chat directly."
(interactive)
(require 'erc)
(require 'password-store)
(erc-tls
:server "irc.libera.chat"
:password (password-store-get 'social/irc.libera.chat)))
(defun my/znc-connect ()
"Connect to my ZNC IRC bouncer."
(interactive)
(require 'erc)
(require 'password-store)
(erc-tls
:server "xenia.me.uk"
:port 6697
:nick (concat (erc-compute-nick) "/liberachat")
:password (password-store-get 'local/znc)))
(use-package eww (use-package eww
:defer t :defer t
:custom :custom
@ -1611,12 +1612,6 @@ Configure email with iCalendar event support, to integrate with
(eww-auto-rename-buffer 'title) (eww-auto-rename-buffer 'title)
(eww-browse-url-new-window-is-tab nil)) (eww-browse-url-new-window-is-tab nil))
(add-to-list 'package-selected-packages 'password-store)
(use-package password-store
:if (package-installed-p 'password-store)
:defer t
:functions password-store-get)
(add-to-list 'package-selected-packages 'scad-mode) (add-to-list 'package-selected-packages 'scad-mode)
(use-package scad-mode (use-package scad-mode
:if (package-installed-p 'scad-mode) :if (package-installed-p 'scad-mode)

100
templates
View file

@ -154,7 +154,6 @@ nix-mode
> " '';") > " '';")
(pkgs "pkgs = import " (p "<nixpkgs>") " {};") (pkgs "pkgs = import " (p "<nixpkgs>") " {};")
(poetry2nix "poetry2nix = (builtins.getFlake \"github:nix-community/poetry2nix\").lib.mkPoetry2Nix {inherit pkgs;};")
(gitpackage "{ lib" n ", stdenv" n ", fetchFromGitHub" n ", " (p "inputs") n ", " (p "inputs") n "}:" n n> (gitpackage "{ lib" n ", stdenv" n ", fetchFromGitHub" n ", " (p "inputs") n ", " (p "inputs") n "}:" n n>
"stdenv.mkDerivation rec {" n> "pname = \"" (p "" pkgn nil) "\";" n> "version = \"" p "\";" n n> "stdenv.mkDerivation rec {" n> "pname = \"" (p "" pkgn nil) "\";" n> "version = \"" p "\";" n n>
@ -169,25 +168,33 @@ nix-mode
"platforms = platforms." "platforms = platforms."
(p (completing-read "Platform: " '("all" "allBut" "arm" "cygwin" "darwin" "freebsd" "gnu" "i686" "illumos" "linux" "mesaPlatforms" "mips" "netbsd" "none" "openbsd" "unix" "x86"))) ";" n> q "};" n> "}" (p (completing-read "Platform: " '("all" "allBut" "arm" "cygwin" "darwin" "freebsd" "gnu" "i686" "illumos" "linux" "mesaPlatforms" "mips" "netbsd" "none" "openbsd" "unix" "x86"))) ";" n> q "};" n> "}"
) )
(pythonshell "let" n
> "pkgs = import " (p "<nixpkgs>") " {};" n
> "python = pkgs." (p "python3") ";" n
> "in pkgs.mkShell {" n
> "packages = with pkgs; [ poetry uv " q "];" n
> "shellHook = ''" n
> "export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.libz}/lib" n
> "${pkgs.poetry}/bin/poetry env use ${python}/bin/python3" n
> "'';" n
> "}")
(poetryoverride "overrides = poetry2nix.defaultPoetryOverrides.extend" n (pyderivation "{ buildPythonPackage, " (p "poetry-core" build) ", " (p "" dependencies) "}:" n
> "(self: super: {" n "buildPythonPackage {" n
> (s package) " =" n > "pname = \"" (p "package") "\";" n
> "super." package ".overridePythonAttrs" n > "version = \"" (p "0.1.0") "\";" n
> "(old: {" n > "src = ./.;" n
> "buildInputs = (old.buildInputs or []) ++ [super." (p "setuptools" ) "];" n > "build-system = [ " (s build)" ];" n
> "});" n > "dependencies = [ " (string-replace "," "" dependencies) " ];" n
> "});" q) > "}")
(pydefault "let" n
> "pkgs = import " (p "<nixpkgs>") " { };" n
> "python3 = pkgs." (p "python3.override { packageOverrides = final: prev: {}; }") ";" n
"in" n
> "python3.pkgs.callPackage ./derivation.nix {" q "}")
(pyshell "let" n
> "pkgs = import " (p "<nixpkgs>") " {};" n
> "python3 = pkgs." (p "python3") ";" n
> "in pkgs.mkShellNoCC {" n
> "packages = [" n
> "(python3.withPackages(" n
> "ps: with ps; ["n
> (p "tkinter") n
> q n
> "]" n
> "))" n
> "];" n
> "}")
python-base-mode python-base-mode
@ -202,49 +209,22 @@ python-base-mode
(logg "logger = logging.getLogger(__name__)") (logg "logger = logging.getLogger(__name__)")
(nimp "raise NotImplementedError") (nimp "raise NotImplementedError")
nix-mode
(pkgs "pkgs = import " (p "<nixpkgs>") " {};")
(poetry2nix "poetry2nix = (builtins.getFlake \"github:nix-community/poetry2nix\").lib.mkPoetry2Nix {inherit pkgs;};")
(pyshell "let" n
> "pkgs = import " (p "<nixpkgs>") " {};" n
> "in pkgs.mkShellNoCC {" n
> "packages = with pkgs; [" n
> "poetry" n
> (p "python3Full") n
> q n
> "];" n
> "shellHook = ''" n
> "export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.zlib}/lib" n
> "'';" n
> "}")
(pyderivation "{ buildPythonPackage, " (p "poetry-core" build) ", " (p "" dependencies) "}:" n
"buildPythonPackage {" n
> "pname = \"" (p "package") "\";" n
> "version = \"" (p "0.1.0") "\";" n
> "src = ./.;" n
> "build-system = [ " (s build)" ];" n
> "dependencies = [ " (string-replace "," "" dependencies) " ];" n
> "}")
(pydefault "let" n
> "pkgs = import " (p "<nixpkgs>") " { };" n
> "python3 = " (p "pkgs.python3") ";" n
"in" n
> "python3.pkgs.callPackage ./derivation.nix {" q "}")
envrc-file-mode envrc-file-mode
(python "CC=\"$(nix build nixpkgs#stdenv.cc.cc.lib --print-out-paths --no-link)\"" n ;; (python "CC=\"$(nix build nixpkgs#stdenv.cc.cc.lib --print-out-paths --no-link)\"" n
"ZLIB=\"$(nix build nixpkgs#zlib --print-out-paths --no-link)\"" n ;; "ZLIB=\"$(nix build nixpkgs#zlib --print-out-paths --no-link)\"" n
"PYTHON=\"$(nix build " (p "nixpkgs#python3Full") " --print-out-paths --no-link)/bin/python3\"" n ;; "PYTHON=\"$(nix build " (p "nixpkgs#python3Full") " --print-out-paths --no-link)/bin/python3\"" n
"VENV_DIR=" (p ".venv") n ;; "VENV_DIR=" (p ".venv") n
"export LD_LIBRARY_PATH=\"$CC/lib\":\"$ZLIB/lib\"" n ;; "export LD_LIBRARY_PATH=\"$CC/lib\":\"$ZLIB/lib\"" n
"if [ ! -f $VENV_DIR/bin/activate ]; then" n ;; "if [ ! -f $VENV_DIR/bin/activate ]; then" n
> "$PYTHON -m venv --clear $VENV_DIR" n ;; > "$PYTHON -m venv --clear $VENV_DIR" n
"else" n ;; "else" n
> "$PYTHON -m venv --upgrade $VENV_DIR" n ;; > "$PYTHON -m venv --upgrade $VENV_DIR" n
"fi" n ;; "fi" n
"source $VENV_DIR/bin/activate") ;; "source $VENV_DIR/bin/activate")
(python "use nix" n
"SRC=$(readlink -f " (p "./" ) ")" n
"export PYTHONPATH=$SRC:" q "$PYTHONPATH")
;; Local Variables: ;; Local Variables:
;; mode: lisp-data ;; mode: lisp-data