1 ;;; ellis.el --- Richard's custom-file -*- lexical-binding: t; -*- 5 ;; Author: Richard Westhaver <ellis@rwest.io> 7 ;; This program is free software; you can redistribute it and/or modify 8 ;; it under the terms of the GNU General Public License as published by 9 ;; the Free Software Foundation, either version 3 of the License, or 10 ;; (at your option) any later version. 12 ;; This program is distributed in the hope that it will be useful, 13 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of 14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 ;; GNU General Public License for more details. 17 ;; You should have received a copy of the GNU General Public License 18 ;; along with this program. If not, see <https://www.gnu.org/licenses/>. 22 ;; This is an example of what you may want to add to your custom 23 ;; config file. Feel free to rip. 32 (defalias 'make #'compile) 34 (setopt default-theme 'modus-vivendi-tritanopia 35 user-lab-directory (join-paths user-home-directory "dev") 36 company-source-directory (join-paths user-lab-directory "comp")) 38 (unless (display-graphic-p) (setq default-theme 'wheatgrass)) 40 (when (linux-p) (setq dired-listing-switches "-alsh")) 42 (defvar emacs-config-source (join-paths company-source-directory "core/emacs")) 45 (defun edit-emacs-config (&optional src) 46 (interactive (list current-prefix-arg)) 48 (expand-file-name "default.el" emacs-config-source) 52 (keymap-set user-map "e c" #'edit-emacs-config) 53 (keymap-set emacs-lisp-mode-map "C-c C-l" #'load-file) 54 (keymap-set emacs-lisp-mode-map "C-c M-k" #'elisp-byte-compile-file) 56 ;; (add-hook 'common-lisp-mode-hook #'enable-paredit-mode) 57 ;; (add-hook 'emacs-lisp-mode-hook #'enable-paredit-mode) 61 (defun remember-project () 63 (project-remember-project (project-current)) 66 (defun remember-lab-projects () 68 (project-remember-projects-under user-lab-directory t)) 70 (keymap-global-set "C-<tab>" #'hippie-expand) 71 (keymap-set minibuffer-local-map "C-<tab>" #'hippie-expand) 72 (keymap-set ctl-x-x-map "p p" #'remember-project) 73 (keymap-set ctl-x-x-map "p l" #'remember-lab-projects) 75 (add-hook 'prog-mode-hook #'skt-mode) 76 (add-hook 'org-mode-hook #'skt-mode) 77 (add-hook 'prog-mode-hook #'company-mode) 79 (add-hook 'notmuch-message-mode-hook #'turn-on-orgtbl) 81 (setopt skt-enable-tempo-elements t 83 skt-delete-duplicate-marks t) 85 (keymap-set skt-mode-map "C-c M-b" #'tempo-backward-mark) 86 (keymap-set skt-mode-map "C-c M-f" #'tempo-forward-mark) 87 (keymap-set skt-mode-map "C-c M-a" #'tempo-complete-tag) 89 (use-package markdown-mode :ensure t) 91 (use-package ol-notmuch :ensure t) 97 mail-user-agent 'message-user-agent 98 smtpmail-smtp-server "smtp.gmail.com" 99 message-send-mail-function 'message-smtpmail-send-it 100 smtpmail-debug-info t 101 message-default-mail-headers "Cc: \nBcc: \n" 102 message-kill-buffer-on-exit t 103 user-mail-address "ellis@rwest.io" 104 user-full-name "Richard Westhaver" 105 notmuch-hello-sections '(notmuch-hello-insert-saved-searches 106 notmuch-hello-insert-search 107 notmuch-hello-insert-recent-searches 108 notmuch-hello-insert-alltags) 109 notmuch-show-logo nil 110 notmuch-search-oldest-first nil 111 notmuch-hello-hide-tags '("kill") 112 notmuch-saved-searches '((:name "inbox" :query "tag:inbox" :key "i") 113 (:name "unread" :query "tag:unread" :key "u") 114 (:name "new" :query "tag:new" :key "n") 115 (:name "sent" :query "tag:sent" :key "e") 116 (:name "drafts" :query "tag:draft" :key "d") 117 (:name "all mail" :query "*" :key "a") 118 (:name "todo" :query "tag:todo" :key "t"))) 121 (defun notmuch-exec-offlineimap () 122 "execute offlineimap command and tag new mail with notmuch" 124 (start-process-shell-command "offlineimap" 127 (notmuch-refresh-all-buffers)) 129 (defun offlineimap-get-password (host port) 130 (let* ((netrc (netrc-parse (expand-file-name "~/.netrc.gpg"))) 131 (hostentry (netrc-machine netrc host port port))) 132 (when hostentry (netrc-get hostentry "password")))) 134 (defun mark-as-read () 135 "mark message as read." 137 (notmuch-search-tag '("-new" "-unread" "-inbox"))) 139 (defun mark-as-todo () 140 "mark message as todo." 143 (notmuch-search-tag '("-new" "-unread" "-inbox" "+todo"))) 145 (defun mark-as-spam () 146 "mark message as spam." 149 (notmuch-search-tag (list "+spam"))) 151 (keymap-set user-map "e m" #'notmuch) 152 (keymap-set user-map "e M" #'notmuch-exec-offlineimap) 153 (keymap-set notmuch-search-mode-map "S" #'mark-as-spam) 154 (keymap-set notmuch-search-mode-map "R" #'mark-as-read) 155 (keymap-set notmuch-search-mode-map "T" #'mark-as-todo)) 161 '(("http://threesixty360.wordpress.com/feed/" blog math) 162 ("http://www.50ply.com/atom.xml" blog dev) 163 ("http://blog.cryptographyengineering.com/feeds/posts/default" blog) 164 ("http://abstrusegoose.com/feed.xml" comic) 165 ("http://accidental-art.tumblr.com/rss" image math) 166 ("http://researchcenter.paloaltonetworks.com/unit42/feed/" security) 167 ("http://curiousprogrammer.wordpress.com/feed/" blog dev) 168 ("http://feeds.feedburner.com/amazingsuperpowers" comic) 169 ("http://amitp.blogspot.com/feeds/posts/default" blog dev) 170 ("http://pages.cs.wisc.edu/~psilord/blog/rssfeed.rss" blog) 171 ("http://www.anticscomic.com/?feed=rss2" comic) 172 ("http://feeds.feedburner.com/blogspot/TPQSS" blog dev) 173 ("http://techchrunch.com/feeds" tech news) 174 ("https://rss.nytimes.com/services/xml/rss/nyt/Technology.xml" tech news) 175 ("https://static.fsf.org/fsforg/rss/news.xml" tech news) 176 ("https://feeds.npr.org/1001/rss.xml" news) 177 ("https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=10000664" fin news) 178 ("https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=19854910" tech news) 179 ("https://search.cnbc.com/rs/search/combinedcms/view.xml?partnerId=wrss01&id=100003114" us news) 180 ("http://arxiv.org/rss/cs" cs rnd) 181 ("http://arxiv.org/rss/math" math rnd) 182 ("http://arxiv.org/rss/q-fin" q-fin rnd) 183 ("http://arxiv.org/rss/stat" stat rnd) 184 ("http://arxiv.org/rss/econ" econ rnd) 186 ("http://newartisans.com/rss.xml" dev blog) 188 ;; ("https://lab.rwest.io/comp.atom?feed_token=pHu9qwLkjy4CWJHx9rrJ" comp vc) 189 ("https://www.reddit.com/r/listentothis/.rss" music reddit) 190 ("https://www.ftc.gov/feeds/press-release-consumer-protection.xml" gov ftc) 191 ("https://api2.fcc.gov/edocs/public/api/v1/rss/" gov fcc) 194 (defun yt-dl-it (url) 195 "Downloads the URL in an async shell" 196 (let ((default-directory "~/media/yt")) 197 (async-shell-command (format "youtube-dl %s" url)))) 199 (defun elfeed-youtube-dl (&optional use-generic-p) 202 (let ((entries (elfeed-search-selected))) 203 (cl-loop for entry in entries 204 do (elfeed-untag entry 'unread) 205 when (elfeed-entry-link entry) 207 (mapc #'elfeed-search-update-entry entries) 208 (unless (use-region-p) (forward-line)))) 210 (keymap-set elfeed-search-mode-map "d" 'elfeed-youtube-dl) 211 (keymap-set user-map "e f" #'elfeed) 212 (keymap-set user-map "e F" #'elfeed-update)) 214 (use-package org-mime :ensure t) 216 (use-package sh-script 217 :hook (sh-mode . flymake-mode)) 223 (tempo-define-template 226 "#+AUTHOR: " user-full-name " <" user-mail-address ">" n>) 228 "Insert a readme.org file template.") 229 (tempo-define-template "org:src" 230 '("#+begin_src " p n> 234 (keymap-set user-map "t" #'org-todo) 236 ;; populate org-babel 237 (org-babel-do-load-languages 238 ;; TODO 2021-10-24: bqn, apl, k 239 'org-babel-load-languages '((shell . t) 253 (setq erc-format-nick-function 'erc-format-@nick) 258 (erc-tls :server "irc.libera.chat" :port 6697 259 :client-certificate '("/mnt/y/data/private/krypt/libera.pem")) 260 (setq erc-autojoin-channels-alist '(("irc.libera.chat" "#emacs") 261 ("irc.libera.chat" "#linux") 262 ("irc.libera.chat" "#rust") 263 ("irc.libera.chat" "#btrfs") 264 ("irc.libera.chat" "#lisp") 265 ("irc.libera.chat" "#sbcl") 266 ("irc.oftc.net" "#llvm")))) 269 (defun refresh-tags () 270 "Refresh TAGS database in `user-emacs-directory'." 272 (let ((default-directory user-emacs-directory)) 276 ~/dev/comp/org/*.el \\ 277 ~/dev/comp/core/emacs/*.el \\ 278 ~/dev/comp/core/emacs/lib/*.el \\ 281 (unless (string-equal "hyde" system-name) 282 (add-hook 'dired-mode-hook #'all-the-icons-dired-mode) 283 (add-hook 'ibuffer-mode-hook #'all-the-icons-ibuffer-mode)) 286 ;;; ellis.el ends here