From 04f3c3539bd9dea143f7b52abc8db166d64cdf58 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Wed, 25 Mar 2020 14:43:39 -0400 Subject: [PATCH] First step towards literate org mode --- emacs/.config/doom/+elfeed.el | 7 - emacs/.config/doom/+eshell.el | 14 - emacs/.config/doom/+mastodon.el | 9 - emacs/.config/doom/+mpd.el | 15 - emacs/.config/doom/+music.el | 14 - emacs/.config/doom/+nov.el | 36 --- emacs/.config/doom/+org-cal.el | 8 - emacs/.config/doom/+org-daypage.el | 156 ---------- emacs/.config/doom/+org.el | 111 -------- emacs/.config/doom/+ranger.el | 14 - emacs/.config/doom/+ui.el | 18 -- emacs/.config/doom/+wttrin.el | 9 - emacs/.config/doom/config.el | 179 ------------ emacs/.config/doom/config.org | 439 +++++++++++++++++++++++++++++ emacs/.config/doom/init.el | 2 +- 15 files changed, 440 insertions(+), 591 deletions(-) delete mode 100644 emacs/.config/doom/+elfeed.el delete mode 100644 emacs/.config/doom/+eshell.el delete mode 100644 emacs/.config/doom/+mastodon.el delete mode 100644 emacs/.config/doom/+mpd.el delete mode 100644 emacs/.config/doom/+music.el delete mode 100644 emacs/.config/doom/+nov.el delete mode 100644 emacs/.config/doom/+org-cal.el delete mode 100644 emacs/.config/doom/+org-daypage.el delete mode 100644 emacs/.config/doom/+org.el delete mode 100644 emacs/.config/doom/+ranger.el delete mode 100644 emacs/.config/doom/+ui.el delete mode 100644 emacs/.config/doom/+wttrin.el delete mode 100644 emacs/.config/doom/config.el create mode 100644 emacs/.config/doom/config.org diff --git a/emacs/.config/doom/+elfeed.el b/emacs/.config/doom/+elfeed.el deleted file mode 100644 index 72c5a06..0000000 --- a/emacs/.config/doom/+elfeed.el +++ /dev/null @@ -1,7 +0,0 @@ -;;; Elfeed -(run-with-timer 0 (* 30 60) 'elfeed-update) - -(setq httpd-host "0.0.0.0") -(setq httpd-port 10000) - -;(elfeed-web-start) diff --git a/emacs/.config/doom/+eshell.el b/emacs/.config/doom/+eshell.el deleted file mode 100644 index d5f933c..0000000 --- a/emacs/.config/doom/+eshell.el +++ /dev/null @@ -1,14 +0,0 @@ -;;; ~/.dotfiles/emacs/.config/doom/+eshell.el -*- lexical-binding: t; -*- - -(after! eshell - (set-eshell-alias! - "f" "(other-window 1) && find-file $1" - "l" "ls -lh" - "d" "dired $1" - "dc" "docker-compose $*" - "fftest" "cd ~/src/ff/fifteen5 && docker-compose exec app django-admin test -k $*" - "ffsh" "cd ~/src/ff/fifteen5/ && docker-compose exec app django-admin shell_plus" - "ffdj" "cd ~/src/ff/fifteen5/ && docker-compose exec app django-admin $*" - "gl" "(call-interactively 'magit-log-current)" - "gs" "magit-status" - "gc" "magit-commit")) diff --git a/emacs/.config/doom/+mastodon.el b/emacs/.config/doom/+mastodon.el deleted file mode 100644 index 0b6ac61..0000000 --- a/emacs/.config/doom/+mastodon.el +++ /dev/null @@ -1,9 +0,0 @@ -;;; ~/.dotfiles/emacs/.config/doom/+mastodon.el -*- lexical-binding: t; -*- - -(setq mastodon-instance-url "https://mastodon.technology") - -(map! :leader - (:prefix "=" - :desc "Open mastodon" "=" #'mastodon - :desc "Update Mastodon timeline" "u" #'mastodon-tl--update - :desc "Toot to Mastodon" "t" #'mastodon-toot)) diff --git a/emacs/.config/doom/+mpd.el b/emacs/.config/doom/+mpd.el deleted file mode 100644 index ee0ffc6..0000000 --- a/emacs/.config/doom/+mpd.el +++ /dev/null @@ -1,15 +0,0 @@ -;;; ~/.dotfiles/emacs/.config/doom/+mpd.el -*- lexical-binding: t; -*- -(defun mpdel-playlist-play () - "Start playing the song at point." - (interactive) - (if (derived-mode-p 'mpdel-playlist-current-playlist-mode) - (libmpdel-play-song (navigel-entity-at-point)) - (mpdel-core-insert-current-playlist))) - -(map! :leader - (:prefix "-" - :desc "MPD Open playlist" "-" #'mpdel-playlist-open - :desc "MPD Remove at point" "d" #'mpdel-playlist-delete - :desc "MPD Start at point" "s" #'mpdel-playlist-play - :desc "MPD Next track" "n" #'libmpdel-playback-next - :desc "MPD Previous track" "p" #'libmpdel-playback-previous)) diff --git a/emacs/.config/doom/+music.el b/emacs/.config/doom/+music.el deleted file mode 100644 index 62d63ba..0000000 --- a/emacs/.config/doom/+music.el +++ /dev/null @@ -1,14 +0,0 @@ -;;; -*- lexical-binding: t; -*- -;;; - -(defvar counsel-spotify-client-id "515f0ff545a349bcadf98efab945972f") -(defvar counsel-spotify-client-secret "7618bf445df14b568782b13e37cf63e6") - -(map! - (:leader - (:desc "applications" :prefix "a" - (:desc "music" :prefix "m" - :desc "Play/Pause Music" "m" #'counsel-spotify-toggle-play-pause - :desc "Next song" "n" #'counsel-spotify-plus-next - :desc "Search songs" "s" #'counsel-spotify-search-track - :desc "Search albums" "a" #'counsel-spotify-search-album)))) diff --git a/emacs/.config/doom/+nov.el b/emacs/.config/doom/+nov.el deleted file mode 100644 index ac7af9f..0000000 --- a/emacs/.config/doom/+nov.el +++ /dev/null @@ -1,36 +0,0 @@ -;;; ~/.dotfiles/emacs/.config/doom/+nov.el -*- lexical-binding: t; -*- -(require 'justify-kp) -;(setq nov-text-width t) -(setq nov-text-width 80) - -(defun my-nov-window-configuration-change-hook () - (my-nov-post-html-render-hook) - (remove-hook 'window-configuration-change-hook - 'my-nov-window-configuration-change-hook - t)) - -(defun my-nov-post-html-render-hook () - (if (get-buffer-window) - (let ((max-width (pj-line-width)) - buffer-read-only) - (save-excursion - (goto-char (point-min)) - (while (not (eobp)) - (when (not (looking-at "^[[:space:]]*$")) - (goto-char (line-end-position)) - (when (> (shr-pixel-column) max-width) - (goto-char (line-beginning-position)) - (pj-justify))) - (forward-line 1)))) - (add-hook 'window-configuration-change-hook - 'my-nov-window-configuration-change-hook - nil t))) - -(add-hook 'nov-post-html-render-hook 'my-nov-post-html-render-hook) -(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)) - -(defun my-nov-font-setup () - (face-remap-add-relative 'variable-pitch :family "Liberation Serif" - :size 20 - :height 1.0)) -(add-hook 'nov-mode-hook 'my-nov-font-setup) diff --git a/emacs/.config/doom/+org-cal.el b/emacs/.config/doom/+org-cal.el deleted file mode 100644 index 8fb3be4..0000000 --- a/emacs/.config/doom/+org-cal.el +++ /dev/null @@ -1,8 +0,0 @@ -;;; ~/.dotfiles/emacs/.config/doom/org-caldav.el -*- lexical-binding: t; -*- - -;; org-caldav -(setq org-caldav-url "https://box.onec.me/cloud/remote.php/dav/calendars/colin@onec.me" - org-caldav-calendar-id "personal" - org-icalendar-timezone "America/New_York" - org-caldav-debug-level 2 - org-caldav-inbox "~/org/cal.org") diff --git a/emacs/.config/doom/+org-daypage.el b/emacs/.config/doom/+org-daypage.el deleted file mode 100644 index fbc8cee..0000000 --- a/emacs/.config/doom/+org-daypage.el +++ /dev/null @@ -1,156 +0,0 @@ -;;; org-daypage.el --- Org-Mode Day Page. -;; -;; Copyright (C) 2010-2011 Thomas Parslow -;; -;; Author: Thomas Parslow -;; Created: June, 2010 -;; Version: 1 -;; Keywords: orgmode, daypage - -;;; License -;; -;; This program is free software: you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation, either version 3 of the License, or -;; (at your option) any later version. -;; -;; This program is distributed in he hope that it will be useful, -;; but WITHOUT ANY WARRANTY; without even the implied warranty of -;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;; GNU General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program. If not, see . -;; - -;;; Installation -;; -;; Add org-daypage.el to your load path and add (require 'org-daypage) -;; to your .emacs. - -;;; Configuration: -;; -;; No keys are defined by default. So you may wish to add something -;; like the following to your .emacs as well: -;; -;; (define-key daypage-mode-map (kbd "") 'daypage-prev) -;; (define-key daypage-mode-map (kbd "") 'daypage-next) -;; (define-key daypage-mode-map (kbd "") 'daypage-prev-week) -;; (define-key daypage-mode-map (kbd "") 'daypage-next-week) -;; (define-key daypage-mode-map "\C-c." 'daypage-time-stamp) -;; -;; (global-set-key [f11] 'todays-daypage) -;; (global-set-key [f10] 'yesterdays-daypage) -;; (global-set-key "\C-con" 'todays-daypage) -;; (global-set-key "\C-coN" 'find-daypage) - -(eval-when-compile (require 'cl)) - -(setq daypage-path "~/notes/days/") - -(defvar daypage-mode-map - (let ((map (make-sparse-keymap))) - map) - "The key map for daypage buffers.") - -(defun find-daypage (&optional date) - "Go to the day page for the specified date, or todays if none is specified." - (interactive (list - (org-read-date "" 'totime nil nil - (current-time) ""))) - (setq date (or date (current-time))) - (find-file (expand-file-name (concat daypage-path (format-time-string "%Y-%m-%d" date) ".org")))) - -(defun daypage-p () - "Return true if the current buffer is visiting a daypage" - (if (daypage-date) - t - nil)) - -(defun daypage-date () - "Return the date for the daypage visited by the current buffer -or nil if the current buffer isn't visiting a dayage" - (let ((file (buffer-file-name)) - (root-path (expand-file-name daypage-path))) - (if (and file - (string= root-path (substring file 0 (length root-path))) - (string-match "\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\).org$" file)) - (flet ((d (i) (string-to-number (match-string i file)))) - (encode-time 0 0 0 (d 3) (d 2) (d 1))) - nil))) - - -(defun maybe-daypage () - "Set up daypage stuff if the org file being visited is in the daypage folder" - (let ((date (daypage-date))) - (when date - ; set up the daypage key map - (use-local-map daypage-mode-map) - (set-keymap-parent daypage-mode-map - org-mode-map) - (run-hooks 'daypage-hook)))) - -(add-hook 'org-mode-hook 'maybe-daypage) - -(defun daypage-next () - (interactive) - (find-daypage - (seconds-to-time (+ (time-to-seconds (daypage-date)) - 86400))) - (run-hooks 'daypage-movement-hook)) - -(defun daypage-prev () - (interactive) - (find-daypage - (seconds-to-time (- (time-to-seconds (daypage-date)) - 86400))) - (run-hooks 'daypage-movement-hook)) - -(defun daypage-next-week () - (interactive) - (find-daypage - (seconds-to-time (+ (time-to-seconds (daypage-date)) - (* 86400 7)))) - (run-hooks 'daypage-movement-hook)) - -(defun daypage-prev-week () - (interactive) - (find-daypage - (seconds-to-time (- (time-to-seconds (daypage-date)) - (* 86400 7)))) - (run-hooks 'daypage-movement-hook)) - -(defun todays-daypage () - "Go straight to todays day page without prompting for a date." - (interactive) - (find-daypage) - (run-hooks 'daypage-movement-hook)) - -(defun yesterdays-daypage () - "Go straight to todays day page without prompting for a date." - (interactive) - (find-daypage - (seconds-to-time (- (time-to-seconds (current-time)) - 86400))) - (run-hooks 'daypage-movement-hook)) - -(defun daypage-time-stamp () - "Works like (and is basically a thin wrapper round) -org-time-stamp except the default date will be the date of the daypage." - (interactive) - (unless (org-at-timestamp-p) - (insert "<" (format-time-string "%Y-%m-%d %a" (daypage-date)) ">") - (backward-char 1)) - (org-time-stamp nil)) - -(defun daypage-new-item () - "Switches to the current daypage and inserts a top level heading and a timestamp" - (interactive) - (todays-daypage) - (end-of-buffer) - (if (not (bolp)) - (insert "\n")) - (insert "* <" (format-time-string "%Y-%m-%d %a" (daypage-date)) "> ")) - - -(provide 'org-daypage) diff --git a/emacs/.config/doom/+org.el b/emacs/.config/doom/+org.el deleted file mode 100644 index 8e85b45..0000000 --- a/emacs/.config/doom/+org.el +++ /dev/null @@ -1,111 +0,0 @@ -;;; package --- summary +org.el -;;; lexical-binding: t; -*- - -;;; Commentary: -;;; Code: - -(after! org - (setq org-directory (expand-file-name "~/org/") - org-journal-dir "~/org/journal/" - org-agenda-files (list org-directory) - org-agenda-window-setup 'only-window - org-pretty-entities t - org-log-done 'time - ;org-contacts-files '("~/org/contacts.org") - ; attempt to return todo function to spacemacs - ;evil-org-key-theme '(textobjects navigation additional insert todo) - ;; show actually italicized text instead of /italicized text/ - ;org-agenda-block-separator "" - org-fontify-whole-heading-line t - org-fontify-done-headline t - org-fontify-quote-and-verse-blocks t - org-ellipsis "…" - org-capture-templates - '(("i" "Send to inbox" entry (file+headline "~/org/inbox.org" "Inbox") - "* TODO %?\n") - ("l" "Send to inbox with link" entry (file+headline "~/org/inbox.org" "Inbox") - "* TODO %?\n %i\n %a") - ("w" "Work diary entry" entry (file "~/org/work_diary.org") - "* %u\n%?\n") - ("u" "Add unblink entry" entry (file+headline "~/org/unblink.org" "Misc") - "* TITLE\n:PROPERTIES:\n:EXPORT_FILE_NAME: TITLE\n:EXPORT_DATE: %i\n:END:\n%?\n") - ("n" "Add an idea" entry (file "~/org/ideas.org") - "* %?\nEntered on %U\n")) - org-todo-keywords - '((sequence "TODO(t)" "NEXT(n)" "MAYBE(m)" "|" "DONE(d)" "WONTDO(w)")) - - org-todo-keyword-faces - '((("TODO" . (:foreground "red" :weight bold)) - ("NEXT" . (:foreground "blue")) - ("MAYBE" . (:foreground "sea green")) - ("WAITING" . (:foreground "forest green")) - ("WONTDO" . (:foreground "forest green")) - ("DONE" . (:foreground "light sea green")))) - org-agenda-span 5 - org-agenda-start-day "1d" - ;;org-use-tag-inheritance t; bug in variable below, just turn 'em off - org-tag-alist '(("@personal" . ?h) - ("@farm" . ?f) - ("@town" . ?s) - ("@errand" . ?e) - ("@15five" . ?w) - ("@family" . ?m)) - org-modules '(ol-eshell - ol-notmuch - ob-eval - ob-exp - ob-http - org-drill - org-id))) - -;; Refiling -(setq org-refile-targets '((nil :maxlevel . 9) - (org-agenda-files :maxlevel . 9))) -(setq org-outline-path-complete-in-steps nil) ; Refile in a single go -(setq org-refile-use-outline-path t) ; Show full paths for refiling - -;; org-set-tags-command -(setq +inbox-file "~/org/inbox.org") -(defun +open-inbox-file () - (interactive) - "Opens the inbox file" - (find-file +inbox-file)) - -(map! - :leader - :desc "Open inbox" "I" #'+open-inbox-file - :desc "Open today" "T" #'org-roam-today - :desc "Open tomorrow" "N" #'org-roam-tomorrow) - -(defun +show-agenda () - (interactive) - (delete-other-windows) - (with-popup-rules! nil - (org-agenda-list) - (calendar)) - (other-window 1) - (split-window-vertically) - (other-window 1) - (find-file +todo-file)) - - -(map! :leader - (:prefix "f" :desc "Save all org buffers" "a" #'org-save-all-org-buffers)) - -(use-package! org-roam - :commands (org-roam-insert org-roam-find-file org-roam) - :init - (setq org-roam-directory "~/org/") - (map! :leader - :prefix "n" - :desc "Org-Roam-Insert" "i" #'org-roam-insert - :desc "Org-Roam-Find" "/" #'org-roam-find-file - :desc "Org-Roam-Buffer" "r" #'org-roam) - :config - (org-roam-mode +1)) - -(with-eval-after-load 'org-roam - (with-eval-after-load 'company - (with-eval-after-load 'org - (require 'company-org-roam) - (company-org-roam-init)))) diff --git a/emacs/.config/doom/+ranger.el b/emacs/.config/doom/+ranger.el deleted file mode 100644 index 0ed83d3..0000000 --- a/emacs/.config/doom/+ranger.el +++ /dev/null @@ -1,14 +0,0 @@ -;;; -*- lexical-binding: t; -*- - -(def-package! ranger - :commands (ranger deer ranger-override-dired-fn) - :config - (set-popup-rule! "^\\*ranger" :ignore t)) - -(map! - (:leader - (:prefix "a" - :desc "Ranger" "r" #'ranger - :desc "Deer" "d" #'deer))) - -(add-hook! dired-mode #'ranger-override-dired-fn) ;; Override dired-mode so it uses deer diff --git a/emacs/.config/doom/+ui.el b/emacs/.config/doom/+ui.el deleted file mode 100644 index b97e6f6..0000000 --- a/emacs/.config/doom/+ui.el +++ /dev/null @@ -1,18 +0,0 @@ -;;; -*- lexical-binding: t; -*- - -(setq doom-theme 'kaolin-valley-dark) - -;; Fonts -(setq doom-font (font-spec :family "Go Mono" :size 12)) -(setq doom-big-font (font-spec :family "Go Mono" :size 18)) - -(set-frame-parameter nil 'internal-border-width 20) ; applies to the current frame -;; or -(add-to-list 'default-frame-alist '(internal-border-width . 20)) ; applies to all future frames - -;; setup transparency ... this might get annoying -(set-frame-parameter (selected-frame) 'alpha '(100 . 100)) -(add-to-list 'default-frame-alist '(alpha . (100 . 100))) - -;; Dash highlighting -(after! dash (dash-enable-font-lock)) diff --git a/emacs/.config/doom/+wttrin.el b/emacs/.config/doom/+wttrin.el deleted file mode 100644 index c47c991..0000000 --- a/emacs/.config/doom/+wttrin.el +++ /dev/null @@ -1,9 +0,0 @@ -;;; ~/.config/doom/+wttrin.el -*- lexical-binding: t; -*- - -(setq wttrin-default-cities '("Castine, ME" "San Francisco" "Thessaloniki")) -(setq wttrin-default-accept-language '("Accept-Language" . "en-US")) - -(map! - (:leader - (:prefix "o" - :desc "Weather" "w" #'wttrin))) diff --git a/emacs/.config/doom/config.el b/emacs/.config/doom/config.el deleted file mode 100644 index cf142db..0000000 --- a/emacs/.config/doom/config.el +++ /dev/null @@ -1,179 +0,0 @@ -;;; ~/.config/doom/config.el -*- lexical-binding: t; -*- - -;; (defvar xdg-data (getenv "XDG_DATA_HOME")) -;; (defvar xdg-bin (getenv "XDG_BIN_HOME")) -;; (defvar xdg-cache (getenv "XDG_CACHE_HOME")) -;; (defvar xdg-config (getenv "XDG_CONFIG_HOME")) - -(add-to-list 'default-frame-alist '(inhibit-double-buffering . t)) - -(setq user-full-name "Colin Powell" - user-mail-address "colin@unbl.ink") - -;; -;; Keybinds - -;;:m "M-j" '+hlissner:multi-next-line -;;:m "M-k" '+hlissner:multi-previous-line -(map! ;; Easier window movement - :n "C-h" 'evil-window-left - :n "C-j" 'evil-window-down - :n "C-k" 'evil-window-up - :n "C-l" 'evil-window-right - - (:map evil-treemacs-state-map - "C-h" 'evil-window-left - "C-l" 'evil-window-right) - - (:when IS-LINUX - "s-x" #'execute-extended-command - "s-;" #'eval-expression - ;; use super for window/frame navigation/manipulation - "s-w" #'delete-window - "s-W" #'delete-frame - "s-n" #'+default/new-buffer - "s-j" #'org-move-subtree-down - "s-k" #'org-move-subtree-up - "s-N" #'make-frame - "s-q" (if (daemonp) #'delete-frame #'evil-quit-all) - ;; Restore OS undo, save, copy, & paste keys (without cua-mode, because - ;; it imposes some other functionality and overhead we don't need) - "s-z" #'undo - "s-c" (if (featurep 'evil) #'evil-yank #'copy-region-as-kill) - "s-v" #'yank - "s-s" #'save-buffer - ;; Buffer-local font scaling - "s-+" (λ! (text-scale-set 0)) - "s-=" #'text-scale-increase - "s--" #'text-scale-decrease - ;; Conventional text-editing keys - "s-a" #'mark-whole-buffer - :gi [s-return] #'+default/newline-below - :gi [s-S-return] #'+default/newline-above - :gi [s-backspace] #'doom/backward-kill-to-bol-and-indent) - - :leader - (:prefix "f" - :desc "Find file in dotfiles" "t" #'+hlissner/find-in-dotfiles - :desc "Browse dotfiles" "T" #'+hlissner/browse-dotfiles) - (:prefix "t" - :desc "Switch themes" "t" #'load-theme) - (:prefix "o" - :desc "Elfeed feed reader" "f" #'elfeed - :desc "Hckrnews" "h" #'hackernews - :desc "Lobste.rs" "l" #'ivy-lobsters) - (:prefix "b" - :desc "Black format buffer" "f" #'blacken-buffer - :desc "isort buffer" "I" #'py-isort-buffer - :desc "Links in buffer" "l" #'ace-link-org) - (:prefix "s" - :desc "Search project TODOs" "t" #'+ivy/tasks - :desc "Search the web" "w" #'web-search - :desc "Goto URL in eww" "u" #'eww-browse-url - :desc "Search in eww" "3" #'eww-search-words - :desc "Search all the things" "g" #'deadgrep)) - -;; app/search -(after! web-search - (push '("Searx" "http://search.unbl.ink/?q=%s") - web-search-providers) - (setq web-search-default-provider "Searx")) - -(def-package! org-alert - :commands (org-alert-enable)) - -(after! org-alert-mode - (setq alert-default-style 'libnotify)) - -;; enable smog writing analysis -;;(use-package smog -;; :config (setq smog-command "style -L en")) - -;; -;; Modules - -(setq +workspaces-switch-project-function #'ignore - +format-on-save-enabled-modes '(python-mode) - +pretty-code-enabled-modes '(emacs-lisp-mode org-mode)) - -;; app/eglot -;; Back to eglot ... -(add-hook 'foo-mode-hook 'eglot-ensure) - -;; app/mpdel -;; -(setq libmpdel-hostname "phoebe.local") - -;; app/rss -(add-hook! 'elfeed-show-mode-hook (text-scale-set 1.5)) - -(setq rmh-elfeed-org-files (list "~/org/elfeed.org") - elfeed-search-filter "@1-week-ago +unread ") - -(add-hook 'prog-mode-hook #'goto-address-mode) ;; Linkify links! - -;; tools/deft -(setq deft-extensions '("org")) -(setq deft-directory "~/org") - -;; tools/magit -(setq magit-repository-directories '(("~/work" . 2)) - magit-save-repository-buffers nil) - - -;;; It is the opposite of fill-paragraph -(defun unfill-paragraph () - "Takes a multi-line paragraph and makes it into a single line of text." - (interactive) - (let ((fill-column (point-max))) - (fill-paragraph nil))) - -;; Handy key definition -(define-key global-map "\M-z" 'unfill-paragraph) - -; A few nice to haves -(nyan-mode) ; a rainbow cat, why not -(beacon-mode) ; show me where my cursor is bouncing around to -(add-hook 'after-init-hook #'global-emojify-mode) ; emoji, sigh -(add-to-list 'auto-mode-alist '("\\.plantuml\\'" . planetuml-mode)) - -(load! "+ui.el") -(load! "+org") ;; Org mode stuff like todos and rebindings -(load! "+org-cal") -(load! "+nov") ;; nov.el epub mode settings -(load! "+mail") ;; Mail stuff -(load! "+eshell") -(load! "+mpd") -(load! "+ranger") -(load! "+mastodon") -(load! "+wttrin") ;; Weather config -(load! "+elfeed") ;; This runs a background web process ... - -;; findout timezone location strings at http://worldtime.io -(setq display-time-world-list '(("America/Los_Angeles" "San Francisco") - ("America/Tegucigalpa" "Tegucigalpa") - ("America/New_York" "New York") - ("Europe/London" "London") - ("Europe/Warsaw" "Warsaw") - ("Europe/Kiev" "Lviv"))) - -(load! "beancount") -(require 'beancount) -(add-to-list 'auto-mode-alist '("\\.beancount\\'" . beancount-mode)) - -(define-derived-mode - pandoc-view-mode - markdown-mode - "pandoc-view-mode" - "View pandoc processing of docx file using markdown mode." - (erase-buffer) - (let* ((pandoc (executable-find "pandoc"))) - (insert (shell-command-to-string - (concat pandoc " --wrap=none " (shell-quote-argument (buffer-file-name)) " -t markdown")))) - (not-modified) - (read-only-mode t)) - -(add-to-list 'auto-mode-alist '("\\.docx\\'" . pandoc-view-mode)) - -(remove-hook 'text-mode-hook #'auto-fill-mode) -(add-hook 'message-mode-hook #'word-wrap-mode) diff --git a/emacs/.config/doom/config.org b/emacs/.config/doom/config.org new file mode 100644 index 0000000..100cb62 --- /dev/null +++ b/emacs/.config/doom/config.org @@ -0,0 +1,439 @@ +#+TITLE: DOOM Emacs Configuration + +This configuration of Emacs is highly opinionated. + +* Basics +I don't actually know what this does ... :thinking: +#+BEGIN_SRC emacs-lisp +(add-to-list 'default-frame-alist '(inhibit-double-buffering . t)) +#+END_SRC + +My identity. Used in a handful of places in Emacs to prepopulate authorship and such. +#+BEGIN_SRC emacs-lisp +(setq user-full-name "Colin Powell" + user-mail-address "colin@unbl.ink") +#+END_SRC + +** TODO Figure out what `inhibit-double-buffering` does in Emacs +* User interface +** Fonts and themes +I change my default theme almost as often as the weather. I tend to revert back +to Doom One most of the time, but I like the Kaolin themes, as well as Nimbus +for it's retro charm. Nimbus just doesn't look great when I'm tired though. + +I love [[https://blog.golang.org/go-fonts][Go Mono]]. But sometimes Emacs is sensitive to fonts and performance +suffers, so we have Fira Mono to fall back on. + +#+BEGIN_SRC emacs-lisp +;;(setq doom-font (font-spec :family "Fira Mono" :size 12)) +(setq doom-font (font-spec :family "Go Mono" :size 12)) +(setq doom-big-font (font-spec :family "Go Mono" :size 18)) + +(setq doom-theme 'doom-one) +#+END_SRC + +** Borders +Barring the unfortunate end of X11 development and my eventual transition to +wayland and sway, you can pry i3wm from my cold, dead hands. One problem, +however is that when you're trying your best to rice up i3, Emacs needs a padded +border. + +#+BEGIN_SRC emacs-lisp +;; Applies to current frame +(set-frame-parameter nil 'internal-border-width 20) ; applies to the current frame +;; If we create new frames (via emacsclient) this will do the trick +(add-to-list 'default-frame-alist '(internal-border-width . 20)) +;; Dash highlighting +(after! dash (dash-enable-font-lock)) +#+END_SRC +** Dash +I need to figure out what this doesr, hence the task below. +#+BEGIN_SRC emacs-lisp +;; Dash highlighting +(after! dash (dash-enable-font-lock)) +#+END_SRC +*** TODO Figure out what dash highlighting is all about +* Keybindings +#+BEGIN_SRC emacs-lisp +(map! ;; Easier window movement + :n "C-h" 'evil-window-left + :n "C-j" 'evil-window-down + :n "C-k" 'evil-window-up + :n "C-l" 'evil-window-right + + (:map evil-treemacs-state-map + "C-h" 'evil-window-left + "C-l" 'evil-window-right) + + :leader + (:prefix "f" + :desc "Find file in dotfiles" "t" #'+hlissner/find-in-dotfiles + :desc "Browse dotfiles" "T" #'+hlissner/browse-dotfiles) + (:prefix "t" + :desc "Switch themes" "t" #'load-theme) + (:prefix "o" + :desc "Elfeed feed reader" "f" #'elfeed + :desc "Hckrnews" "h" #'hackernews + :desc "Lobste.rs" "l" #'ivy-lobsters) + (:prefix "b" + :desc "Black format buffer" "f" #'blacken-buffer + :desc "isort buffer" "I" #'py-isort-buffer + :desc "Links in buffer" "l" #'ace-link-org) + (:prefix "s" + :desc "Search project TODOs" "t" #'+ivy/tasks + :desc "Search the web" "w" #'web-search + :desc "Goto URL in eww" "u" #'eww-browse-url + :desc "Search in eww" "3" #'eww-search-words + :desc "Search all the things" "g" #'deadgrep)) + +#+END_SRC +* Weather +Wttrin is a pretty funny way to check weather. I like that you can copy and +paste fun a ASCII representations of the day's weather. It's not terribly +accurate though. + +#+BEGIN_SRC emacs-lisp +(setq wttrin-default-cities '("Castine, ME" "San Francisco" "Thessaloniki")) +(setq wttrin-default-accept-language '("Accept-Language" . "en-US")) + +(map! + (:leader + (:prefix "o" + :desc "Weather" "w" #'wttrin))) +#+END_SRC +* Search +#+BEGIN_SRC emacs-lisp +;; app/search +(after! web-search + (push '("Searx" "http://search.unbl.ink/?q=%s") + web-search-providers) + (setq web-search-default-provider "Searx")) +#+END_SRC +* Eglot +Eglot versus LSP? Until 27 lands stable, Eglot wins. I can actually read all +it's source. +#+BEGIN_SRC emacs-lisp +;; app/eglot +;; Back to eglot ... +(add-hook 'foo-mode-hook 'eglot-ensure) + +#+END_SRC +* Music +Right now, just make sure I can connect to my local Mopidy server via MPDel. + +#+BEGIN_SRC emacs-lisp +(setq libmpdel-hostname "mopidy.local") + +(defun mpdel-playlist-play () + "Start playing the song at point." + (interactive) + (if (derived-mode-p 'mpdel-playlist-current-playlist-mode) + (libmpdel-play-song (navigel-entity-at-point)) + (mpdel-core-insert-current-playlist))) + +(map! :leader + (:prefix "-" + :desc "MPD Open playlist" "-" #'mpdel-playlist-open + :desc "MPD Remove at point" "d" #'mpdel-playlist-delete + :desc "MPD Start at point" "s" #'mpdel-playlist-play + :desc "MPD Next track" "n" #'libmpdel-playback-next + :desc "MPD Previous track" "p" #'libmpdel-playback-previous)) +#+END_SRC +* RSS +#+BEGIN_SRC emacs-lisp +;; app/rss +(add-hook! 'elfeed-show-mode-hook (text-scale-set 1.5)) + +(setq rmh-elfeed-org-files (list "~/org/elfeed.org") + elfeed-search-filter "@1-week-ago +unread ") + +#+END_SRC +* Niceties +#+BEGIN_SRC emacs-lisp +(add-hook 'prog-mode-hook #'goto-address-mode) ;; Linkify links! + +;;; It is the opposite of fill-paragraph +(defun unfill-paragraph () + "Takes a multi-line paragraph and makes it into a single line of text." + (interactive) + (let ((fill-column (point-max))) + (fill-paragraph nil))) + +;; Handy key definition +(define-key global-map "\M-z" 'unfill-paragraph) +#+END_SRC + +Helpful modes to make working less painful. +#+BEGIN_SRC emacs-lisp +;; A rainbow cat, why not? +(nyan-mode) + +;; Show the cursor when we make jumps, I'm too old for this shit. +(beacon-mode) + +#+END_SRC + +#+BEGIN_SRC emacs-lisp +;; Emojis, fuck me. +(add-hook 'after-init-hook #'global-emojify-mode) + +;; PlantUML is awesome for quick diagrams +(add-to-list 'auto-mode-alist '("\\.plantuml\\'" . plantuml-mode)) + +;; Timezone location strings at http://worldtime.io +(setq display-time-world-list '(("America/Los_Angeles" "San Francisco") + ("America/Tegucigalpa" "Tegucigalpa") + ("America/New_York" "New York") + ("Europe/London" "London") + ("Europe/Warsaw" "Warsaw") + ("Europe/Kiev" "Lviv"))) + +#+END_SRC + +#+BEGIN_SRC emacs-lisp +(setq +workspaces-switch-project-function #'ignore + +format-on-save-enabled-modes '(python-mode) + +pretty-code-enabled-modes '(emacs-lisp-mode org-mode)) +#+END_SRC +* Org-mode +#+BEGIN_SRC emacs-lisp +;; tools/deft +(setq deft-extensions '("org")) +(setq deft-directory "~/org") + +(after! org + (setq org-directory (expand-file-name "~/org/") + org-journal-dir "~/org/journal/" + org-agenda-files (list org-directory) + org-agenda-window-setup 'only-window + org-pretty-entities t + org-log-done 'time + ;org-contacts-files '("~/org/contacts.org") + ; attempt to return todo function to spacemacs + ;evil-org-key-theme '(textobjects navigation additional insert todo) + ;; show actually italicized text instead of /italicized text/ + ;org-agenda-block-separator "" + org-fontify-whole-heading-line t + org-fontify-done-headline t + org-fontify-quote-and-verse-blocks t + org-ellipsis "…" + org-capture-templates + '(("i" "Send to inbox" entry (file+headline "~/org/inbox.org" "Inbox") + "* TODO %?\n") + ("l" "Send to inbox with link" entry (file+headline "~/org/inbox.org" "Inbox") + "* TODO %?\n %i\n %a") + ("w" "Work diary entry" entry (file "~/org/work_diary.org") + "* %u\n%?\n") + ("u" "Add unblink entry" entry (file+headline "~/org/unblink.org" "Misc") + "* TITLE\n:PROPERTIES:\n:EXPORT_FILE_NAME: TITLE\n:EXPORT_DATE: %i\n:END:\n%?\n") + ("n" "Add an idea" entry (file "~/org/ideas.org") + "* %?\nEntered on %U\n")) + org-todo-keywords + '((sequence "TODO(t)" "NEXT(n)" "MAYBE(m)" "|" "DONE(d)" "WONTDO(w)")) + + org-todo-keyword-faces + '((("TODO" . (:foreground "red" :weight bold)) + ("NEXT" . (:foreground "blue")) + ("MAYBE" . (:foreground "sea green")) + ("WAITING" . (:foreground "forest green")) + ("WONTDO" . (:foreground "forest green")) + ("DONE" . (:foreground "light sea green")))) + org-agenda-span 5 + org-agenda-start-day "1d" + ;;org-use-tag-inheritance t; bug in variable below, just turn 'em off + org-tag-alist '(("@personal" . ?h) + ("@farm" . ?f) + ("@town" . ?s) + ("@errand" . ?e) + ("@15five" . ?w) + ("@family" . ?m)) + org-modules '(ol-eshell + ol-notmuch + ob-eval + ob-exp + ob-http + org-drill + org-id))) + +;; Refiling +(setq org-refile-targets '((nil :maxlevel . 9) + (org-agenda-files :maxlevel . 9))) +(setq org-outline-path-complete-in-steps nil) ; Refile in a single go +(setq org-refile-use-outline-path t) ; Show full paths for refiling + +;; org-set-tags-command +(setq +inbox-file "~/org/inbox.org") +(defun +open-inbox-file () + (interactive) + "Opens the inbox file" + (find-file +inbox-file)) + +(map! + :leader + :desc "Open inbox" "I" #'+open-inbox-file + :desc "Open today" "T" #'org-roam-today + :desc "Open tomorrow" "N" #'org-roam-tomorrow) + +(defun +show-agenda () + (interactive) + (delete-other-windows) + (with-popup-rules! nil + (org-agenda-list) + (calendar)) + (other-window 1) + (split-window-vertically) + (other-window 1) + (find-file +todo-file)) + + +(map! :leader + (:prefix "f" :desc "Save all org buffers" "a" #'org-save-all-org-buffers)) + +(use-package! org-roam + :commands (org-roam-insert org-roam-find-file org-roam) + :init + (setq org-roam-directory "~/org/") + (map! :leader + :prefix "n" + :desc "Org-Roam-Insert" "i" #'org-roam-insert + :desc "Org-Roam-Find" "/" #'org-roam-find-file + :desc "Org-Roam-Buffer" "r" #'org-roam) + :config + (org-roam-mode +1)) + +(with-eval-after-load 'org-roam + (with-eval-after-load 'company + (with-eval-after-load 'org + (require 'company-org-roam) + (company-org-roam-init)))) +#+END_SRC + +* Nov.el +Reading novels in Emacs, how novel! + +#+BEGIN_SRC emacs-lisp +(require 'justify-kp) +;(setq nov-text-width t) +(setq nov-text-width 80) + +(defun my-nov-window-configuration-change-hook () + (my-nov-post-html-render-hook) + (remove-hook 'window-configuration-change-hook + 'my-nov-window-configuration-change-hook + t)) + +(defun my-nov-post-html-render-hook () + (if (get-buffer-window) + (let ((max-width (pj-line-width)) + buffer-read-only) + (save-excursion + (goto-char (point-min)) + (while (not (eobp)) + (when (not (looking-at "^[[:space:]]*$")) + (goto-char (line-end-position)) + (when (> (shr-pixel-column) max-width) + (goto-char (line-beginning-position)) + (pj-justify))) + (forward-line 1)))) + (add-hook 'window-configuration-change-hook + 'my-nov-window-configuration-change-hook + nil t))) + +(add-hook 'nov-post-html-render-hook 'my-nov-post-html-render-hook) +(add-to-list 'auto-mode-alist '("\\.epub\\'" . nov-mode)) + +(defun my-nov-font-setup () + (face-remap-add-relative 'variable-pitch :family "Liberation Serif" + :size 20 + :height 1.0)) +(add-hook 'nov-mode-hook 'my-nov-font-setup) +#+END_SRC + +* Mail +I use notmuch to read and write email from within Emacs. + +#+BEGIN_SRC emacs-lisp +;;(load! "+mail") ;; Mail stuff + +;; Use word wrap in text emails, because most people suck +(remove-hook 'text-mode-hook #'auto-fill-mode) +(add-hook 'message-mode-hook #'word-wrap-mode) +#+END_SRC + +* Eshell +Handful of fun aliases to make working in Eshell almost like a /real/ shell :smile: + +#+BEGIN_SRC emacs-lisp +(after! eshell + (set-eshell-alias! + "f" "(other-window 1) && find-file $1" + "l" "ls -lh" + "d" "dired $1" + "dc" "docker-compose $*" + "fftest" "cd ~/src/ff/fifteen5 && docker-compose exec app django-admin test -k $*" + "ffsh" "cd ~/src/ff/fifteen5/ && docker-compose exec app django-admin shell_plus" + "ffdj" "cd ~/src/ff/fifteen5/ && docker-compose exec app django-admin $*" + "gl" "(call-interactively 'magit-log-current)" + "gs" "magit-status" + "gc" "magit-commit")) +#+END_SRC +* Ranger +Trick out ranger a bit. + +#+BEGIN_SRC emacs-lisp +(def-package! ranger + :commands (ranger deer ranger-override-dired-fn) + :config + (set-popup-rule! "^\\*ranger" :ignore t)) + +(map! + (:leader + (:prefix "a" + :desc "Ranger" "r" #'ranger + :desc "Deer" "d" #'deer))) + +(add-hook! dired-mode #'ranger-override-dired-fn) ;; Override dired-mode so it uses deer +#+END_SRC +* Mastodon +There's gotta be a way to get the token out of password-store for this. + +#+BEGIN_SRC emacs-lisp +(setq mastodon-instance-url "https://mastodon.technology") + +(map! :leader + (:prefix "=" + :desc "Open mastodon" "=" #'mastodon + :desc "Update Mastodon timeline" "u" #'mastodon-tl--update + :desc "Toot to Mastodon" "t" #'mastodon-toot)) +#+END_SRC +* Elfeed +#+BEGIN_SRC emacs-lisp +(run-with-timer 0 (* 30 60) 'elfeed-update) + +(setq httpd-host "0.0.0.0") +(setq httpd-port 10000) +#+END_SRC +* Unprocessed +#+BEGIN_SRC emacs-lisp +(load! "beancount") +(require 'beancount) +(add-to-list 'auto-mode-alist '("\\.beancount\\'" . beancount-mode)) +#+END_SRC +* Pandoc +Here we are trying to auto-translate Word and PDF files to be viewed in Emacs. +#+BEGIN_SRC emacs-lisp +(define-derived-mode + pandoc-view-mode + markdown-mode + "pandoc-view-mode" + "View pandoc processing of docx file using markdown mode." + (erase-buffer) + (let* ((pandoc (executable-find "pandoc"))) + (insert (shell-command-to-string + (concat pandoc " --wrap=none " (shell-quote-argument (buffer-file-name)) " -t markdown")))) + (not-modified) + (read-only-mode t)) + +(add-to-list 'auto-mode-alist '("\\.docx\\'" . pandoc-view-mode)) + +#+END_SRC diff --git a/emacs/.config/doom/init.el b/emacs/.config/doom/init.el index 265a61c..46d9cca 100644 --- a/emacs/.config/doom/init.el +++ b/emacs/.config/doom/init.el @@ -172,7 +172,7 @@ :config ;; For literate config users. This will tangle+compile a config.org ;; literate config in your `doom-private-dir' whenever it changes. - ;;literate + literate ;; The default module sets reasonable defaults for Emacs. It also ;; provides a Spacemacs-inspired keybinding scheme and a smartparens