Reorganize files to use stow for installation #dotfiles

This commit is contained in:
Colin Powell
2019-01-10 10:19:27 -05:00
parent cbbffe7f60
commit eaa394e556
123 changed files with 2227 additions and 131 deletions

482
emacs/.config/doom/+mail.el Normal file
View File

@ -0,0 +1,482 @@
;;; -*- lexical-binding: t; -*-
;;; Config is mostly from https://kkatsuyuki.github.io/notmuch-conf/ aadsa
;;; This is all modified from
;;; https://github.com/fuxialexander/doom-emacs-private-xfu/
;;;; Notmuch
(def-package! notmuch
:commands (notmuch
notmuch-tree
notmuch-tree-mode
notmuch-search
notmuch-search-mode
notmuch-hello
notmuch-hello-mode
notmuch-show
notmuch-show-mode
notmuch-message-mode)
:init
(map!
(:leader
(:prefix "o"
(:desc "APP: Email" "e" #'=mail))))
:config
(setq notmuch-fcc-dirs nil
notmuch-show-logo nil
notmuch-message-headers-visible nil
message-kill-buffer-on-exit t
message-send-mail-function 'message-send-mail-with-sendmail
notmuch-search-oldest-first nil
send-mail-function 'sendmail-send-it
;; sendmail-program "/usr/local/bin/msmtp"
notmuch-search-result-format '(("date" . "%12s ")
("count" . "%-7s ")
("authors" . "%-30s ")
("subject" . "%-100s ")
("tags" . "(%s)"))
notmuch-tag-formats '(("unread"
(propertize tag 'face 'notmuch-tag-unread)))
notmuch-hello-sections '(notmuch-hello-insert-saved-searches
notmuch-hello-insert-alltags)
notmuch-saved-searches '(
(:name "inbox" :query "tag:inbox not tag:trash" :key "i")
(:name "sent" :query "tag:sent" :key "s")
(:name "archived":query "tag:archived" :key "a")
(:name "drafts" :query "tag:draft" :key "d"))
notmuch-archive-tags '("-inbox" "-unread" "+archived"))
(set-evil-initial-state! '(notmuch-hello-mode
notmuch-show-mode
notmuch-search-mode
notmuch-tree-mode
notmuch-message-mode) 'normal)
;; (add-hook 'notmuch-tree-mode-hook '+mail/buffer-face-mode-notmuch)
;; (add-hook 'notmuch-search-mode-hook '+mail/buffer-face-mode-notmuch)
;; (add-hook 'notmuch-message-mode-hook '+mail/buffer-face-mode-notmuch)
(add-hook 'notmuch-message-mode-hook (lambda () (set (make-local-variable 'company-backends) '(notmuch-company (company-ispell :with company-yasnippet)))))
(add-hook 'notmuch-tree-mode-hook (lambda () (setq-local line-spacing nil)))
(remove-hook 'message-mode-hook #'turn-on-auto-fill)
(remove-hook 'notmuch-message-mode-hook #'turn-on-auto-fill)
(push 'notmuch-tree-mode evil-snipe-disabled-modes)
(push 'notmuch-hello-mode evil-snipe-disabled-modes)
(push 'notmuch-search-mode evil-snipe-disabled-modes)
(push 'notmuch-show-mode evil-snipe-disabled-modes)
(advice-add #'notmuch-start-notmuch-sentinel :override #'+mail/notmuch-start-notmuch-sentinel)
(advice-add #'notmuch-show :override #'+mail/notmuch-show-reuse-buffer)
(advice-add #'notmuch-hello-insert-searches :override #'+mail/notmuch-hello-insert-searches)
(advice-add #'notmuch-hello-insert-saved-searches :override #'+mail/notmuch-hello-insert-saved-searches)
(advice-add #'notmuch-hello-insert-buttons :override #'+mail/notmuch-hello-insert-buttons)
;; (set! :popup "\\*notmuch-hello\\*" '((size . 20) (side . left)) '((quit . t) (modeline . nil)))
(set-popup-rule! "\\*offlineimap\\*" :side 'bottom :size 0.4 :quit t)
(push (lambda (buf) (string-match-p "^\\*notmuch" (buffer-name buf)))
doom-real-buffer-functions)
(map! (:after notmuch
(:map notmuch-show-mode-map
:nmv "o" #'ace-link-notmuch-show
:nmv "i" #'+mail/open-message-with-mail-app-notmuch-show
:nmv "I" #'notmuch-show-view-all-mime-parts
:nmv "q" #'notmuch-bury-or-kill-this-buffer
(:when (featurep! :completion ivy)
:nmv "s" #'counsel-notmuch)
(:when (featurep! :completion helm)
:nmv "s" #'helm-notmuch)
:nmv "t" #'notmuch-tree-from-show-current-query
:nmv "N" #'notmuch-mua-new-mail
:nmv "n" #'notmuch-show-next-thread-show
:nmv "r" #'notmuch-show-reply
:nmv "<tab>" #'notmuch-show-toggle-visibility-headers
:nmv "R" #'notmuch-show-reply-sender
:nmv "p" #'notmuch-show-previous-thread-show)
(:map notmuch-hello-mode-map
:nmv "o" #'ace-link-notmuch-hello
:nmv "t" #'notmuch-tree
:nmv "k" #'widget-backward
:nmv "n" #'notmuch-mua-new-mail
:nmv "N" #'notmuch-mua-new-mail
:nmv "j" #'widget-forward
(:when (featurep! :completion ivy)
:nmv "s" #'counsel-notmuch)
(:when (featurep! :completion helm)
:nmv "s" #'helm-notmuch)
:nmv "q" #'+mail/quit
:nmv "r" #'notmuch-hello-update)
(:map notmuch-search-mode-map
:nmv "j" #'notmuch-search-next-thread
:nmv "k" #'notmuch-search-previous-thread
:nmv "t" #'notmuch-tree-from-search-thread
;; :nmv "RET" #'notmuch-tree-from-search-thread
:nmv "RET" #'notmuch-search-show-thread
:nmv "N" #'notmuch-mua-new-mail
:nmv "T" #'notmuch-tree-from-search-current-query
:nmv ";" #'notmuch-search-tag
:nmv "," #'notmuch-jump-search
:nmv "d" #'+mail/notmuch-search-delete
:nmv "a" #'notmuch-search-archive-thread
;; :nmv "q" #'notmuch
:nmv "q" #'+mail/quit
:nmv "R" #'notmuch-search-reply-to-thread-sender
:nmv "r" #'notmuch-search-reply-to-thread
:nmv "go" #'+notmuch-exec-offlineimap
(:when (featurep! :completion ivy)
:nmv "s" #'counsel-notmuch)
(:when (featurep! :completion helm)
:nmv "s" #'helm-notmuch)
:nmv "x" #'+mail/notmuch-search-spam)
(:map notmuch-tree-mode-map
:nmv "j" #'notmuch-tree-next-message
:nmv "k" #'notmuch-tree-prev-message
:nmv "S" #'notmuch-search-from-tree-current-query
(:when (featurep! :completion ivy)
:nmv "s" #'counsel-notmuch)
(:when (featurep! :completion helm)
:nmv "s" #'helm-notmuch)
:nmv "t" #'notmuch-tree
:nmv ";" #'notmuch-tree-tag
:nmv "RET" #'notmuch-tree-show-message
:nmv "q" #'notmuch-tree-quit
:nmv "s-n" #'notmuch-mua-new-mail
:nmv "r" #'notmuch-search-reply-to-thread-sender
:nmv "a" #'notmuch-tree-archive-message-then-next
:nmv "A" #'notmuch-tree-archive-thread
:nmv "i" #'+mail/open-message-with-mail-app-notmuch-tree
:nmv "d" #'+mail/notmuch-tree-delete
:nmv "x" #'+mail/notmuch-tree-spam)
(:map notmuch-message-mode-map
:localleader
:desc "Send and Exit" doom-localleader-key #'notmuch-mua-send-and-exit
:desc "Kill Message Buffer" "k" #'notmuch-mua-kill-buffer
:desc "Save as Draft" "s" #'message-dont-send
:desc "Attach file" "f" #'mml-attach-file))))
; Use w3m to parse HTML email
(setq mm-text-html-renderer 'w3m)
(setq w3m-fill-column 72)
;;;; counsel-notmuch
(when (featurep! :completion ivy)
(def-package! counsel-notmuch
:commands counsel-notmuch
:after notmuch))
;;;; helm-notmuch
(when (featurep! :completion helm)
(def-package! helm-notmuch
:commands helm-notmuch
:after notmuch))
;;;; org-mime
(def-package! org-mime
:after (org notmuch))
:config (setq org-mime-library 'mml)
;;;###autoload
(defun =mail ()
"Activate (or switch to) `notmuch' in its workspace."
(interactive)
(if-let* ((buf (cl-find-if (lambda (it) (string-match-p "^\\*notmuch" (buffer-name (window-buffer it))))
(doom-visible-windows))))
(select-window (get-buffer-window buf))
(notmuch-search "tag:inbox")))
;; (call-interactively 'notmuch-hello-sidebar)
;;;###autoload
(defun +mail/quit ()
(interactive)
;; (+popup/close (get-buffer-window "*notmuch-hello*"))
(doom-kill-matching-buffers "^\\*notmuch"))
;;;###autoload
(defun +mail/notmuch-search-delete ()
(interactive)
(notmuch-search-add-tag
(list "+trash" "-inbox" "-unread"))
(notmuch-search-next-thread))
;;;###autoload
(defun +mail/notmuch-tree-delete ()
(interactive)
(notmuch-tree-add-tag
(list "+trash" "-inbox" "-unread"))
(notmuch-tree-next-message))
;;;###autoload
(defun +mail/notmuch-search-spam ()
(interactive)
(notmuch-search-add-tag
(list "+spam" "-inbox" "-unread"))
(notmuch-search-next-thread))
;;;###autoload
(defun +mail/notmuch-tree-spam ()
(interactive)
(notmuch-tree-add-tag
(list "+spam" "-inbox" "-unread"))
(notmuch-tree-next-message))
;;;###autoload
(defun +mail/open-message-with-mail-app-notmuch-tree ()
(interactive)
(let* ((msg-path (car (plist-get (notmuch-tree-get-message-properties) :filename)))
(temp (make-temp-file "notmuch-message-" nil ".eml")))
(shell-command-to-string (format "cp '%s' '%s'" msg-path temp))
(start-process-shell-command "email" nil (format "thunderbird '%s'" temp))))
;; Override
;;;###autoload
(defun +mail/notmuch-start-notmuch-sentinel (proc event)
"Process sentinel function used by `notmuch-start-notmuch'."
(let* ((err-file (process-get proc 'err-file))
(err-buffer (or (process-get proc 'err-buffer)
(find-file-noselect err-file)))
(err (when (not (zerop (buffer-size err-buffer)))
(with-current-buffer err-buffer (buffer-string))))
(sub-sentinel (process-get proc 'sub-sentinel))
(real-command (process-get proc 'real-command)))
(condition-case err
(progn
;; Invoke the sub-sentinel, if any
(when sub-sentinel
(funcall sub-sentinel proc event))
;; Check the exit status. This will signal an error if the
;; exit status is non-zero. Don't do this if the process
;; buffer is dead since that means Emacs killed the process
;; and there's no point in telling the user that (but we
;; still check for and report stderr output below).
(when (buffer-live-p (process-buffer proc))
(notmuch-check-async-exit-status proc event real-command err))
;; If that didn't signal an error, then any error output was
;; really warning output. Show warnings, if any.
(let ((warnings
(when err
(with-current-buffer err-buffer
(goto-char (point-min))
(end-of-line)
;; Show first line; stuff remaining lines in the
;; errors buffer.
(let ((l1 (buffer-substring (point-min) (point))))
(skip-chars-forward "\n")
(cons l1 (unless (eobp)
(buffer-substring (point) (point-max)))))))))
(when warnings
(notmuch-logged-error (car warnings) (cdr warnings)))))
(error
;; Emacs behaves strangely if an error escapes from a sentinel,
;; so turn errors into messages.
(message "%s" (error-message-string err))))
(when err-buffer
(set-process-query-on-exit-flag (get-buffer-process err-buffer) nil)
(kill-buffer err-buffer))
(when err-file (ignore-errors (delete-file err-file)))))
;;;###autoload
(defun +mail/notmuch-show-reuse-buffer (thread-id &optional elide-toggle parent-buffer query-context buffer-name)
"Run \"notmuch show\" with the given thread ID and display results.
ELIDE-TOGGLE, if non-nil, inverts the default elide behavior.
The optional PARENT-BUFFER is the notmuch-search buffer from
which this notmuch-show command was executed, (so that the
next thread from that buffer can be show when done with this
one).
The optional QUERY-CONTEXT is a notmuch search term. Only
messages from the thread matching this search term are shown if
non-nil.
The optional BUFFER-NAME provides the name of the buffer in
which the message thread is shown. If it is nil (which occurs
when the command is called interactively) the argument to the
function is used.
Returns the buffer containing the messages, or NIL if no messages
matched."
(interactive "sNotmuch show: \nP")
(let ((buffer-name (generate-new-buffer-name
(or (concat "*notmuch-" buffer-name "*")
(concat "*notmuch-" thread-id "*"))))
;; We override mm-inline-override-types to stop application/*
;; parts from being displayed unless the user has customized
;; it themselves.
(mm-inline-override-types
(if (equal mm-inline-override-types
(eval (car (get 'mm-inline-override-types 'standard-value))))
(cons "application/*" mm-inline-override-types)
mm-inline-override-types)))
(switch-to-buffer (get-buffer-create buffer-name))
;; No need to track undo information for this buffer.
(setq buffer-undo-list t)
(notmuch-show-mode)
;; Set various buffer local variables to their appropriate initial
;; state. Do this after enabling `notmuch-show-mode' so that they
;; aren't wiped out.
(setq notmuch-show-thread-id thread-id
notmuch-show-parent-buffer parent-buffer
notmuch-show-query-context (if (or (string= query-context "")
(string= query-context "*"))
nil query-context)
notmuch-show-process-crypto notmuch-crypto-process-mime
;; If `elide-toggle', invert the default value.
notmuch-show-elide-non-matching-messages
(if elide-toggle
(not notmuch-show-only-matching-messages)
notmuch-show-only-matching-messages))
(add-hook 'post-command-hook #'notmuch-show-command-hook nil t)
(jit-lock-register #'notmuch-show-buttonise-links)
(notmuch-tag-clear-cache)
(let ((inhibit-read-only t))
(if (notmuch-show--build-buffer)
;; Messages were inserted into the buffer.
(current-buffer)
;; No messages were inserted - presumably none matched the
;; query.
(kill-buffer (current-buffer))
(ding)
(message "No messages matched the query!")
nil))))
;;;###autoload
(defun +mail/notmuch-hello-insert-searches (title query-list &rest options)
"Insert a section with TITLE showing a list of buttons made from QUERY-LIST.
QUERY-LIST should ideally be a plist but for backwards
compatibility other forms are also accepted (see
`notmuch-saved-searches' for details). The plist should
contain keys :name and :query; if :count-query is also present
then it specifies an alternate query to be used to generate the
count for the associated search.
Supports the following entries in OPTIONS as a plist:
:initially-hidden - if non-nil, section will be hidden on startup
:show-empty-searches - show buttons with no matching messages
:hide-if-empty - hide if no buttons would be shown
(only makes sense without :show-empty-searches)
:filter - This can be a function that takes the search query as its argument and
returns a filter to be used in conjuction with the query for that search or nil
to hide the element. This can also be a string that is used as a combined with
each query using \"and\".
:filter-count - Separate filter to generate the count displayed each search. Accepts
the same values as :filter. If :filter and :filter-count are specified, this
will be used instead of :filter, not in conjunction with it."
(widget-insert (propertize title 'face 'org-agenda-structure))
(if (and notmuch-hello-first-run (plist-get options :initially-hidden))
(add-to-list 'notmuch-hello-hidden-sections title))
(let ((is-hidden (member title notmuch-hello-hidden-sections))
(widget-push-button-prefix "")
(widget-push-button-suffix "")
(start (point)))
(if is-hidden
(widget-create 'push-button
:notify `(lambda (widget &rest ignore)
(setq notmuch-hello-hidden-sections
(delete ,title notmuch-hello-hidden-sections))
(notmuch-hello-update))
(propertize " +" 'face 'org-agenda-structure))
(widget-create 'push-button
:notify `(lambda (widget &rest ignore)
(add-to-list 'notmuch-hello-hidden-sections
,title)
(notmuch-hello-update))
" -"))
(widget-insert "\n")
(when (not is-hidden)
(let ((searches (apply 'notmuch-hello-query-counts query-list options)))
(when (or (not (plist-get options :hide-if-empty))
searches)
(widget-insert "\n")
(notmuch-hello-insert-buttons searches)
(indent-rigidly start (point) notmuch-hello-indent))))))
;;;###autoload
(defun +mail/notmuch-hello-insert-saved-searches ()
"Insert the saved-searches section."
(let ((searches (notmuch-hello-query-counts
(if notmuch-saved-search-sort-function
(funcall notmuch-saved-search-sort-function
notmuch-saved-searches)
notmuch-saved-searches)
:show-empty-searches notmuch-show-empty-saved-searches)))
(when searches
(widget-insert (propertize "Notmuch" 'face 'org-agenda-date-today))
(widget-insert "\n\n")
(widget-insert (propertize "Saved searches" 'face 'org-agenda-structure))
(widget-insert "\n\n")
(let ((start (point)))
(notmuch-hello-insert-buttons searches)
(indent-rigidly start (point) notmuch-hello-indent)))))
;;;###autoload
(defun +mail/notmuch-hello-insert-buttons (searches)
"Insert buttons for SEARCHES.
SEARCHES must be a list of plists each of which should contain at
least the properties :name NAME :query QUERY and :count COUNT,
where QUERY is the query to start when the button for the
corresponding entry is activated, and COUNT should be the number
of messages matching the query. Such a plist can be computed
with `notmuch-hello-query-counts'."
(let* ((widest (notmuch-hello-longest-label searches))
(tags-and-width (notmuch-hello-tags-per-line widest))
(tags-per-line (car tags-and-width))
(column-width (cdr tags-and-width))
(column-indent 0)
(count 0)
(reordered-list (notmuch-hello-reflect searches tags-per-line))
;; Hack the display of the buttons used.
(widget-push-button-prefix "")
(widget-push-button-suffix ""))
;; dme: It feels as though there should be a better way to
;; implement this loop than using an incrementing counter.
(mapc (lambda (elem)
;; (not elem) indicates an empty slot in the matrix.
(when elem
(if (> column-indent 0)
(widget-insert (make-string column-indent ? )))
(let* ((name (plist-get elem :name))
(query (plist-get elem :query))
(oldest-first (case (plist-get elem :sort-order)
(newest-first nil)
(oldest-first t)
(otherwise notmuch-search-oldest-first)))
(search-type (eq (plist-get elem :search-type) 'tree))
(msg-count (plist-get elem :count)))
(widget-insert (format "\n%5s "
(notmuch-hello-nice-number msg-count)))
(widget-create 'push-button
:notify #'notmuch-hello-widget-search
:notmuch-search-terms query
:notmuch-search-oldest-first oldest-first
:notmuch-search-type search-type
name)
(setq column-indent
(1+ (max 0 (- column-width (length name)))))))
(setq count (1+ count))
(when (eq (% count tags-per-line) 0)
(setq column-indent 0)
(widget-insert "\n")))
reordered-list)
;; If the last line was not full (and hence did not include a
;; carriage return), insert one now.
(unless (eq (% count tags-per-line) 0)
(widget-insert "\n"))))
(defun +notmuch-exec-offlineimap ()
"Execute offlineimap"
(interactive)
(set-process-sentinel
(start-process-shell-command "offlineimap"
"*offlineimap*"
"offlineimap -o")
'(lambda (process event)
(notmuch-refresh-all-buffers)
(message "Done!"))))
; Kill email message buffers when you close them
(setq message-kill-buffer-on-exit t)
(setq message-default-mail-headers "Cc: \nBcc: \n")
(setq message-auto-save-directory "~/Mail/colin@onec.me/Drafts/")
(setq message-directory "~/Mail/colin@onec.me/")

View File

@ -0,0 +1,14 @@
;;; -*- 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))))

View File

@ -0,0 +1,156 @@
;;; org-daypage.el --- Org-Mode Day Page.
;;
;; Copyright (C) 2010-2011 Thomas Parslow
;;
;; Author: Thomas Parslow <tom@almostobsolete.net>
;; 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 <http://www.gnu.org/licenses/>.
;;
;;; 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 "<C-left>") 'daypage-prev)
;; (define-key daypage-mode-map (kbd "<C-right>") 'daypage-next)
;; (define-key daypage-mode-map (kbd "<C-up>") 'daypage-prev-week)
;; (define-key daypage-mode-map (kbd "<C-down>") '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)

102
emacs/.config/doom/+org.el Normal file
View File

@ -0,0 +1,102 @@
;;; package --- summary +org.el
;;; lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(setq +todo-file "~/org/inbox.org")
(setq org-directory (expand-file-name "~/Org/")
org-journal-dir "~/Org/journal/"
org-startup-indented t
org-agenda-files (list org-directory)
org-pretty-entities t
org-hide-emphasis-markers t
org-hide-leading-stars t
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-log-done 'time
org-bullets-face-name (quote org-bullet-face)
org-bullets-bullet-list '("" "" "" "")
org-capture-templates
'(("i" "Send to inbox" entry (file+headline "~/Org/inbox.org" "Inbox")
"* TODO %?\n %i\n %a")
("n" "Create new note" entry (file "~/Org/notes.org")
"* %?\nEntered on %U\n %i\n %a")
("e" "Elation related note" entry (file "~/Org/elation.org")
"* %?\nEntered on %U\n %i\n %a")
("g" "Add glossary note" entry (file "~/Org/glossary.org")
"* %?\nEntered on %U\n %i\n")
("d" "Add an idea" entry (file "~/Org/ideas.org")
"* %?\nEntered on %U\n %i\n"))
org-todo-keywords '((sequence "TODO(t)" "|" "DONE(d)"))
org-agenda-include-diary nil
org-agenda-custom-commands
'(("h" todo "HOLD")
("d" "Agenda + Next Actions" ((agenda) (todo "NEXT"))))
org-tag-alist '(("@home" . ?h)
("@townhall" . ?t)
("@farm" . ?f)
("@read" . ?r)
("@computer" . ?c))
org-modules '(org-drill
org-id
org-info
org-habit
org-protocol
org-annotate-file
org-eval
org-expiry
org-contacts
org-man
org-notmuch
org-collector
org-panel
org-screen
org-toc)
; refile targets
org-refile-targets '(("~/Org/todo.org" :maxlevel . 2)
("~/Org/someday.org" :maxlevel . 2)
("~/Org/town.org" :maxlevel . 2)
("~/Org/personal.org" :maxlevel . 2)
("~/Org/elation.org" :maxlevel . 2)))
;; org-match-sparse-tree
;; org-set-tags-command
(defun +open-todo-file ()
(interactive)
"Opens the todo file"
(find-file +todo-file))
(map!
:leader
:desc "Open todo file" "O" #'+open-todo-file)
(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 "o"
:desc "Org Agenda" "a" #'org-agenda-list
:desc "Org open link" "l" #'org-open-at-point
:desc "Org Agenda and Notes" "A" #'+show-agenda))

View File

@ -0,0 +1 @@
;;; ~/devel/dotfiles/config/doom/+python.el -*- lexical-binding: t; -*-

View File

@ -0,0 +1,14 @@
;;; -*- 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

View File

@ -0,0 +1,30 @@
;;; -*- lexical-binding: t; -*-
(def-package! reason-mode
:mode "\\.rei?$"
:commands (reason-mode)
:config
(let* (
(refmt-bin (executable-find "refmt"))
(merlin-bin (executable-find "ocamlmerlin"))
(merlin-base-dir (when merlin-bin
(replace-regexp-in-string "bin/ocamlmerlin$" "" merlin-bin))))
;; Add npm merlin.el to the emacs load path and tell emacs where to find ocamlmerlin
(when merlin-bin
(add-to-list 'load-path (concat merlin-base-dir "share/emacs/site-lisp/"))
(setq merlin-command merlin-bin))
(when refmt-bin
(setq refmt-command refmt-bin))
(require 'merlin)
(add-hook! reason-mode
(add-hook 'before-save-hook #'refmt-before-save nil t)
(merlin-mode))
(setq-hook! reason-mode
indent-region-function #'apply-refmt)
(set-electric! 'some-mode :chars '(?|))
(set-lookup-handlers! 'reason-mode
:definition #'merlin-locate
:references #'merlin-occurrences
:documentation #'merlin-document)
(set-company-backend! 'reason-mode 'merlin-company-backend)))

11
emacs/.config/doom/+ui.el Normal file
View File

@ -0,0 +1,11 @@
;;; -*- lexical-binding: t; -*-
(setq doom-theme 'doom-Iosvkem)
;; Fonts
(setq doom-font (font-spec :family "FuraCode Nerd Font" :size 14))
(setq doom-big-font (font-spec :family "FuraCode Nerd Font" :size 20))
;; Dash highlighting
;; (after! dash (dash-enable-font-lock))
;;(load! "+magit")

View File

@ -0,0 +1,9 @@
;;; ~/.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)))

View File

@ -0,0 +1,34 @@
;;; private/hlissner/autoload.el -*- lexical-binding: t; -*-
;;;###autoload
(defun +hlissner/find-in-dotfiles ()
"Open a file somewhere in ~/.dotfiles via a fuzzy filename search."
(interactive)
(doom-project-find-file (expand-file-name "~/.dotfiles")))
;;;###autoload
(defun +hlissner/browse-dotfiles ()
"Browse the files in ~/.dotfiles."
(interactive)
(doom-project-browse (expand-file-name "~/.dotfiles")))
;;;###autoload
(defun +hlissner/find-notes-for-major-mode (&optional arg)
"TODO"
(interactive "P")
(let ((default-directory (expand-file-name "code/" +org-dir)))
(if arg
(call-interactively #'find-file)
(find-file
(expand-file-name (concat (string-remove-suffix "-mode" (symbol-name major-mode)) ".org"))))))
;;;###autoload
(defun +hlissner/find-notes-for-project (&optional arg)
"TODO"
(interactive "P")
(let ((project-root (doom-project-name 'nocache))
(default-directory (expand-file-name "projects/" +org-dir)))
(if arg
(call-interactively #'find-file)
(find-file
(expand-file-name (concat project-root ".org"))))))

View File

@ -0,0 +1,126 @@
;;; ~/.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-default
user-full-name "Colin Powell"
user-mail-address "colin@onec.me"
+workspaces-switch-project-function #'ignore
+pretty-code-enabled-modes '(emacs-lisp-mode org-mode python-mode)
+format-on-save-enabled-modes '(not emacs-lisp-mode)
)
;; (setq-hook! 'minibuffer-setup-hook show-trailing-whitespace nil)
(setq ns-use-thin-smoothing t)
(add-to-list 'default-frame-alist '(ns-transparent-titlebar . t))
(add-to-list 'default-frame-alist '(ns-appearance . dark))
;(add-hook 'window-setup-hook 'toggle-frame-maximized)
;;
;; Keybindings
(map!
;; Easier window navigation
:n "C-h" #'evil-window-left
:n "C-j" #'evil-window-down
:n "C-k" #'evil-window-up
:n "C-l" #'evil-window-right
(:after treemacs-evil
(:map evil-treemacs-state-map
"C-h" #'evil-window-left
"C-l" #'evil-window-right))
;; Leader tricks
(:leader
(:prefix "f"
:desc "Find file in dotfiles" :n "t" #'+hlissner/find-in-dotfiles
:desc "Browse dotfiles" :n "T" #'+hlissner/browse-dotfiles)
(:prefix "t"
:desc "Switch themes" :n "t" #'counsel-load-theme)
(:prefix "o"
:desc "Elfeed feed reader" :n "f" #'elfeed)
(:prefix "a"
:desc "Save all org buffers" :n "a" #'org-save-all-org-buffers
:desc "Set task deadline" :n "d" #'org-deadline
:desc "New journal entry" :n "j" #'org-journal-new-entry
:desc "Sync gcal with org" :n "g" #'org-gcal-sync
:desc "Open agenda" :n "o" #'org-agenda-list
:desc "Schedule task" :n "s" #'org-schedule)
(:prefix "p"
:desc "Black buffer" :n "b" #'blacken-buffer)
(:prefix "y"
:desc "Yank pop!" :n "p" #'counsel-yank-pop
:desc "Git yank link" :n "g" #'git-link)
(:prefix "n"
:desc "Browse mode notes" :n "m" #'+hlissner/find-notes-for-major-mode
:desc "Browse project notes" :n "p" #'+hlissner/find-notes-for-project)))
;; Company mode
(require 'company)
(setq company-idle-delay 0.2
completion-ignore-case t
company-minimum-prefix-length 3
company-async-timeout 2)
;;(set! :company-backend 'python-mode '(company-anaconda))
(add-hook 'prog-mode-hook 'global-company-mode)
;; importmagic
(add-hook 'python-mode-hook 'importmagic-mode)
;; Golang
(add-hook 'go-mode-hook 'gofmt-before-save)
;; app/rss
(add-hook! 'elfeed-show-mode-hook (text-scale-set 1.5))
;; emacs/eshell
(after! eshell
(set-eshell-alias!
"f" "find-file $1"
"l" "ls -lh"
"d" "dired $1"
"dc" "docker-compose $1"
"gl" "(call-interactively 'magit-log-current)"
"gs" "magit-status"
"gc" "magit-commit"
"rg" "rg --color=always $*"))
;; Add notice for lines over 88 chars
;;(setq-default
;; whitespace-line-column 88
;; whitespace-style '(face lines-tail))
;; tools/magit
(setq magit-repository-directories '(("~/devel" . 2))
magit-save-repository-buffers nil)
;; make the lines in the buffer wrap around the edges of the screen.
;(add-hook 'org-mode-hook '(lambda () (visual-line-mode)))
;;; Setup sending email with msmtp
(setq send-mail-function 'sendmail-send-it
sendmail-program "/usr/local/bin/msmtp"
mail-specify-envelope-from t
message-sendmail-envelope-from 'header
mail-envelope-from 'header)
;; Hide hidden files in treemacs
(setq treemacs-show-hidden-files nil)
;;(load! "+org-daypage") ;; hardwire this baby in here somewhere
(load! "+ui") ;; My ui mods. Also contains ligature stuff.
(load! "+music") ;; Music stuff, visible through SPC-a-m. Not perfect.
(load! "+ranger") ;; File manager stuff
;;(load! "+reason") ;; ReasonML stuff
(load! "+mail") ;; Mail stuff
(load! "+org") ;; Org mode stuff like todos and rebindings
(load! "+wttrin") ;; Weather config

161
emacs/.config/doom/init.el Normal file
View File

@ -0,0 +1,161 @@
;;; init.el -*- lexical-binding: t; -*-
;; Copy me to ~/.doom.d/init.el or ~/.config/doom/init.el, then edit me!
(doom! :feature
;;debugger ; FIXME stepping through code, to help you add bugs
eval ; run code, run (also, repls)
(evil +everywhere); come to the dark side, we have cookies
file-templates ; auto-snippets for empty files
(lookup ; helps you navigate your code and documentation
+docsets) ; ...or in Dash docsets locally
snippets ; my elves. They type so I don't have to
spellcheck ; tasing you for misspelling mispelling
(syntax-checker +childframe)
workspaces ; tab emulation, persistence & separate workspaces
:completion
company ; the ultimate code completion backend
;;(helm +fuzzy)
;;ido ; the other *other* search engine...
(ivy +childframe +fuzzy) ; a search engine for love and life
:ui
;;deft ; notational velocity for Emacs
doom ; what makes DOOM look the way it does
doom-dashboard ; a nifty splash screen for Emacs
doom-modeline ; a snazzy Atom-inspired mode-line
doom-quit ; DOOM quit-message prompts when you quit Emacs
evil-goggles ; display visual hints when editing in evil
fci ; a `fill-column' indicator
hl-todo ; highlight TODO/FIXME/NOTE tags
;;modeline ; snazzy, Atom-inspired modeline, plus API
nav-flash ; blink the current line after jumping
;;neotree ; a project drawer, like NERDTree for vim
treemacs ; a project drawer, like neotree but cooler
(popup ; tame sudden yet inevitable temporary windows
+all ; catch all popups that start with an asterix
+defaults) ; default popup rules
pretty-code ; replace bits of code with pretty symbols
;;tabbar ; FIXME an (incomplete) tab bar for Emacs
unicode ; extended unicode support for various languages
vc-gutter ; vcs diff in the fringe
vi-tilde-fringe ; fringe tildes to mark beyond EOB
window-select ; visually switch windows
:editor
(format +onsave) ; automated prettiness
;;lispy ; vim for lisp, for people who dont like vim
multiple-cursors ; editing in many places at once
;;parinfer ; turn lisp into python, sort of
rotate-text ; cycle region at point between text candidates
:emacs
(dired ; making dired pretty [functional]
+ranger ; bringing the goodness of ranger to dired
+icons ; colorful icons for dired-mode
)
ediff ; comparing files in Emacs
electric ; smarter, keyword-based electric-indent
eshell ; a consistent, cross-platform shell (WIP)
hideshow ; basic code-folding support
imenu ; an imenu sidebar and searchable code index
term ; terminals in Emacs
vc ; version-control and Emacs, sitting in a tree
:tools
ansible
docker
editorconfig ; let someone else argue about tabs vs spaces
;;ein ; tame Jupyter notebooks with emacs
gist ; interacting with github gists
macos ; MacOS-specific commands
make ; run make tasks from Emacs
magit ; a git porcelain for Emacs
password-store ; password manager for nerds
pdf ; pdf enhancements
;;prodigy ; FIXME managing external services & code builders
;;rgb ; creating color strings
terraform ; infrastructure as code
;;tmux ; an API for interacting with tmux
upload ; map local to remote projects via ssh/ftp
;;wakatime
:lang
;;assembly ; assembly for fun or debugging
;;(cc +irony +rtags); C/C++/Obj-C madness
;;clojure ; java with a lisp
common-lisp ; if you've seen one lisp, you've seen them all
;;coq ; proofs-as-programs
;;crystal ; ruby at the speed of c
;;csharp ; unity, .NET, and mono shenanigans
data ; config/data formats
erlang ; an elegant language for a more civilized age
elixir ; erlang done right
elm ; care for a cup of TEA?
emacs-lisp ; drown in parentheses
;;ess ; emacs speaks statistics
go ; the hipster dialect
;;(haskell +intero) ; a language that's lazier than I am
;;hy ; readability of scheme w/ speed of python
;;idris ;
(java +meghanada) ; the poster child for carpal tunnel syndrome
javascript ; all(hope(abandon(ye(who(enter(here))))))
;;julia ; a better, faster MATLAB
;;latex ; writing papers in Emacs has never been so fun
ledger ; an accounting system in Emacs
;;lua ; one-based indices? one-based indices
markdown ; writing docs for people to ignore
;;nim ; python + lisp at the speed of c
;;nix ; I hereby declare "nix geht mehr!"
;;ocaml ; an objective camel
(org ; organize your plain life in plain text
+attach ; custom attachment system
+babel ; running code in org
+capture ; org-capture in and outside of Emacs
+export ; Exporting org to whatever you want
+hugo
+journal
+present) ; Emacs for presentations
;;perl ; write code no one else can comprehend
php ; perl's insecure younger brother
;;plantuml ; diagrams for confusing people more
;;purescript ; javascript, but functional
python ; beautiful is better than ugly
;;qt ; the 'cutest' gui framework ever
racket ; a DSL for DSLs
rest ; Emacs as a REST client
ruby ; 1.step do {|i| p "Ruby is #{i.even? ? 'love' : 'life'}"}
rust ; Fe2O3.unwrap().unwrap().unwrap().unwrap()
;;scala ; java, but good
(sh +fish) ; she sells (ba|z|fi)sh shells on the C xor
;;solidity ; do you need a blockchain? No.
;;swift ; who asked for emoji variables?
web ; the tubes
;;vala ; GObjective-C
;; Applications are complex and opinionated modules that transform Emacs
;; toward a specific purpose. They may have additional dependencies and
;; should be loaded late.
:app
notmuch
;;(email +gmail) ; emacs as an email client
irc ; how neckbeards socialize
(rss +org) ; emacs as an RSS reader
;;twitter ; twitter client https://twitter.com/vnought
;(write ; emacs as a word processor (latex + org + markdown)
;; +wordnut ; wordnet (wn) search
;; +langtool) ; a proofreader (grammar/style check) for Emacs
:collab
;;floobits ; peer programming for a price
impatient-mode ; show off code over HTTP
:config
;; For literate config users. This will tangle+compile a config.org
;; literate config in your `doom-private-dir' whenever it changes.
;;literate
;; The default module sets reasonable defaults for Emacs. It also
;; provides a Spacemacs-inspired keybinding scheme and a smartparens
;; config. Use it as a reference for your own modules.
(default +bindings +smartparens))

View File

@ -0,0 +1,61 @@
;; -*- no-byte-compile: t; -*-
;;; ~/.config/doom/packages.el
;;;
;; Snippets! From hlissner!
(package! emacs-snippets
:recipe (:fetcher github
:repo "hlissner/emacs-snippets"
:files ("*")))
(package! declutter
:recipe (:fetcher github
:repo "sanel/declutter"))
(package! ox-slack
:recipe (:fetcher github
:repo "titaniumbones/ox-slack"))
(package! counsel-spotify
:recipe (:fetcher github
:repo "Lautaro-Garcia/counsel-spotify"))
;;(package! org-daypage
;; :recipe (:fetcher github
;; :repo "almost/org-daypage"))
;; python stuffs
(package! w3m)
(package! blacken)
(package! pylint)
(package! py-isort)
(package! importmagic)
;; weather?
(package! wttrin)
;; org stuffs
(package! org-journal)
(package! ox-hugo)
(package! org-gcal)
(package! org-web-tools)
(package! org-vcard)
(package! org-snooze)
;; handy tools
(package! git-link)
(package! restclient)
(package! atomic-chrome)
(package! auth-source-pass)
(package! ivy-todo)
(package! ivy-explorer)
(package! counsel-spotify)
(package! ivy-lobsters)
;; modes!
(package! terraform-mode)
(package! exec-path-from-shell :disable t)
(package! evil-matchit :recipe (:fetcher github :repo "redguardtoo/evil-matchit" :commit "7d65b4167b1f0086c2b42b3aec805e47a0d355c4"))