From 518c99427f5dcb1435fbc2ffb66523194f7ea408 Mon Sep 17 00:00:00 2001 From: "DavidCrompton1192@gmail.com" Date: Tue, 15 Aug 2023 23:17:52 -0400 Subject: [PATCH] Flake ++ Org Config --- .gitignore | 4 + custom.el | 30 +- flake.lock | 133 ++++++++ flake.nix | 30 ++ init.el | 449 ++------------------------- main.org | 431 +++++++++++++++++++++++++ themes/UniverseHighContrast-theme.el | 24 +- 7 files changed, 648 insertions(+), 453 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 main.org diff --git a/.gitignore b/.gitignore index f7a4324..1b31600 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,7 @@ tramp /elpa/ /eln-cache/ /%backup%~ +/el-get/ +/main.el +/result +/transient/ diff --git a/custom.el b/custom.el index 8581b93..0aa55ac 100644 --- a/custom.el +++ b/custom.el @@ -5,7 +5,7 @@ ;; If there is more than one, they won't work right. '(conda-anaconda-home "~/opt/anaconda3") '(custom-safe-themes - '("8cda1cfae8e393bfb23f1d448d4be10720835d086f7db080908a7c8d01566516" "a27f7b52fe66bacaec9059f8afd04d055a4ac3c2fba9eb9128c81e10152fc566" "1ba7196d8e7b883272ea8818a5163aec21b57023368febf55255816226f7b370" "8256e7e03444834d34915a226dc24933b0d680a0a1da568ec03f852be776f168" "4ac2f45e6b46e5bb50826d4250df71a57124169b82cc0ad75e436de6e70a9690" "29addd67feb95ca1179e60d476bb92c1f11835548e2efaec15c9ac6af2a8e6a8" "9b7a425c38c4894e161887c26381c2a6fc1de3c1407158507caaf469d76eb27b" "bce055e1681dd343659957710af77f7a6ad106677d42c61f86ebeedf637c4493" "f62c69472d3f506179d797131c014fe4095d9609dddf14542c50e0388f1e8d6d" "cf143bf23fa8160f87331893cdadc40b876556634621dfa373fcf93c4c97c444" "f459dfd377e9cb98d90e53383dcca7d73396cc0a22b31d39af24fb1cf3548fb5" "fcc14e1a22c99d77f7b1455b0c8a320f8afd0c1f4a9c5c50b45f676eb0c54ba2" "a6bae299481c3c0058e611d2c32ca169fa27203345a880806a5a8554cdd2e588" "feb9556e03558588e29e6659c8e01ea3d2a17a1e7a13e9bf9fc9e59cacba4b72" default)) + '("5f79df6b4c56021d173c178d90b5a600c678a192d78cc639553915985b67c4ea" "8cda1cfae8e393bfb23f1d448d4be10720835d086f7db080908a7c8d01566516" "a27f7b52fe66bacaec9059f8afd04d055a4ac3c2fba9eb9128c81e10152fc566" "1ba7196d8e7b883272ea8818a5163aec21b57023368febf55255816226f7b370" "8256e7e03444834d34915a226dc24933b0d680a0a1da568ec03f852be776f168" "4ac2f45e6b46e5bb50826d4250df71a57124169b82cc0ad75e436de6e70a9690" "29addd67feb95ca1179e60d476bb92c1f11835548e2efaec15c9ac6af2a8e6a8" "9b7a425c38c4894e161887c26381c2a6fc1de3c1407158507caaf469d76eb27b" "bce055e1681dd343659957710af77f7a6ad106677d42c61f86ebeedf637c4493" "f62c69472d3f506179d797131c014fe4095d9609dddf14542c50e0388f1e8d6d" "cf143bf23fa8160f87331893cdadc40b876556634621dfa373fcf93c4c97c444" "f459dfd377e9cb98d90e53383dcca7d73396cc0a22b31d39af24fb1cf3548fb5" "fcc14e1a22c99d77f7b1455b0c8a320f8afd0c1f4a9c5c50b45f676eb0c54ba2" "a6bae299481c3c0058e611d2c32ca169fa27203345a880806a5a8554cdd2e588" "feb9556e03558588e29e6659c8e01ea3d2a17a1e7a13e9bf9fc9e59cacba4b72" default)) '(delete-selection-mode nil) '(dired-listing-switches "-alh") '(elpy-rpc-python-command "python3") @@ -76,6 +76,8 @@ ("pdflatex -interaction nonstopmode -output-directory %o %f") :image-converter ("convert -density %D -trim -antialias %f -quality 100 %O")))) + '(package-selected-packages + '(lsp-dart dart-mode gnuplot auctex ox-pandoc pdf-tools org-ref helm-bibtex ivy-bibtex geiser-racket rainbow-delimiters rust-mode company-ghci lsp-haskell haskell-mode meson-mode company-c-headers company-ctags poetry python-mode which-key dap-mode helm-lsp lsp-treemacs flycheck lsp-ui lsp-mode company yaml-mode d2-mode php-mode web-mode nix-mode direnv magit esup ligature exec-path-from-shell transient-dwim leaf-convert leaf-tree blackout hydra el-get leaf-keywords leaf)) '(python-shell-completion-native-enable nil) '(sql-sqlite-program "sqlite3") '(warning-suppress-types '((comp) (comp) (comp) (comp) (comp)))) @@ -163,32 +165,10 @@ (comp) (comp) (comp))) + (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. - '(default ((t (:family "JuliaMono" :height 150 :weight normal)))) - '(company-preview ((t (:background "#000000" :foreground "#ffffff")))) - '(company-preview-common ((t (:inherit company-preview :foreground "#ff00cf")))) - '(company-preview-search ((t (:inherit company-preview :background "black")))) - '(company-scrollbar-bg ((t (:background "grey35"))) t) - '(company-scrollbar-fg ((t (:background "#a22390"))) t) - '(company-template-field ((t (:background "grey75" :foreground "black")))) - '(company-tooltip ((t (:background "#353535" :foreground "white")))) - '(company-tooltip-common ((t (:foreground "magenta")))) - '(company-tooltip-mouse ((t (:inherit company-tooltip-selection)))) - '(company-tooltip-scrollbar-thumb ((t (:background "#a22390")))) - '(company-tooltip-scrollbar-track ((t (:background "grey35")))) - '(company-tooltip-search ((t (:inherit company-tooltip-selection)))) - '(company-tooltip-search-selection ((t (:inherit company-tooltip-selection)))) - '(company-tooltip-selection ((t (:background "#4584a2" :foreground "white")))) - '(elpy-codecell-boundary ((t (:background "#333")))) - '(rainbow-delimiters-depth-1-face ((t (:foreground "#69f")))) - '(rainbow-delimiters-depth-2-face ((t (:foreground "#39b")))) - '(rainbow-delimiters-depth-3-face ((t (:foreground "#278")))) - '(rainbow-delimiters-depth-4-face ((t (:foreground "#281")))) - '(rainbow-delimiters-depth-5-face ((t (:foreground "#047")))) - '(rainbow-delimiters-depth-6-face ((t (:foreground "#138")))) - '(rainbow-delimiters-depth-7-face ((t (:foreground "#708")))) - '(rainbow-delimiters-depth-8-face ((t (:foreground "#920"))))) + '(default ((t (:family "JuliaMono" :height 150 :weight normal))) nil "Customized with leaf in `visual' block at `/home/universe/.emacs.d/main.el'")) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..6833068 --- /dev/null +++ b/flake.lock @@ -0,0 +1,133 @@ +{ + "nodes": { + "emacs-overlay": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1692037570, + "narHash": "sha256-bvj/wfLLFTc8cWAwhN8tgShiy8ekPWt1+gWlEH7W4zY=", + "owner": "nix-community", + "repo": "emacs-overlay", + "rev": "7a4b5bbc06182e2f704630cd77a614ab0d9c2f2e", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "emacs-overlay", + "type": "github" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1691990649, + "narHash": "sha256-gMbKOiX1HwClRP9lADaaV/lnZr93NEaOFe4ApDx/zd8=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6e287913f7b1ef537c97aa301b67c34ea46b640f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1691950488, + "narHash": "sha256-iUNEeudc4dGjx+HsHccnGiuZUVE/nhjXuQ1DVCsHIUY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "720e61ed8de116eec48d6baea1d54469b536b985", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "emacs-overlay": "emacs-overlay", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..41d074b --- /dev/null +++ b/flake.nix @@ -0,0 +1,30 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + inputs.emacs-overlay.url = "github:nix-community/emacs-overlay"; + inputs.emacs-overlay.inputs.nixpkgs.follows = "nixpkgs"; + inputs.flake-utils.url = "github:numtide/flake-utils"; + + outputs = { self, nixpkgs, flake-utils, emacs-overlay }: + flake-utils.lib.eachDefaultSystem (system: let + pkgs = import nixpkgs { + inherit system; + overlays = [ + emacs-overlay.overlays.default + ]; + }; + in { + packages = { + emacs = pkgs.emacsWithPackagesFromUsePackage { + config = ./main.org; + package = pkgs.emacs29; + }; + }; + devShells = { + default = pkgs.mkShell { + packages = with pkgs; [ + + ]; + }; + }; + }); +} diff --git a/init.el b/init.el index a6972d5..8f50a8e 100644 --- a/init.el +++ b/init.el @@ -1,431 +1,26 @@ -;; -*- lexical-binding: t -*- +;;; init.el --- Where all the magic begins +;; +;; This file loads Org and then loads the rest of our Emacs initialization from Emacs lisp +;; embedded in literate Org files. -;; Bootstrap straight.el for package management -(defvar bootstrap-version) -(let ((bootstrap-file - (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory)) - (bootstrap-version 5)) - (unless (file-exists-p bootstrap-file) - (with-current-buffer - (url-retrieve-synchronously - "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" - 'silent 'inhibit-cookies) - (goto-char (point-max)) - (eval-print-last-sexp))) - (load bootstrap-file nil 'nomessage)) -;; Disable package.el from loading at startup -(setq package-enable-at-startup nil) +;; Load up Org Mode and (now included) Org Babel for elisp embedded in Org Mode files +(setq dotfiles-dir (file-name-directory (or (buffer-file-name) load-file-name))) -;; Ensure custom writes to specific file -(setq custom-file (expand-file-name "custom.el" user-emacs-directory)) -(load custom-file 'noerror 'nomessage) +(let* ((org-dir (expand-file-name + "lisp" (expand-file-name + "org" (expand-file-name + "src" dotfiles-dir)))) + (org-contrib-dir (expand-file-name + "lisp" (expand-file-name + "contrib" (expand-file-name + ".." org-dir)))) + (load-path (append (list org-dir org-contrib-dir) + (or load-path nil)))) + ;; load up Org and Org-babel + (require 'org) + (require 'ob-tangle)) -;; Change the location of file backups/locks into the emacs.d/backups/ -(setq backup-directory-alist - `(("." . ,(concat user-emacs-directory "backups")))) +;; load up all literate org-mode files in this directory +(mapc #'org-babel-load-file (directory-files dotfiles-dir t "\\.org$")) -;;;; VISUAL - -;; Disable Scroll bar, menubar -(menu-bar-mode -1) -(tool-bar-mode -1) -(scroll-bar-mode -1) - -;; Set custom font to Julia-Mono -(custom-set-faces - '(default ((t (:family "JuliaMono" - :height 150 - :weight normal))))) - -;; Set location of custom theme dir -(setq custom-theme-directory (concat user-emacs-directory "themes")) -(load-theme 'UniverseHighContrast) - -;;;; END VISUAL - -;;;; PACKAGE INSTALL AND CONFIG - -;; Set the packagemanager of use-package -(setq straight-use-package-by-default t) - -;; Default to lazy loading -(setq use-package-always-defer t) -;; Ensure use-package.el is installed -(straight-use-package 'use-package) - -;; Load font ligatures, fancy arrows etc. -(use-package ligature - :straight (ligature - :package "ligature" - :host github - :type git - :repo "mickeynp/ligature.el") - :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 Code ligatures in programming modes - (ligature-set-ligatures 'prog-mode '("|||>" "<|||" "<==>" "" "---" "-<<" - "<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->" - "<--" "<-<" "<<=" "<<-" "<<<" "<+>" "" "###" "#_(" "..<" - "..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~=" - "~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|" - "[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:" - ">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:" - "<$" "<=" "<>" "<-" "<<" "<+" "" "++" "?:" - "?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)" - "\\\\" "://")) - ;; Enables ligature checks globally in all buffers. You can also do it - ;; per mode with `ligature-mode'. - (global-ligature-mode t)) - -;; Ensure shell variables are loaded -(use-package exec-path-from-shell :demand - :init - (exec-path-from-shell-initialize) - ) - -;; Profiling -;; (use-package esup) - -;; Prevents emacs and packages from messily writing to dirs -(use-package no-littering - :demand t) - -;; Version control -(use-package magit) - -;;;; Nix Related - -;; Nix direnv support -(use-package direnv - :demand t - :config - (direnv-mode)) - -(use-package nix-mode) - -;;;; End Nix Related - -;;;; Web Related -(use-package web-mode - :mode - ( - ".phtml$" - ".html?$" - ".djtml$" - ".jsx?$" - ".tsx?$" - ) - ) - -(use-package php-mode) -;;;; End Web related - -;;;; D2-lang -(use-package d2-mode) - -;;;; Yaml -(use-package yaml-mode) - -;;;; Company Related -(use-package company :demand t - :bind - (("C-" . company-complete)) - :custom-face - (company-preview ((t (:background "#000000" :foreground "#ffffff")))) - (company-preview-common ((t (:inherit company-preview :foreground "#ff00cf")))) - (company-preview-search ((t (:inherit company-preview :background "black")))) - (company-scrollbar-bg ((t (:background "grey35")))) - (company-scrollbar-fg ((t (:background "#a22390")))) - (company-template-field ((t (:background "grey75" :foreground "black")))) - (company-tooltip ((t (:background "#353535" :foreground "white")))) - (company-tooltip-common ((t (:foreground "magenta")))) - (company-tooltip-mouse ((t (:inherit company-tooltip-selection)))) - (company-tooltip-search ((t (:inherit company-tooltip-selection)))) - (company-tooltip-search-selection ((t (:inherit company-tooltip-selection)))) - (company-tooltip-selection ((t (:background "#4584a2" :foreground "white")))) - ) -(add-hook 'after-init-hook 'global-company-mode) - -;; LSP related -(use-package lsp-haskell) -(use-package lsp-mode - :demand t - :init - (setq lsp-keymap-prefix "C-c l") - :hook - ( - (dart-mode . lsp) - (python-mode . lsp) - (c-mode . lsp) - (c++-mode . lsp) - (haskell-mode . lsp) - (java-mode . lsp) - (rust-mode . lsp) - ;; which key support v v v - (lsp-mode . lsp-enable-which-key-integration) - ) - :commands lsp) - -;; optionally -(use-package lsp-ui :commands lsp-ui-mode) -;; if you are helm user -(use-package helm-lsp :commands helm-lsp-workspace-symbol) -;; if you are ivy user -(use-package lsp-ivy :commands lsp-ivy-workspace-symbol) -(use-package lsp-treemacs :commands lsp-treemacs-errors-list) - -;; optionally if you want to use debugger -(use-package dap-mode) -;; (use-package dap-LANGUAGE) to load the dap adapter for your language -;; optional if you want which-key integration -(use-package which-key - :config - (which-key-mode)) -;; END LSP related - -;; projectile -(use-package projectile - :commands projectile-mode) -(projectile-mode +1) -;; Recommended keymap prefix on macOS -(define-key projectile-mode-map (kbd "s-p") 'projectile-command-map) -;; projectile - -;; Python -(use-package python-mode - :straight (python-mode - :package "python-mode" - :host gitlab - :type git - :repo "python-mode-devs/python-mode")) - -(setq python-shell-interpreter "ipython" - python-shell-interpreter-args "-i --simple-prompt --InteractiveShell.display_page=True") - -;;; Python Poetry -(use-package poetry - :ensure t) - -;; Java related -(use-package lsp-java - :hook ( - (java-mode . lsp) - ) - ) - -;; C related -(use-package company-ctags) -(use-package company-c-headers) -(use-package meson-mode) - -;; Haskell -(use-package company-ghci) -;;;; End Company Related - -;; Rust related -(use-package rust-mode) -;; End Rust - -;; Minecraft Functions -(use-package mcf-mode - :straight (mcf-mode - :package "mcf-mode" - :host github - :type git - :repo "rasensuihei/mcf")) - -;; End Minecraft Functions - -;;;; FPGA Related -(use-package verilog-mode) -(use-package vhdl-mode) - -;;;; Haskell Related -(use-package haskell-mode - :config - (setq haskell-mode-hook '(flyspell-prog-mode interactive-haskell-mode)) - ) -(use-package lsp-haskell) - -(use-package ghci-completion) -;;;; End Haskell Related - -;;;; NEURON Related -;; -- TODO -;;;; END NEURON Related - -;;; Lisp / Parentheses Related -(use-package rainbow-delimiters - :commands rainbow-delimiters-mode - :hook ( - (emacs-lisp-mode . rainbow-delimiters-mode) - (geiser-mode . rainbow-delimiters-mode) - ) - :custom-face - (rainbow-delimiters-depth-1-face ((t (:foreground "#69f"))) ) - (rainbow-delimiters-depth-2-face ((t (:foreground "#39b"))) ) - (rainbow-delimiters-depth-3-face ((t (:foreground "#278"))) ) - (rainbow-delimiters-depth-4-face ((t (:foreground "#281"))) ) - (rainbow-delimiters-depth-5-face ((t (:foreground "#047"))) ) - (rainbow-delimiters-depth-6-face ((t (:foreground "#138"))) ) - (rainbow-delimiters-depth-7-face ((t (:foreground "#708"))) ) - (rainbow-delimiters-depth-8-face ((t (:foreground "#920"))) ) - ) -(use-package paredit - :hook ( - (emacs-lisp-mode . paredit-mode) - (geiser-mode . paredit-mode) - ) - ) -;;; End Lisp / Parentheses Related - -;;;; Racket Related -(use-package geiser-racket) -;;;; End Racket Related - -;;;; Org Related - -;; FlySpell -(use-package flyspell) -(setq flyspell-issue-message-flag nil - ispell-local-dictionary "en_GB" - ispell-program-name "aspell" - ispell-list-command "--list") - -;; Completion engine -(use-package ivy-bibtex) -;; Interactive menus -(use-package helm-bibtex) -;; PDF preview etc. -(use-package pdf-tools) -;; References etc. -(use-package org-ref) - -(use-package org - :straight (:type built-in) - :config - (require 'doi-utils) - (require 'org-ref) - (require 'org-ref-ivy) - (require 'org-ref-helm) - (require 'org-tempo) - - (setq org-src-fontify-natively t - org-confirm-babel-evaluate nil - org-src-preserve-indentation t) - - (setq bibtex-completion-bibliography - (list (expand-file-name "~/Documents/Bibliography/references.bib"))) - - (setq org-ref-bibliography-notes "~/Documents/Bibliography/notes.org" - org-ref-default-bibliography '("~/Documents/Bibliography/references.bib") - org-ref-pdf-directory "~/Documents/Bibliography/bibtex-pdfs/") - - (setq org-ref-insert-link-function 'org-ref-insert-link-hydra/body - org-ref-insert-cite-function 'org-ref-cite-insert-helm - org-ref-insert-label-function 'org-ref-insert-label-link - org-ref-insert-ref-function 'org-ref-insert-ref-link - org-ref-cite-onclick-function (lambda (_) (org-ref-citation-hydra/body))) - - (define-key org-mode-map (kbd "C-c ]") 'org-ref-insert-link) - (define-key org-mode-map (kbd "s-[") 'org-ref-insert-link-hydra/body) - - (tempo-define-template - "Lab Template" '("#+TITLE: PHY324: LAB TITLE"n - "#+AUTHOR: ***REMOVED*** | ***REMOVED***"n - "#+DATE: \\today"n - "#+LATEX_HEADER: \\usepackage{natbib}"n - "#+LATEX_HEADER: \\usepackage{float}"n - "#+LATEX_CLASS: labtemplate"n - "#+OPTIONS: toc:nil"n - ""n - "* Abstract:"n - "* Introduction:"n > p - "* Methods:"n - "* Results:"n - "* Discussion:"n - "bibliographystyle:ieeetr"n - "bibliography:~/Documents/Bibliography/references.bib" >) - " n > - "#+NAME: fig:" (s name) > n > - "#+ATTR_LaTeX: :placement [H]" > n > - "[[" (s image) "]]" > n > p >) - " + (eval-and-compile + (customize-set-variable + 'package-archives '(("org" . "https://orgmode.org/elpa/") + ("melpa" . "https://melpa.org/packages/") + ("gnu" . "https://elpa.gnu.org/packages/"))) + (package-initialize) + (unless (package-installed-p 'leaf) + (package-refresh-contents) + (package-install 'leaf)) + + (leaf leaf-keywords + :ensure t + :init + (leaf el-get :ensure t) + (leaf hydra :ensure t) + (leaf blackout :ensure t) + + :config + ;; initialize leaf-keywords.el + (leaf-keywords-init))) + ;; + + (leaf leaf-tree :ensure t) + (leaf leaf-convert :ensure t) + (leaf transient-dwim + :ensure t + :bind (("M-=" . transient-dwim-dispatch))) +#+end_src + +#+begin_src elisp + (leaf custom-el + :config + ;; Ensure custom writes to specific file + (setq custom-file (expand-file-name "custom.el" user-emacs-directory)) + (load custom-file 'noerror 'nomessage)) +#+end_src + +#+begin_src elisp + (leaf backup + :config + ;; Change the location of file backups/locks into the emacs.d/backups/ + (setq backup-directory-alist + `(("." . ,(concat user-emacs-directory "backups"))))) +#+end_src + +* Visual Customization + +#+begin_src elisp +(leaf visual + :doc "Visual Changes to Emacs" + :tag "builtin" "internal" + :custom ((menu-bar-mode . nil) + (tool-bar-mode . nil) + (scroll-bar-mode . nil)) + :custom-face ((default . '((t (:family "JuliaMono" + :height 150 + :weight normal))))) + :config (prog1 'visual + ;; Set location of custom theme dir + (setq custom-theme-directory (concat user-emacs-directory "themes")) + (load-theme 'UniverseHighContrast))) +#+end_src + +* Package Configuration + +** Path Preservation + +Exec-path-from-shell ensures that path variable is preserved from +shell. + +#+begin_src elisp + (leaf exec-path-from-shell :ensure t + :config + (exec-path-from-shell-initialize)) +#+end_src + +** Font Related + +*** Ligature + +Font related ligatures, combining multiple characters into "one". + +#+begin_src elisp + (leaf ligature + :ensure t + :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 Code ligatures in programming modes + (ligature-set-ligatures 'prog-mode '("|||>" "<|||" "<==>" "" "---" "-<<" + "<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->" + "<--" "<-<" "<<=" "<<-" "<<<" "<+>" "" "###" "#_(" "..<" + "..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~=" + "~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|" + "[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:" + ">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:" + "<$" "<=" "<>" "<-" "<<" "<+" "" "++" "?:" + "?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)" + "\\\\" "://")) + ;; Enables ligature checks globally in all buffers. You can also do it + ;; per mode with `ligature-mode'. + (global-ligature-mode t)) +#+end_src + +** Profiling +#+begin_src elisp + (leaf esup :disabled nil :ensure t) +#+end_src + +** Version Control +#+begin_src elisp + (leaf magit :ensure t :require t) +#+end_src + +** Nix Related + +*** Direnv + +In order to support direnv (loading =nix-shell= / =nix develop=) +#+begin_src elisp + (leaf direnv + :ensure t + :hook + (direnv-mode)) +#+end_src + +*** Nix-mode + +=.nix= file mode +#+begin_src elisp + (leaf nix-mode :ensure t) +#+end_src + +** WEB + +We all know the web is the future, obviously, of course. + +#+begin_src elisp + (leaf web-mode + :ensure t + :mode + "\\.p?html?\\'" + "\\.djtml\\'" + "\\.jsx?\\'" + "\\.tsx?\\'") + (leaf php-mode + :ensure t) +#+end_src + +** D2 + +#+begin_src elisp + (leaf d2-mode :ensure t) +#+end_src + +** YAML + +#+begin_src elisp + (leaf yaml-mode :ensure t) +#+end_src + +** IDE Like Things +*** Company Completion! + +We like autocomplete, it... is nice, okay? + +#+begin_src elisp + (leaf company :ensure t + :bind + (("C-" . company-complete)) + :hook after-init-hook + :config (global-company-mode)) +#+end_src +*** Language Server Protocol + +We love language features that make languages nice + +#+begin_src elisp + (leaf lsp-mode + :ensure t + :init + (setq lsp-keymap-prefix "C-c l") + :hook + ((dart-mode-hook . lsp) + (python-mode-hook . lsp) + (c-mode-hook . lsp) + (c++-mode-hook . lsp) + (haskell-mode-hook . lsp) + (java-mode-hook . lsp) + (rust-mode-hook . lsp) + ;; which key support v v v + (lsp-mode-hook . lsp-enable-which-key-integration)) + :commands lsp + :config + (leaf lsp-ui :ensure t + :commands lsp-ui-mode) + (leaf flycheck :ensure t) + (leaf lsp-treemacs :ensure t + :commands lsp-treemacs-errors-list) + (leaf helm-lsp :ensure t + :commands helm-lsp-workspace-symbol) + (leaf dap-mode :ensure t) + (leaf which-key :ensure t + :config (which-key-mode))) +#+end_src +**** Projectile (Projects) +#+begin_src elisp + (leaf projectile + :commands projectile-mode + :config + (projectile-mode +1)) +#+end_src +** Python Things +*** Python-mode + +Using python-mode is to have more up to date features (and +highlighting) compared to builtin python-mode. + +#+begin_src elisp + (leaf python-mode :ensure t + :config + (setq python-shell-interpreter "ipython" + python-shell-interpreter-args "-i --simple-prompt --InteractiveShell.display_page=True")) +#+end_src +*** Poetry + +For when we aren't nix'ing things, and want some nice poetry. + +#+begin_src elisp + (leaf poetry :ensure t) +#+end_src +** Java + +LSP for java is /nice/. + +#+begin_src elisp + (leaf lsp-java + :hook (java-mode-hook . lsp)) +#+end_src +** C +Who even needs C++, not me, no way, no how. +#+begin_src elisp + (leaf company-ctags :ensure t) + (leaf company-c-headers :ensure t) + (leaf meson-mode :ensure t) +#+end_src +** Haskell +#+begin_src elisp + (leaf haskell-mode :ensure t + :config + (leaf lsp-haskell :ensure t) + (leaf company-ghci :ensure t)) +#+end_src +** Rust +#+begin_src elisp + (leaf rust-mode :ensure t) +#+end_src +** Minecraft?? +Minecraft =mcfunction= support, because, it can be annoying to type +this stuff otherwise. +#+begin_src elisp + (leaf mcf-mode + :el-get rasensuihei/mcf) +#+end_src +** Lisps + +Gonna need to have pretty brackets +#+begin_src elisp + (leaf rainbow-delimiters + :ensure t + :commands rainbow-delimiters-mode + :config + (leaf rainbow + :hook (emacs-lisp-mode-hook . rainbow-delimiters-mode) + (geiser-mode-hook . rainbow-delimiters-mode))) +#+end_src +*** Racket +Makes using racket so much nicer + +#+begin_src elisp + (leaf geiser-racket :ensure t) +#+end_src +** Org + +We use org-ref because it provides some niceties, like doi-utils for +updating our bibliography. + +#+begin_src elisp + (leaf ivy-bibtex :ensure t) + (leaf helm-bibtex :ensure t) + (leaf org-ref :ensure t + :after org + :init + (leaf pdf-tools :ensure t) + :config + :require org-ref org-ref-ivy org-ref-helm doi-utils) +#+end_src + +For more export formats we use pandoc: +#+begin_src elisp + (leaf ox-pandoc :ensure t + :after org) +#+end_src + +Nicer LaTeX editing (AuCTeX): + +#+begin_src elisp + (leaf auctex :ensure t + :after org) +#+end_src + +We also ma(k|d)e use of org-tempo for templating things, which can be +nice. Should use the export based templating probably. Eventually. + +#+begin_src elisp + (leaf org-cfg + :after org + :require org-ref oc-csl org-tempo ox-latex ox-pandoc + :init + :bind + ("C-c ]" . org-ref-insert-link) + ("s-[" . org-ref-insert-link-hydra/body) + :hook + (org-mode-hook . auto-fill-mode) + :config + (set-fill-column 100) + (setq org-src-fontify-natively t + org-confirm-babel-evaluate nil + org-src-preserve-indentation t) + + (setq bibtex-completion-bibliography + (list (expand-file-name "~/Documents/Bibliography/references.bib"))) + + (setq org-ref-bibliography-notes "~/Documents/Bibliography/notes.org" + org-ref-default-bibliography '("~/Documents/Bibliography/references.bib") + org-ref-pdf-directory "~/Documents/Bibliography/bibtex-pdfs/") + + (setq org-ref-insert-link-function 'org-ref-insert-link-hydra/body + org-ref-insert-cite-function 'org-ref-cite-insert-helm + org-ref-insert-label-function 'org-ref-insert-label-link + org-ref-insert-ref-function 'org-ref-insert-ref-link + org-ref-cite-onclick-function (lambda (_) (org-ref-citation-hydra/body))) + (tempo-define-template + "Lab Template" '("#+TITLE: PHY324: LAB TITLE"n + "#+AUTHOR: ***REMOVED*** | ***REMOVED***"n + "#+DATE: \\today"n + "#+LATEX_HEADER: \\usepackage{natbib}"n + "#+LATEX_HEADER: \\usepackage{float}"n + "#+LATEX_CLASS: labtemplate"n + "#+OPTIONS: toc:nil"n + ""n + "* Abstract:"n + "* Introduction:"n > p + "* Methods:"n + "* Results:"n + "* Discussion:"n + "bibliographystyle:ieeetr"n + "bibliography:~/Documents/Bibliography/references.bib" >) + " n > + "#+NAME: fig:" (s name) > n > + "#+ATTR_LaTeX: :placement [H]" > n > + "[[" (s image) "]]" > n > p >) + "