Compare commits

..

No commits in common. "f4f40e4f8de0081e921b505df2e275b24b9b2558" and "77af14bed0694f5d20130471146f577f394f61f5" have entirely different histories.

2 changed files with 111 additions and 86 deletions

View file

@ -1,7 +1,6 @@
#+title: Emacs Config
#+author: Evie Litherland-Smith
#+email: evie@xenia.me.uk
#+startup: content
#+property: header-args:emacs-lisp :results silent
Personal Emacs configuration. Clone to =~/.config/emacs/= (or
=~/.emacs.d/=) and install specified plugins using [[file:install.el][the install script]].
@ -70,17 +69,6 @@ Bind mouse keys to expected movement commands
(keymap-global-set "<mouse-8>" #'previous-buffer)
(keymap-global-set "<mouse-9>" #'next-buffer)
#+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
Configure the look and feel of Emacs
@ -139,12 +127,7 @@ Configure the look and feel of Emacs
(plist-get base16-current-theme-colors :base01))
;; Set `org-hide' face to actually match background colour
(set-face-attribute 'org-hide nil :foreground
(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))))
(plist-get base16-current-theme-colors :base00)))
(require 'server)
(add-hook 'after-init-hook
@ -192,7 +175,7 @@ Configure the look and feel of Emacs
(add-to-list 'package-selected-packages 'visual-fill-column)
(use-package visual-fill-column
:if (package-installed-p 'visual-fill-column)
:hook (((dired-mode org-src-mode org-agenda-mode) . (lambda () (visual-fill-column-mode +1)))
:hook (((org-src-mode org-agenda-mode) . (lambda () (visual-fill-column-mode +1)))
((doc-view-mode image-mode) . (lambda () (visual-fill-column-mode -1))))
:custom
(visual-fill-column-width 160)
@ -211,11 +194,14 @@ Configure the look and feel of Emacs
:config
(ligature-set-ligatures
'(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))
#+end_src
*** Font Showcase
@ -363,7 +349,7 @@ Rules and packages for buffer management and window navigation.
(khalel-add-capture-template)
:custom
(khalel-default-alarm "10")
(khalel-default-calendar nil)
(khalel-default-calendar "calendar")
(khalel-import-org-file (expand-file-name "calendar/khal.org" org-directory))
(khalel-import-org-file-read-only nil)
(khalel-import-org-file-confirm-overwrite nil)
@ -463,7 +449,6 @@ Configure email with iCalendar event support, to integrate with
:match-func (lambda (msg) (when msg (string-prefix-p "/Proton" (mu4e-message-field msg :maildir))))
:vars '(
(user-mail-address . "e.litherlandsmith@proton.me")
(khalel-default-calendar . "personal")
(mu4e-sent-folder . "/Proton/Sent")
(mu4e-trash-folder . "/Proton/Trash")
(mu4e-refile-folder . "/Proton/Archive")
@ -476,7 +461,6 @@ Configure email with iCalendar event support, to integrate with
:match-func (lambda (msg) (when msg (string-prefix-p "/iCloud" (mu4e-message-field msg :maildir))))
:vars '(
(user-mail-address . "e.litherlandsmith@icloud.com")
(khalel-default-calendar . "other")
(mu4e-sent-folder . "/iCloud/Sent Messages")
(mu4e-trash-folder . "/iCloud/Deleted Messages")
(mu4e-refile-folder . "/iCloud/Archive")
@ -489,7 +473,6 @@ Configure email with iCalendar event support, to integrate with
:match-func (lambda (msg) (when msg (string-prefix-p "/Outlook" (mu4e-message-field msg :maildir))))
:vars '(
(user-mail-address . "evie.litherland-smith@ukaea.uk")
(khalel-default-calendar . "work")
(mu4e-sent-folder . "/Outlook/Sent")
(mu4e-trash-folder . "/Outlook/Trash")
(mu4e-refile-folder . "/Outlook/Archive")
@ -656,22 +639,6 @@ Configure email with iCalendar event support, to integrate with
(setq mu4e-notification-support t))
#+end_src
*** 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
** Initial copy from =init.el=
#+begin_src emacs-lisp
@ -685,6 +652,12 @@ Configure email with iCalendar event support, to integrate with
(mouse-wheel-progressive-speed nil)
(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
(add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p)
@ -692,6 +665,8 @@ Configure email with iCalendar event support, to integrate with
(keymap-global-set "<remap> <upcase-word>" 'upcase-dwim)
(keymap-global-set "<remap> <downcase-word>" 'downcase-dwim)
(setq backup-directory-alist '(("." . "~/.local/state/emacs/backups")))
(use-package savehist
:demand
:config
@ -1025,7 +1000,6 @@ Configure email with iCalendar event support, to integrate with
(org-icalendar-combined-name "org-mode")
(org-icalendar-combined-description "Emacs org-mode combined export"))
(add-to-list 'package-selected-packages 'org-noter)
(use-package org-noter
:if (package-installed-p 'org-noter)
:disabled t
@ -1035,7 +1009,7 @@ Configure email with iCalendar event support, to integrate with
(org-noter-always-create-frame nil)
(org-noter-kill-frame-at-session-end nil)
(org-noter-auto-save-last-location t)
(org-noter-default-notes-file-names '("notes.org"))
(org-noter-default-notes-file-names '("noter.org"))
(org-noter-doc-property-in-notes t)
(org-noter-notes-search-path
(list (expand-file-name "notes" org-directory)
@ -1602,6 +1576,31 @@ Configure email with iCalendar event support, to integrate with
:custom
(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
:defer t
:custom
@ -1612,6 +1611,12 @@ Configure email with iCalendar event support, to integrate with
(eww-auto-rename-buffer 'title)
(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)
(use-package scad-mode
:if (package-installed-p 'scad-mode)

View file

@ -154,6 +154,7 @@ nix-mode
> " '';")
(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>
"stdenv.mkDerivation rec {" n> "pname = \"" (p "" pkgn nil) "\";" n> "version = \"" p "\";" n n>
@ -168,34 +169,26 @@ nix-mode
"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> "}"
)
(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 = pkgs." (p "python3.override { packageOverrides = final: prev: {}; }") ";" n
"in" n
> "python3.pkgs.callPackage ./derivation.nix {" q "}")
(pyshell "let" n
(pythonshell "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 = 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
> "(self: super: {" n
> (s package) " =" n
> "super." package ".overridePythonAttrs" n
> "(old: {" n
> "buildInputs = (old.buildInputs or []) ++ [super." (p "setuptools" ) "];" n
> "});" n
> "});" q)
python-base-mode
(main "def main(" (p "*args, **kwargs") ") -> " (p "None") ":" n
@ -209,22 +202,49 @@ python-base-mode
(logg "logger = logging.getLogger(__name__)")
(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
;; (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
;; "PYTHON=\"$(nix build " (p "nixpkgs#python3Full") " --print-out-paths --no-link)/bin/python3\"" n
;; "VENV_DIR=" (p ".venv") n
;; "export LD_LIBRARY_PATH=\"$CC/lib\":\"$ZLIB/lib\"" n
;; "if [ ! -f $VENV_DIR/bin/activate ]; then" n
;; > "$PYTHON -m venv --clear $VENV_DIR" n
;; "else" n
;; > "$PYTHON -m venv --upgrade $VENV_DIR" n
;; "fi" n
;; "source $VENV_DIR/bin/activate")
(python "use nix" n
"SRC=$(readlink -f " (p "./" ) ")" n
"export PYTHONPATH=$SRC:" q "$PYTHONPATH")
(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
"PYTHON=\"$(nix build " (p "nixpkgs#python3Full") " --print-out-paths --no-link)/bin/python3\"" n
"VENV_DIR=" (p ".venv") n
"export LD_LIBRARY_PATH=\"$CC/lib\":\"$ZLIB/lib\"" n
"if [ ! -f $VENV_DIR/bin/activate ]; then" n
> "$PYTHON -m venv --clear $VENV_DIR" n
"else" n
> "$PYTHON -m venv --upgrade $VENV_DIR" n
"fi" n
"source $VENV_DIR/bin/activate")
;; Local Variables:
;; mode: lisp-data