aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Wilkie <antigravityd@gmail.com>2022-09-26 04:49:45 +0000
committerGitHub <noreply@github.com>2022-09-26 04:49:45 +0000
commitf8235066d3571d7af1dc7ca410eb489fdb25c774 (patch)
treedf911cbe17f8735ebb352d45d71c1711dcaf437f
parent391ca1c3291e1c4fdc4ee9f5b1cc58a87b1a4588 (diff)
Update init.el
-rw-r--r--init.el415
1 files changed, 348 insertions, 67 deletions
diff --git a/init.el b/init.el
index afbc120..a971a1e 100644
--- a/init.el
+++ b/init.el
@@ -9,12 +9,23 @@
(add-hook 'emacs-startup-hook #'dnw/display-startup-time)
+(server-start)
+
(global-set-key (kbd "C->") 'indent-rigidly-right-to-tab-stop)
(global-set-key (kbd "C-<") 'indent-rigidly-left-to-tab-stop)
(setq tab-always-indent 'complete)
+(setq align-to-tab-stop nil)
+
+;; default-frame-alist works with --daemon
+
+(add-to-list 'default-frame-alist
+ '(font . "Iosevka-10"))
-(setq inhibit-startup-message t)
+(setf use-default-font-for-symbols nil)
+(set-fontset-font t 'unicode "Noto Emoji" nil 'append)
+
+(setq inhibit-startup-message t)
(menu-bar-mode -1)
(tool-bar-mode -1)
@@ -22,58 +33,46 @@
(tooltip-mode -1)
(set-fringe-mode 10)
-(set-face-attribute 'default nil :font "Liberation Mono")
-(set-fontset-font "fontset-default" nil
- (font-spec :name "Noto"))
-(set-fontset-font "fontset-default" nil
- (font-spec :name "Font Awesome"))
-
(column-number-mode)
(global-display-line-numbers-mode t)
;; Disable in e.g. shell
(dolist (mode '(org-mode-hook
term-mode-hook
- eshell-mode-hook))
+ eshell-mode-hook
+ Info-mode-hook
+ ement-room-mode-hook
+ elfeed-show-mode-hook
+ pdf-mode-hook))
(add-hook mode (lambda () (display-line-numbers-mode 0))))
-(set-frame-parameter (selected-frame) 'alpha '(85 85))
+(set-frame-parameter (selected-frame) 'alpha '(100 100))
-(add-to-list 'default-frame-alist '(alpha 85 85))
+(add-to-list 'default-frame-alist '(alpha 100 100))
(require 'package)
- (setq package-archives '(("melpa" . "https://melpa.org/packages/")
- ("org" . "https://orgmode.org/elpa/")
- ("elpa" . "https://elpa.gnu.org/packages/")))
+(setq package-archives '(("melpa" . "https://melpa.org/packages/")
+ ("elpa" . "https://elpa.gnu.org/packages/")))
- (package-initialize)
- (unless package-archive-contents
- (package-refresh-contents))
+(package-initialize)
+(unless package-archive-contents
+ (package-refresh-contents))
- (eval-when-compile
- (require 'use-package))
+(eval-when-compile
+ (require 'use-package))
- (setq use-package-always-ensure t)
+(setq use-package-always-ensure t)
- (add-to-list 'load-path "/home/dnw/Code/PHYTS/phits-mode")
- (require 'phits-mode)
+(add-to-list 'load-path "/home/dnw/Code/PHYTS/phits-mode")
+(require 'phits-mode)
- (add-to-list 'auto-mode-alist '("\\.inp\\'" . phits-mode))
-;; (add-to-list 'auto-mode-alist '("\\.out\\'" . phits-mode))
-
-(use-package auto-package-update
- :custom
- (auto-package-update-interval 7)
- (auto-package-update-prompt-before-update t)
- (auto-package-update-hide-results t)
- :config
- (auto-package-update-maybe)
- (auto-package-update-at-time "12:00"))
+(add-to-list 'auto-mode-alist '("\\.inp\\'" . phits-mode))
+(add-to-list 'auto-mode-alist '("\\.out\\'" . phits-mode))
(use-package exec-path-from-shell
:init
- (setq exec-path-from-shell-variables '("PATH" "MANPATH" "PHITSPATH"))
+ (setq exec-path-from-shell-variables '("PATH" "MANPATH" "GUIX_PROFILE" "PHITSPATH"))
(when (memq window-system '(mac ns x))
(exec-path-from-shell-initialize)))
@@ -88,7 +87,7 @@
(use-package corfu
:custom (corfu-cycle t)
- :init (corfu-global-mode))
+ :init (global-corfu-mode))
;; (use-package kind-icon
;; :ensure t
@@ -121,13 +120,87 @@
:bind (("M-/" . dabbrev-completion)
("C-M-/" . dabbrev-expand)))
+(defun dnw/prompt-date ()
+ (let ((date (read-string "Due date: "))
+ (now (split-string (format-time-string "%e %B %Y" (current-time)))))
+ (cond ((equal date "")
+ (concat now))
+ ((equal (substring date 0 1) "+")
+ (concat (number-to-string (+ (string-to-number (car now))
+ (string-to-number (substring date 1))))
+ " "
+ (cadr now)
+ " "
+ (caddr now)))
+ ((= (length date) 2)
+ (concat date
+ " "
+ (cadr now)
+ " "
+ (caddr now))))))
+
+(setq dnw/autoinsert-latex-presets
+ '(("Physics" . (nil "\\documentclass{article}\n\n"
+
+ "\\usepackage[letterpaper]{geometry}\n"
+ "\\usepackage{tgpagella}\n"
+ "\\usepackage{amsmath}\n"
+ "\\usepackage{siunitx}\n\n"
+
+
+ "\\title{" (read-string "Title: ") "}\n"
+ "\\author{Duncan Wilkie}\n"
+ "\\date{" (dnw/prompt-date) "}\n\n"
+
+ "\\begin{document}\n\n"
+
+ "\\maketitle\n\n"
+
+ -
+
+ "\n\n\\end{document}"))
+ ("Math" . (nil "\\documentclass{article}\n\n"
+
+ "\\usepackage[letterpaper]{geometry}\n"
+ "\\usepackage{tgpagella}\n"
+ "\\usepackage{amsmath}\n"
+ "\\usepackage{amssymb}\n"
+ "\\usepackage{amsthm}\n\n"
+
+ "\\title{" (read-string "Title: ") "}\n"
+ "\\author{Duncan Wilkie}\n"
+ "\\date{" (dnw/prompt-date) "}\n\n"
+
+ "\\begin{document}\n\n"
+
+ "\\maketitle\n\n"
+
+ -
+
+ "\n\n\\end{document}"))
+ ("Default" . ("options, RET: " "\\documentclass[" str & 93 | -1 123
+ (read-string "class: ")
+ "}\n"
+ ("package, %s: " "\\usepackage["
+ (read-string "options, RET: ")
+ & 93 | -1 123 str "}\n")
+ _ "\n\\begin{document}\n"
+ _ "\n\\end{document}"))))
+
(use-package autoinsert
:hook (find-file . auto-insert)
- :config
+ :init
(setq auto-insert t)
(setq auto-insert-query nil)
- (auto-insert-mode 1)
- (setq auto-insert-directory "~/emacs.d/insert/"))
+ (auto-insert-mode t)
+ :config
+ (assoc-delete-all 'latex-mode auto-insert-alist)
+ (define-auto-insert 'latex-mode
+ (lambda ()
+ (let* ((presets (mapcar (lambda (pair)(car pair))
+ dnw/autoinsert-latex-presets))
+ (choice (completing-read "Preset:" presets)))
+ (skeleton-insert (assoc choice dnw/autoinsert-latex-presets))))))
(use-package helpful
:commands (helpful-callable helpful-variable helpful-command helpful-key)
@@ -149,7 +222,7 @@
(use-package all-the-icons) ;; requires M-x all-the-icons-install-fonts on first load
(use-package doom-themes
- :init (load-theme 'doom-dark+ t))
+ :init (load-theme 'doom-tomorrow-night t))
(use-package rainbow-delimiters
:hook ((prog-mode . rainbow-delimiters-mode)
@@ -157,7 +230,8 @@
(use-package smartparens
:hook ((prog-mode . smartparens-mode)
- (LaTeX-mode . smartparens-mode))
+ (LaTeX-mode . smartparens-mode)
+ (org-mode . smartparens-mode))
:config
(require 'smartparens-latex))
@@ -187,29 +261,33 @@
(use-package org
:commands (org-capture org-agenda)
:hook (org-mode . dnw/org-mode-setup)
+ :bind ("C-c C-x C-l" . org-latex-preview)
:config
- (setq org-ellipsis " ▼"))
+ (setq org-ellipsis " ▼")
+ (setq org-latex-create-formula-image-program 'imagemagick))
(use-package org-bullets
- :after org
- :hook (org-mode . org-bullets-mode))
- (with-eval-after-load 'org-faces (dolist (face '((org-level-1 . 1.2)
- (org-level-2 . 1.1)
- (org-level-3 . 1.05)
- (org-level-4 . 1.0)
- (org-level-5 . 1.0)
- (org-level-6 . 1.0)
- (org-level-7 . 1.0)
- (org-level-8 . 1.0)))
- (set-face-attribute (car face) nil :font "Liberation Sans" :weight 'regular :height (cdr face)))
-
- (set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
- (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
- (set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch))
- (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
- (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
- (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
- (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch))
+ :after org
+ :hook (org-mode . org-bullets-mode))
+
+(with-eval-after-load 'org-faces (dolist (face '((org-level-1 . 1.2)
+ (org-level-2 . 1.1)
+ (org-level-3 . 1.05)
+ (org-level-4 . 1.0)
+ (org-level-5 . 1.0)
+ (org-level-6 . 1.0)
+ (org-level-7 . 1.0)
+ (org-level-8 . 1.0)))
+ (set-face-attribute (car face) nil :font "Liberation Sans" :weight 'regular :height (cdr face)))
+
+ (set-face-attribute 'fixed-pitch nil :font "Iosevka" :weight 'regular :height 1.0)
+ (set-face-attribute 'org-block nil :foreground nil :inherit 'fixed-pitch)
+ (set-face-attribute 'org-code nil :inherit '(shadow fixed-pitch))
+ (set-face-attribute 'org-table nil :inherit '(shadow fixed-pitch))
+ (set-face-attribute 'org-verbatim nil :inherit '(shadow fixed-pitch))
+ (set-face-attribute 'org-special-keyword nil :inherit '(font-lock-comment-face fixed-pitch))
+ (set-face-attribute 'org-meta-line nil :inherit '(font-lock-comment-face fixed-pitch))
+ (set-face-attribute 'org-checkbox nil :inherit 'fixed-pitch))
(setq org-hide-emphasis-markers t)
@@ -228,7 +306,7 @@
(use-package visual-fill-column
:hook (org-mode . dnw/org-mode-visual-fill))
-(with-eval-after-load 'org
+(with-eval-after-load 'org
(org-babel-do-load-languages
'org-babel-load-languages
'((emacs-lisp . t)
@@ -260,11 +338,30 @@
:custom
(org-roam-directory "/home/dnw/Roam")
(org-roam-completion-everywhere t)
+ (org-roam-db-node-include-function
+ (defun dnw/org-roam-include ()
+ (not (member "drill" (org-get-tags)))))
(org-roam-capture-templates
'(("d" "default" plain
"%?"
:if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n")
- :unnarowed t)))
+ :unnarowed t)
+ ("i" "idea" plain
+ "* Motivation\n\n%?\n\n* Similar Work\n\n* Feasibility\n\n* Implementation"
+ :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: Idea")
+ :unnarrowed t)
+ ("p" "project" plain
+ "* Description\n\n%?\n\n** Collaborators\n\n** Stack\n\n* Tasks"
+ :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: Project")
+ :unnarrowed t)
+ ("a" "article" plain
+ "* Summary\n\n%?\n\n* Context"
+ :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: Article")
+ :unnarrowed t)
+ ("m" "musing" plain
+ "* %?"
+ :if-new (file+head "%<%Y%m%d%H%M%S>-${slug}.org" "#+title: ${title}\n#+filetags: Musing")
+ :unnarrowed t)))
:bind (("C-c n l" . org-roam-buffer-toggle)
("C-c n f" . org-roam-node-find)
("C-c n i" . org-roam-node-insert)
@@ -273,6 +370,10 @@
:config
(org-roam-db-autosync-mode))
+(use-package org-drill)
+
+(use-package org-present)
+
(use-package dired
:ensure nil
:commands (dired dired-jump)
@@ -288,6 +389,7 @@
(use-package lsp-mode
:commands (lsp lsp-deferred)
:hook
+ ((c-mode) . lsp)
((LaTeX-mode) . lsp)
(lsp-completion-mode . dnw/lsp-completion)
:init
@@ -363,13 +465,22 @@
:config
(setq TeX-auto-save t)
(setq TeX-parse-self t)
- (setq-default TeX-master nil)
+ (setq-default TeX-master t)
+ (setq LaTeX-command "latex -shell-escape")
(add-hook 'LaTeX-mode-hook 'visual-line-mode)
(add-hook 'LaTeX-mode-hook 'flyspell-mode)
(add-hook 'LaTeX-mode-hook 'LaTeX-math-mode)
(add-hook 'LaTeX-mode-hook 'turn-on-reftex)
(setq reftex-plug-into-AUCTeX t)
- (setq TeX-view-program-selection '((output-pdf "Zathura"))))
+ (setq TeX-view-program-selection '((output-pdf "Zathura")))
+ (setq TeX-electric-sub-and-superscript t))
+
+;; Done from Guix
+(pdf-loader-install)
+;; (use-package pdf-tools
+;; :init
+;; (add-hook 'TeX-after-compilation-finished-functions #'TeX-revert-document-buffer)
+;; (pdf-loader-install))
(use-package term
:commands term
@@ -379,6 +490,120 @@
(use-package eterm-256color
:hook (term-mode . eterm-256color-mode))
+;; (use-package notmuch
+;; :config
+;; (setq mail-user-agent 'message-user-agent)
+;; (setq user-mail-address "antigravityd@gmail.com"
+;; user-full-name "Duncan Wilkie")
+;; (setq smtpmail-smtp-server "smtp.gmail.com"
+;; message-mail-send-function 'message-smtpmail-send-it)
+;; (setq smtpmail-debug-info t)
+;; (setq message-default-mail-headers "Cc: \nBcc: \n")
+;; (setq message-auto-save-directory "~/.mail/drafts")
+;; (setq message-kill-buffer-on-exit t)
+;; (setq message-directory "~/.mail/sent")
+;; (setq message-signature "-Duncan Wilkie"))
+
+;; (require 'mu4e)
+
+;; (setq mail-user-agent 'mu4e-user-agent)
+;; (setq mu4e-get-mail-command "mbsync -a")
+
+;; (setq user-full-name "Duncan Wilkie")
+;; (setq mu4e-compose-signature "-Duncan Wilkie")
+
+;; (setq message-kill-buffer-on-exit t)
+
+;; (require 'smtpmail)
+
+;; (setq message-send-mail-function 'smtpmail-send-it)
+
+;; ;;; Call the oauth2ms program to fetch the authentication token
+;; (defun fetch-access-token ()
+;; (with-temp-buffer
+;; (call-process "oauth2ms" nil t nil "--encode-xoauth2")
+;; (buffer-string)))
+
+;; ;;; Add new authentication method for xoauth2
+;; (cl-defmethod smtpmail-try-auth-method
+;; (process (_mech (eql xoauth2)) user password)
+;; (let* ((access-token (fetch-access-token)))
+;; (smtpmail-command-or-throw
+;; process
+;; (concat "AUTH XOAUTH2 " access-token)
+;; 235)))
+
+;; ;;; Register the method
+;; (with-eval-after-load 'smtpmail
+;; (add-to-list 'smtpmail-auth-supported 'xoauth2))
+
+;; (setq message-send-mail-function 'smtpmail-send-it
+;; smtpmail-default-smtp-server "smtp.example.com"
+;; smtpmail-smtp-server "smtp.example.com"
+;; smtpmail-stream-type 'starttls
+;; smtpmail-smtp-service 587)
+
+;; (setq mu4e-contexts
+;; `(,(make-mu4e-context
+;; :name "Personal Gmail"
+;; :enter-func (lambda () (mu4e-message "Switching to Personal Gmail..."))
+;; :match-func (lambda (msg)
+;; (when msg
+;; (string-match-p "/gmail-personal" (mu4e-message-field msg :maildir))))
+;; :vars '((user-mail-address . "antigravityd@gmail.com") ;; set up example Gmail config from manual
+;; (mu4e-drafts-folder . "/gmail-personal/[Gmail].Drafts")
+;; (mu4e-sent-folder . "/gmail-personal/[Gmail].Sent Mail")
+;; (mu4e-trash-folder . "/gmail-personal/[Gmail].Trash")
+;; (mu4e-sent-messages-behavior . delete)
+;; (assoc 'mu4e-maildir-shortcuts '((:maildir "/gmail-personal/Inbox" :key ?i)
+;; (:maildir "/gmail-personal/[Gmail].Sent Mail" :key ?s)
+;; (:maildir "/gmail-personal/[Gmail].Trash" :key ?t)
+;; (:maildir "/gmail-personal/[Gmail].All Mail" :key ?a)))
+;; (starttls-use-gnutls . t)
+;; (assoc smtpmail-starttls-credentials '(("smtp.gmail.com" 587 nil nil)))
+;; (assoc smtpmail-auth-credentials '(("smtp.gmail.com" 587 "antigravityd@gmail.com" nil)))
+;; (smtpmail-smtp-server . "smtp.gmail.com")
+;; (smtpmail-smtp-service . 587)))
+;; ,(make-mu4e-context
+;; :name "LSU"
+;; :enter-func (lambda () (mu4e-message "Switching to LSU email..."))
+;; :match-func (lambda (msg)
+;; (when msg
+;; (string-match-p "/lsu" (mu4e-message-field msg :maildir))))
+;; :vars '((user-mail-address . "dwilk14@lsu.edu")
+;; (smtpmail-smtp-server . "smtp-mail.outlook.com")
+;; (smtpmail-stream-type . starttls)
+;; (smtpmail-smtp-service . 587)))))
+ ;; `(make-mu4e-context
+ ;; :name "Professional Gmail"
+ ;; :enter-func (lambda () (mu4e-message "Switching to Professional Gmail..."))
+ ;; :match-func (lambda (msg)
+ ;; (when msg
+ ;; (string= (mu4e-message-field msg :maildir) "/gmail-professional")))
+ ;; :vars '((user-mail-address . "duncannwilkie@gmail.com")
+ ;; (user-full-name . "Duncan Wilkie")
+ ;; (mu4e-compose-signature . "-Duncan Wilkie")))
+ ;; `(make-mu4e-context
+ ;; :name "Lab"
+ ;; :enter-func (lambda () (mu4e-message "Switching to Lab email..."))
+ ;; :match-func (lambda (msg)
+ ;; (when msg
+ ;; (string= (mu4e-message-field msg :maildir) "/lab")))
+ ;; :vars '((user-mail-address . "duncan@spartanphysics.com")
+ ;; (user-full-name . "Duncan Wilkie")
+ ;; (mu4e-compose-signature . "-Duncan Wilkie")))
+
+(setq user-mail-address "antigravityd@gmail.com"
+ user-full-name "Duncan Wilkie")
+
+(setq gnus-select-method '(nnimap "gmail"
+ (nnimap-address "imap.gmail.com")
+ (nnimap-server-port "imaps")
+ (nnimap-stream ssl)))
+(setq smtpmail-smtp-server "smtp.gmail.com"
+ smtpmail-smtp-service 587
+ gnus-ignored-newsgroups "^to\\.\\|^[0-9. ]+\\( \\|$\\)\\|^[\"]\"[#'()]")
+
(setq
erc-nick "FlaminWalrus"
erc-user-full-name "Duncan W")
@@ -389,18 +614,43 @@
(erc-tls :server "irc.libera.chat"
:port "6697")))
+;; (package-install 'quelpa-use-package)
+;; (require 'quelpa-use-package)
+
+;; (use-package plz
+;; :quelpa (plz :fetcher github :repo "alphapapa/plz.el"))
+
+;; (use-package plz
+;; :quelpa (plz :fetcher github :repo "alphapapa/plz.el"))
+
+;; (use-package ement
+;; :quelpa (ement :fetcher github :repo "alphapapa/ement.el"))
+
+(defun dnw/elfeed-show-mode-visual-fill ()
+ (setq visual-fill-column-width 130
+ visual-fill-column-center-text t)
+ (visual-fill-column-mode 1))
+
+
(use-package elfeed
:hook elfeed
+ (elfeed-show-mode . dnw/elfeed-show-mode-visual-fill)
:config
(setq elfeed-db-directory (expand-file-name "elfeed" user-emacs-directory)
elfeed-show-entry-switch 'display-buffer)
+ (setq elfeed-feeds
+ '("http://feeds.aps.org/rss/allsuggestions.xml" ;; Physics
+ "http://feeds.aps.org/rss/recent/rmp.xml"
+
+ "https://lexi-lambda.github.io/feeds/all.rss.xml" ;; CS
+ "https://blog.functorial.com/feed.rss"
+
+ "https://www.ams.org/rss/jams.rss"
+ "https://jaireetschahal.substack.com/feed" ;; Math
+ "https://golem.ph.utexas.edu/category/atom10.xml"))
:bind
("C-x w" . elfeed ))
-(setq elfeed-feeds
- '("http://feeds.aps.org/rss/prdsuggestions.xml"
- ;;"http://feeds.aps.org/rss/recent/physics.xml"
- ))
;; doesn't function. It'd be really nice to configure this from this orgfile
;; (use-package elfeed-org
@@ -413,4 +663,35 @@
(use-package haskell-mode) ;; figure out how to defer loading until .hs is opened?
+;; TRAMP can't find necessary binaries on Guix machines without this after Emacs 28
+(add-to-list 'tramp-remote-path "/run/current-system/profile/bin")
+
+(setq Info-use-header-line nil)
+
+(setq markdown-command "pandoc")
+
+(use-package emms
+ :config
+ (emms-all)
+ :bind
+ ("<XF86AudioPlay>" . emms-start)
+ ("<XF86AudioPause>" . emms-pause)
+ ("<XF86AudioNext>" . emms-next)
+ ("<XF86AudioNext>" . emms-previous))
+
+(add-hook 'xhtml-mode-hook (lambda () (call-interactively 'shr-render-buffer)))
+
(setq gc-cons-threshold (* 2 1000 1000))
+(custom-set-variables
+ ;; custom-set-variables 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.
+ '(package-selected-packages
+ '(ytel-show ytel elfeed-tube bluetooth ws-butler which-key vertico telega smartparens rainbow-delimiters quelpa-use-package pdf-tools org-roam org-present org-drill org-bullets org-appear orderless no-littering marginalia magit-popup magit lsp-ui hydra helpful haskell-mode geiser-guile flycheck exec-path-from-shell eterm-256color emms ement elfeed edit-indirect doom-themes doom-modeline dired-single diminish corfu consult company ccls bui auto-package-update auctex all-the-icons-dired)))
+(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.
+ )