Created
July 27, 2017 13:31
-
-
Save dieggsy/054e033e57c08e536f8fbe18349547f3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; -*- lexical-binding: t -*- | |
;;(package-initialize) | |
(setq esup-child-profile-require-level 0) | |
(defconst d/emacs-start-time (current-time)) | |
(setq gc-cons-threshold 64000000) | |
(add-hook 'after-init-hook (lambda () | |
;; restore after startup | |
(setq gc-cons-threshold 800000))) | |
;; [[file:~/dotfiles/emacs.d/init.org::*Personal%20Info][Personal Info:1]] | |
(setq user-full-name "Diego A. Mundo" | |
user-mail-address "diegoamundo@gmail.com") | |
;; Personal Info:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Server][Server:1]] | |
(require 'server) | |
(unless (server-running-p) | |
(server-start)) | |
;; Server:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Load%20Path][Load Path:1]] | |
(eval-and-compile | |
(add-to-list 'load-path (expand-file-name "lisp" user-emacs-directory)) | |
(let ((default-directory "~/.emacs.d/lisp/")) | |
(normal-top-level-add-subdirs-to-load-path)) | |
(add-to-list 'custom-theme-load-path "~/.emacs.d/lisp/")) | |
;; Load Path:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Libraries][Libraries:1]] | |
(require 'cl-lib) | |
;; Libraries:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Utilities][Utilities:1]] | |
(defmacro d/time (name &rest body) | |
(declare (indent defun)) | |
`(let ((s-time (current-time))) | |
(prog1 | |
(progn | |
,@body) | |
(message "`%s' execution took %.5f seconds." | |
,name | |
(float-time (time-subtract (current-time) s-time)))))) | |
(defmacro d/start-time (name) | |
`(defvar ,(intern (concat "d/time-" name)) (current-time))) | |
(defmacro d/end-time (name) | |
`(message "`%s' execution took %.5f seconds." | |
,name | |
(float-time (time-subtract (current-time) ,(intern (concat "d/time-" name)))))) | |
;; Utilities:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/raxod502/straight.el#getting-started%5D%5Bstraight%5D%5D][[[https://github.com/raxod502/straight.el#getting-started][straight]]:1]] | |
(setq straight-recipe-overrides '((nil (straight :host github | |
:repo "raxod502/straight.el" | |
:files ("straight.el") | |
:branch "develop")))) | |
(let ((bootstrap-file (concat user-emacs-directory "straight/bootstrap.el")) | |
(bootstrap-version 2)) | |
(unless (file-exists-p bootstrap-file) | |
(with-current-buffer | |
(url-retrieve-synchronously | |
"https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el" | |
'silent 'inhibit-cookies) | |
(goto-char (point-max)) | |
(eval-print-last-sexp))) | |
(load bootstrap-file nil 'nomessage)) | |
;; [[https://github.com/raxod502/straight.el#getting-started][straight]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/jwiegley/use-package%5D%5Buse-package%5D%5D][[[https://github.com/jwiegley/use-package][use-package]]:1]] | |
(straight-use-package 'use-package) | |
;; [[https://github.com/jwiegley/use-package][use-package]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/jwiegley/use-package%5D%5Buse-package%5D%5D][[[https://github.com/jwiegley/use-package][use-package]]:2]] | |
(setq use-package-minimum-reported-time .001 | |
use-package-verbose t | |
use-package-always-defer t | |
use-package-always-ensure t) | |
(eval-when-compile | |
(require 'use-package)) | |
;; [[https://github.com/jwiegley/use-package][use-package]]:2 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Column][Column:1]] | |
(setq column-number-mode t) | |
;; Column:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Custom][Custom:1]] | |
(setq custom-file "~/.emacs.d/custom.el") | |
(load custom-file) | |
;; Custom:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Disabled%20Commands][Disabled Commands:1]] | |
(setq disabled-command-function nil) | |
;; Disabled Commands:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Kill-ring][Kill-ring:1]] | |
(setq save-interprogram-paste-before-kill t) | |
;; Kill-ring:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Messages][Messages:1]] | |
(setq message-log-max 10000) | |
;; Messages:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Minibuffer][Minibuffer:1]] | |
(setq enable-recursive-minibuffers t | |
resize-mini-windows t) | |
;; Minibuffer:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Prompts][Prompts:1]] | |
(defalias 'yes-or-no-p #'y-or-n-p) | |
;; Prompts:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Scrolling][Scrolling:1]] | |
(setq scroll-step 1 | |
scroll-conservatively 10000 | |
auto-hscroll-mode 'current-line) | |
;; Scrolling:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Tab][Tab:1]] | |
(setq tab-stop-list (number-sequence 4 200 4) | |
completion-cycle-threshold t | |
tab-always-indent 'complete) | |
;; Tab:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Tramp][Tramp:1]] | |
(setq tramp-default-method "ssh" | |
tramp-verbose 2 | |
password-cache t | |
password-cache-expiry 86400) | |
;; Tramp:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Config%20helpers][Config helpers:1]] | |
(defmacro d/setup-mode (modes &rest body) | |
"Create a setup function for MODES and add it to relevant hook(s)." | |
(declare (indent defun)) | |
(let ((modes (if (listp modes) modes (list modes)))) | |
(let ((setup-func | |
(intern (concat "d/setup-" | |
(symbol-name (car modes)) | |
"-mode")))) | |
`(progn | |
(defun ,setup-func () | |
,@body) | |
,@(cl-loop for mode in modes collect | |
(let ((mode-hook (intern (concat (symbol-name mode) | |
"-mode-hook")))) | |
`(add-hook ',mode-hook #',setup-func))))))) | |
(defmacro d/with-eval-after-load (feature &rest body) | |
(declare (indent defun)) | |
`(with-eval-after-load ,feature | |
(condition-case-unless-debug err | |
(progn | |
,@body) | |
(error | |
(display-warning 'config | |
(format "%s %s: %s " (symbol-name ,feature) "eval-after-load" | |
(error-message-string err)) | |
:error))))) | |
;; Config helpers:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Dotfiles][Dotfiles:1]] | |
(d/with-eval-after-load 'org | |
(defvar d/show-async-tangle-results nil) | |
(defun d/async-tangle-init () | |
"Asynchronously tangle config.org and and byte-compile." | |
(interactive) | |
(let ((init-tangle-start-time (current-time))) | |
(async-start | |
(lambda () | |
;; make async emacs aware of packages (for byte-compilation) | |
(require 'org) | |
;; tangle | |
(org-babel-tangle-file | |
(expand-file-name "~/dotfiles/emacs.d/init.org"))) | |
(unless d/show-async-tangle-results | |
`(lambda (result) | |
(if result | |
(message "SUCCESS: init.org successfully tangled. (%.3fs)" | |
(float-time (time-subtract (current-time) | |
',init-tangle-start-time))) | |
(message "ERROR: init.org tangle failed."))))))) | |
(defun d/async-babel-tangle () | |
"Tangle org file asynchronously." | |
(interactive) | |
(let ((file (buffer-file-name))) | |
(async-start | |
`(lambda () | |
(require 'org) | |
(org-babel-tangle-file ,file)) | |
(unless d/show-async-tangle-results | |
(lambda (result) | |
(if result | |
(message "SUCCESS: successfully tangled file.") | |
(message "ERROR: tangle file failed.")))))))) | |
;; Dotfiles:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Other][Other:1]] | |
(defun d/toggle-rlines () | |
"Toggle relative line numbers." | |
(interactive) | |
(if (eq display-line-numbers 'relative) | |
(setq display-line-numbers t) | |
(setq display-line-numbers 'relative))) | |
(define-minor-mode d/rlines-mode | |
"Display relative line numbers for current buffer." | |
nil | |
" rl" | |
nil | |
(setq display-line-numbers nil) | |
(when (and d/rlines-mode | |
(not (minibufferp))) | |
(setq display-line-numbers 'relative) | |
(setq display-line-numbers-width | |
(length | |
(number-to-string | |
(count-lines (point-min) (point-max))))))) | |
(define-globalized-minor-mode d/global-rlines-mode d/rlines-mode | |
d/rlines-mode | |
(lambda () (d/rlines-mode 1))) | |
(defmacro d/fbound-and-true-p (name &optional args) | |
`(and (fboundp #',name) | |
(apply #',name ,args))) | |
;; Other:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/tarsius/no-littering/%5D%5Bno-littering%5D%5D][[[https://github.com/tarsius/no-littering/][no-littering]]:1]] | |
(use-package no-littering | |
:demand t | |
:config | |
(savehist-mode 1) | |
(add-to-list 'savehist-additional-variables 'kill-ring) | |
(save-place-mode 1) | |
(setq auto-save-file-name-transforms | |
`((".*" ,(no-littering-expand-var-file-name "auto-save/") t)))) | |
;; [[https://github.com/tarsius/no-littering/][no-littering]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/purcell/exec-path-from-shell%5D%5Bexec-path-from-shell%5D%5D][[[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]]:1]] | |
(use-package exec-path-from-shell | |
:defer 5 | |
:config | |
(setq exec-path-from-shell-check-startup-files nil) | |
(exec-path-from-shell-initialize)) | |
;; [[https://github.com/purcell/exec-path-from-shell][exec-path-from-shell]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/noctuid/general.el%5D%5Bgeneral%5D%5D][[[https://github.com/noctuid/general.el][general]]:1]] | |
(use-package general | |
:demand t | |
:recipe (:host github | |
:repo "noctuid/general.el" | |
:branch "buttercup") | |
:config | |
(general-evil-setup t t) | |
(general-create-definer | |
d/mode-leader-keys | |
:states '(emacs normal visual motion insert) | |
:non-normal-prefix "C-," | |
:prefix ",") | |
(general-create-definer | |
d/leader-keys | |
:states '(emacs normal visual motion insert) | |
:non-normal-prefix "C-SPC" | |
:prefix "SPC")) | |
;; [[https://github.com/noctuid/general.el][general]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Package][Package:1]] | |
(use-package evil | |
:demand t | |
:general | |
(nmap | |
"S-SPC" 'org-agenda-list | |
"-" 'negative-argument | |
"\\" 'evil-window-next | |
"C-_" 'keyboard-quit | |
"C-/" 'keyboard-quit | |
[escape] 'keyboard-quit) | |
(:states '(insert replace visual) | |
"C-_" 'evil-normal-state | |
"C-/" 'evil-normal-state) | |
(vmap [escape] 'keyboard-quit) | |
:init | |
(setq evil-want-C-u-scroll t | |
evil-want-fine-undo t | |
evil-search-module 'evil-search | |
evil-lookup-func (lambda () (man (thing-at-point 'word)))) | |
:config | |
(setq evil-insert-state-cursor '(bar . 1) | |
evil-emacs-state-cursor '(bar . 1) | |
evil-ex-search-vim-style-regexp t | |
evil-normal-state-tag " N " | |
evil-insert-state-tag " I " | |
evil-motion-state-tag " M " | |
evil-visual-state-tag " V " | |
evil-emacs-state-tag " E " | |
evil-replace-state-tag " R " | |
evil-operator-state-tag " O ") | |
(evil-ex-define-cmd "dtw" #'delete-trailing-whitespace) | |
(evil-ex-define-cmd "buffers" #'ibuffer) | |
(evil-mode 1)) | |
;; Package:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Modes][Modes:1]] | |
(d/with-eval-after-load 'evil | |
;; Use Emacs state in these additional modes. | |
(dolist (mode '(ag-mode | |
flycheck-error-list-mode | |
git-rebase-mode | |
eshell-mode | |
calc-mode | |
calc-trail-mode | |
sunshine-mode | |
term-mode | |
notmuch-tree-mode | |
profiler-report-mode)) | |
(add-to-list 'evil-emacs-state-modes mode)) | |
(setq evil-emacs-state-modes (delq 'ibuffer-mode evil-emacs-state-modes)) | |
(setq evil-emacs-state-modes (delq 'Custom-mode evil-emacs-state-modes)) | |
(setq evil-insert-state-modes (delq 'term-mode evil-insert-state-modes)) | |
;; Use insert state in these additional modes. | |
(dolist (mode '(magit-log-edit-mode org-capture-mode)) | |
(add-to-list 'evil-insert-state-modes mode)) | |
(add-to-list 'evil-buffer-regexps '("\\*Flycheck"))) | |
;; Modes:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*ivy][ivy:1]] | |
(use-package ivy | |
:general | |
(:keymaps 'ivy-minibuffer-map | |
[escape] 'keyboard-escape-quit | |
"C-/" 'keyboard-escape-quit | |
[S-return] 'ivy-dispatching-done | |
[C-return] 'ivy-immediate-done | |
"C-j" 'ivy-next-line | |
"C-k" 'ivy-previous-line | |
[S-up] 'ivy-previous-history-element | |
[S-down] 'ivy-next-history-element) | |
(d/leader-keys | |
"-" 'ivy-resume | |
"bb" 'ivy-switch-buffer | |
"bB" 'ivy-switch-buffer-other-window) | |
:init | |
(setq ivy-do-completion-in-region nil) | |
:config | |
(ivy-mode 1) | |
(setq ivy-re-builders-alist '((swiper . ivy--regex-plus) | |
(t . ivy--regex-ignore-order))) | |
(setq ivy-format-function 'ivy-format-function-arrow ; DAT NICE ARROW THOUGH aosenuth | |
projectile-completion-system 'ivy | |
ivy-use-virtual-buffers t ; Show recent files | |
ivy-count-format "" | |
ivy-extra-directories nil; '("../") ; ignore current folder and parent dir | |
ivy-initial-inputs-alist '((man . "^")) | |
ivy-switch-buffer-faces-alist '((dired-mode . ivy-subdir)) | |
recentf-max-saved-items 50 | |
ivy-use-selectable-prompt t)) | |
(use-package ivy-hydra) | |
;; ivy:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*swiper][swiper:1]] | |
(use-package swiper | |
:general | |
(d/leader-keys | |
"sm" 'swiper-multi | |
"sS" 'swiper-all) | |
:config (setq swiper-goto-start-of-match t)) | |
;; swiper:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*counsel][counsel:1]] | |
(use-package counsel | |
:general | |
("M-x" 'counsel-M-x | |
"C-x C-f" 'counsel-find-file) | |
(d/leader-keys | |
"SPC" 'counsel-M-x | |
"ff" 'counsel-find-file | |
"fj" 'counsel-file-jump | |
"fl" 'counsel-locate | |
"hdF" 'counsel-describe-face | |
"hdb" 'counsel-descbinds | |
"hdf" 'counsel-describe-function | |
"hdv" 'counsel-describe-variable | |
"iu" 'counsel-unicode-char | |
"sr" 'counsel-rg | |
"ss" 'counsel-grep-or-swiper | |
"y" 'counsel-yank-pop) | |
:commands counsel-describe-face | |
:config | |
(when (eq system-type 'darwin) | |
(setq counsel-locate-cmd 'counsel-locate-cmd-mdfind)) | |
(setq conusel-org-goto-display-style 'path | |
counsel-org-goto-separator ": " | |
counsel-org-goto-face-style 'org | |
counsel-org-goto-display-todo t | |
counsel-grep-base-command "grep -nEi '%s' %s" | |
counsel-find-file-ignore-regexp (concat "\\(\\`\\.\\)" | |
"\\|\\(\\.elc$\\)" | |
"\\|\\(.pyc$\\)") | |
counsel-yank-pop-separator " | |
───────────────────────── | |
") | |
(counsel-mode 1) | |
(defalias 'ag #'counsel-ag) | |
(defalias 'locate #'counsel-locate) | |
(define-advice counsel-yank-pop-action (:override (s) paste-after) | |
"Paste text after point, which is consistent with evil-paste-after. | |
Source: https://git.io/vQKmf" | |
(save-excursion | |
(undo-boundary) | |
(unless (eq (point) (point-max)) | |
(forward-char)) | |
(with-ivy-window | |
(delete-region ivy-completion-beg | |
ivy-completion-end) | |
(insert (substring-no-properties s)) | |
(setq ivy-completion-end (point)))) | |
(forward-char (length s))) | |
(define-advice counsel--yank-pop-format-function (:override (cand-pairs) arrow-format) | |
"Use the arrow format for counsel-yank-pop for consistency with | |
ivy-format-function-arrow. | |
Source: https://git.io/vQK0v" | |
(ivy--format-function-generic | |
(lambda (str) | |
(let ((temp-list | |
(split-string (counsel--yank-pop-truncate str) "\n" t))) | |
(mapconcat 'identity | |
(append (list (concat "> " (car temp-list))) | |
(mapcar (lambda (s) (concat " " s)) | |
(cdr temp-list))) | |
"\n"))) | |
(lambda (str) | |
(mapconcat (lambda (s) (concat " " s)) | |
(split-string (counsel--yank-pop-truncate str) "\n" t) | |
"\n")) | |
cand-pairs | |
counsel-yank-pop-separator))) | |
;; counsel:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/Ilazki/prettify-utils.el%5D%5Bprettify-utils%5D%5D][[[https://github.com/Ilazki/prettify-utils.el][prettify-utils]]:1]] | |
(use-package prettify-utils | |
:recipe (:host github | |
:repo "Ilazki/prettify-utils.el")) | |
;; [[https://github.com/Ilazki/prettify-utils.el][prettify-utils]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Files][Files:1]] | |
(d/with-eval-after-load 'org | |
(setq org-agenda-text-search-extra-files '(agenda-archives) | |
org-agenda-files '("~/Dropbox/org/todo.org" "~/Dropbox/org/gcal.org") | |
org-default-notes-file "~/Dropbox/org/todo.org" | |
d/notes-file "~Dropbox/org/notes.org" | |
org-directory "~/Dropbox/org" | |
org-archive-location "~/Dropbox/org/archive.org::" | |
org-mobile-inbox-for-pull "~/Dropbox/org/mobile.org" | |
org-export-async-init-file | |
(locate-user-emacs-file "lisp/org-async-init.el"))) | |
;; Files:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Todo/agenda][Todo/agenda:1]] | |
(d/with-eval-after-load 'org | |
(setq org-enforce-todo-dependencies t | |
org-log-done (quote time) | |
org-log-redeadline (quote time) | |
org-log-reschedule (quote time) | |
org-agenda-skip-scheduled-if-done t | |
org-agenda-skip-deadline-if-done t | |
org-agenda-hide-tags-regexp ".*" | |
org-agenda-span 'week) | |
(setq org-agenda-deadline-faces | |
'((1.0 . org-warning) | |
(0.5 . org-upcoming-deadline) | |
(0.0 . '(:foreground "#A89984")))) | |
(setq org-todo-keywords | |
'((sequence "TODO(t)" "IN-PROGRESS(p)" "WAITING(w)" "|" | |
"DONE(d)" "CANCELED(c)") | |
(sequence "READ(r)" "|" | |
"DONE(h)"))) | |
(setq org-capture-templates | |
'(("t" "Todo") | |
("ts" "Todo: School") | |
("te" "Todo: Emacs" entry | |
(file+olp org-default-notes-file "Emacs") | |
"* TODO %?") | |
("n" "Note") | |
("g" "Google calendar" entry | |
(file "~/Dropbox/org/gcal.org") "* %?\n\n%^T")))) | |
;; Todo/agenda:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Behavior/appearance][Behavior/appearance:1]] | |
(d/with-eval-after-load 'org | |
(setq org-insert-heading-respect-content t | |
org-src-window-setup 'current-window | |
org-list-demote-modify-bullet '(("-" . "*") | |
("*" . "+")) | |
org-export-in-background t | |
org-confirm-babel-evaluate nil | |
org-src-tab-acts-natively t | |
org-M-RET-may-split-line nil | |
org-list-use-circular-motion t | |
org-log-into-drawer t | |
org-imenu-depth 5 | |
org-goto-interface 'outline-path-completion | |
org-outline-path-complete-in-steps nil | |
org-link-search-must-match-exact-headline nil | |
org-confirm-elisp-link-function 'y-or-n-p | |
org-tags-exclude-from-inheritance '("crypt") | |
org-crypt-key "diegoamundo@protonmail.com" | |
org-confirm-elisp-link-not-regexp (concat "(\\(org-wiki-search" | |
"\\|describe-function" | |
"\\|describe-variable" | |
"\\).*?)")) | |
(org-babel-do-load-languages | |
'org-babel-load-languages | |
'((python . t) | |
(emacs-lisp . t) | |
(calc . t) | |
;; (ipython . t) | |
(shell . t) | |
(lisp . t) | |
(C . t) | |
(scheme . t))) | |
;; appearance | |
(setq org-src-fontify-natively t | |
org-src-preserve-indentation t | |
org-fontify-quote-and-verse-blocks t | |
org-hide-emphasis-markers t | |
org-startup-with-inline-images t | |
org-ellipsis " " | |
org-highlight-latex-and-related '(latex) | |
org-pretty-entities t | |
org-image-actual-width 500) | |
(mapc (lambda (arg) (setcdr arg (list (downcase (nth 1 arg))))) | |
org-structure-template-alist) | |
(add-to-list 'org-structure-template-alist | |
(list "sel" (concat "#+begin_src emacs-lisp\n" | |
"?\n" | |
"#+end_src"))) | |
(add-to-list 'org-structure-template-alist | |
(list "sp" (concat "#+begin_src python" | |
"?\n" | |
"#+end_src"))) | |
;; latex | |
(setq org-latex-listings t) | |
(add-to-list 'org-latex-packages-alist '("" "listings")) | |
(add-to-list 'org-latex-packages-alist '("" "color")) | |
(add-to-list 'org-latex-packages-alist '("" "tabularx"))) | |
;; Behavior/appearance:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Package][Package:1]] | |
(use-package org | |
:recipe (:host github | |
:repo "emacsmirror/org" | |
:files ("lisp/*.el" "contrib/lisp/*.el")) | |
:general | |
(nmap :keymaps 'org-mode-map | |
"<" 'org-metaleft | |
">" 'org-metaright | |
"gh" 'outline-up-heading | |
"gl" 'outline-next-visible-heading | |
"gj" 'org-forward-heading-same-level | |
"gk" 'org-backward-heading-same-level | |
"gt" 'org-todo | |
"ga" 'org-archive-subtree | |
"M-l" 'org-metaright | |
"M-h" 'org-metaleft | |
"M-k" 'org-metaup | |
"M-j" 'org-metadown | |
"M-L" 'org-shiftmetaright | |
"M-H" 'org-shiftmetaleft | |
"M-K" 'org-shiftmetaup | |
"M-J" 'org-shiftmetadown) | |
(d/leader-keys | |
"C" 'org-capture | |
"bo" 'org-iswitchb | |
"ao" '(:ignore t :wk "org") | |
"ao#" 'org-agenda-list-stuck-projects | |
"ao/" 'org-occur-in-agenda-files | |
"aoO" 'org-clock-out | |
"aoa" 'org-agenda-list | |
"aoe" 'org-store-agenda-views | |
"aol" 'org-store-link | |
"aom" 'org-store-tags-view | |
"aoo" 'org-agenda | |
"aos" 'org-search-view | |
"aot" 'org-todo-list ) | |
:init | |
(setq org-list-allow-alphabetical t) | |
:config | |
(require 'ox-extra) | |
(ox-extras-activate '(ignore-headlines)) | |
(require 'org-crypt) | |
(org-crypt-use-before-save-magic) | |
(require 'org-mobile)) | |
;; Package:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Variables][Variables:1]] | |
(defvar d/org-prettify-alist | |
(prettify-utils-generate | |
("TODO" "❯❯❯") | |
("READ" "❙❙❙") | |
("IN-PROGRESS" "○○○") | |
("WAITING" "■■■") | |
("CANCELED" "✗✗✗") | |
("DONE" "✓✓✓"))) | |
;; Variables:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Functions][Functions:1]] | |
(d/with-eval-after-load 'org | |
(defmacro d/create-block-wrap (&rest blocktypes) | |
`(progn | |
,@(cl-loop | |
for type in blocktypes collect | |
(let ((newfunc (intern | |
(concat "d/org-wrap-with-block-" | |
(replace-regexp-in-string " " "-" type))))) | |
`(defun ,newfunc () | |
(interactive) | |
(backward-paragraph) | |
(insert ,(format "\n#+begin_%s" type)) | |
(forward-paragraph) | |
(insert ,(format "#+end_%s\n" (car (split-string type)))) | |
(backward-paragraph)))))) | |
(d/create-block-wrap | |
"src" | |
"src python" | |
"src emacs-lisp" | |
"export latex") | |
(defmacro d/org-emphasize (&rest args) | |
"Make functions for setting the emphasis in org mode" | |
`(progn | |
,@(cl-loop for (name char) on args | |
by #'cddr collect | |
(let ((fname (intern (concat "d/org-" name)))) | |
`(defun ,fname () | |
(interactive) | |
(org-emphasize ,char)))))) | |
(d/org-emphasize | |
"bold" ?* | |
"italic" ?/ | |
"code" ?~ | |
"underline" ?_ | |
"verbatim" ?= | |
"strike-through" ?+ | |
"clear" ? ) | |
(defun d/org-agenda-toggle-date (current-line) | |
"Toggle `SCHEDULED' and `DEADLINE' tag in the capture buffer. | |
Source: https://git.io/vQK0I" | |
(interactive "P") | |
(save-excursion | |
(let ((search-limit (if current-line | |
(line-end-position) | |
(point-max)))) | |
(if current-line (beginning-of-line) | |
(goto-char (point-min))) | |
(if (search-forward "DEADLINE:" search-limit t) | |
(replace-match "SCHEDULED:") | |
(and (search-forward "SCHEDULED:" search-limit t) | |
(replace-match "DEADLINE:")))))) | |
(defun d/org-insert-list-leader-or-self (char) | |
"If on column 0, insert space-padded CHAR; otherwise insert CHAR. | |
This has the effect of automatically creating a properly indented list | |
leader; like hyphen, asterisk, or plus sign; without having to use | |
list-specific key maps. | |
Source: https://git.io/vQK0s" | |
(if (= (current-column) 0) | |
(insert (concat " " char " ")) | |
(insert char))) | |
(defun d/org-swap-tags (tags) | |
"Replace any tags on the current headline with TAGS. | |
The assumption is that TAGS will be a string conforming to Org Mode's | |
tag format specifications, or nil to remove all tags. | |
Source: https://git.io/vQKEE" | |
(let ((old-tags (org-get-tags-string)) | |
(tags (if tags | |
(concat " " tags) | |
""))) | |
(save-excursion | |
(beginning-of-line) | |
(re-search-forward | |
(concat "[ \t]*" (regexp-quote old-tags) "[ \t]*$") | |
(line-end-position) t) | |
(replace-match tags) | |
(org-set-tags t)))) | |
(defun d/org-set-tags (tag) | |
"Add TAG if it is not in the list of tags, remove it otherwise. | |
TAG is chosen interactively from the global tags completion table. | |
Source: https://git.io/vQKEa" | |
(interactive | |
(list (let ((org-last-tags-completion-table | |
(if (derived-mode-p 'org-mode) | |
(org-uniquify | |
(delq nil (append (org-get-buffer-tags) | |
(org-global-tags-completion-table)))) | |
(org-global-tags-completion-table)))) | |
(completing-read | |
"Tag: " 'org-tags-completion-function nil nil nil | |
'org-tags-history)))) | |
(let* ((cur-list (org-get-tags)) | |
(new-tags (mapconcat 'identity | |
(if (member tag cur-list) | |
(delete tag cur-list) | |
(append cur-list (list tag))) | |
":")) | |
(new (if (> (length new-tags) 1) (concat " :" new-tags ":") | |
nil))) | |
(d/org-swap-tags new))) | |
(defun d/org-choose-bullet-type () | |
"Change the bullet type for org lists with a prompt." | |
(interactive) | |
(let ((char (read-char-choice | |
"Bullet type? (-|*|+|1|2|a|b|A|B): " | |
'(?* ?- ?+ ?1 ?2 ?a ?b ?A ?B)))) | |
(pcase char | |
(?1 (org-cycle-list-bullet 3)) | |
(?2 (org-cycle-list-bullet 4)) | |
(?a (org-cycle-list-bullet 5)) | |
(?b (org-cycle-list-bullet 7)) | |
(?A (org-cycle-list-bullet 6)) | |
(?B (org-cycle-list-bullet 8)) | |
(_ (org-cycle-list-bullet (char-to-string char)))))) | |
(defun org-at-openable-item-p () | |
(when (eq major-mode 'org-mode) | |
(let* ((context (org-element-lineage | |
(org-element-context) | |
'(clock footnote-definition footnote-reference headline | |
inlinetask link timestamp) | |
t)) | |
(type (org-element-type context))) | |
(memq type '(footnote-definition | |
footnote-reference | |
headline inlinetask | |
link | |
timestamp))))) | |
(defun d/org-hugo-export () | |
"Export current subheading to markdown using pandoc." | |
(interactive) | |
;; Save cursor position | |
(save-excursion | |
;; Go to top level heading for subtree | |
(unless (eq (org-current-level) 1) | |
(org-up-heading-all 10)) | |
;; Set export format, pandoc options, post properties | |
(let* ((org-pandoc-format 'markdown) | |
(org-pandoc-options-for-markdown '((standalone . t) | |
(atx-headers . t) | |
(columns . 79))) | |
(hl (org-element-at-point)) | |
(filename (org-element-property :EXPORT_FILE_NAME hl)) | |
(title (format "\"%s\"" (org-element-property :title hl))) | |
(slug (format "\"%s\"" (org-element-property :SLUG hl))) | |
(date (format "\"%s\"" (org-element-property :DATE hl))) | |
(tags (org-get-tags-at)) | |
(categories | |
(format "[\"%s\"]" (mapconcat 'identity tags "\",\"")))) | |
(if (string= (org-get-todo-state) "DRAFT") | |
(message "Draft not exported") | |
(progn | |
;; Make the export | |
(org-export-to-file | |
'pandoc | |
(org-export-output-file-name | |
(concat (make-temp-name ".tmp") ".org") t) | |
nil t nil nil nil | |
(lambda (f) | |
(org-pandoc-run-to-buffer-or-file f 'markdown t nil))) | |
;; Use advice-add to add advice to existing process sentinel | |
;; to modify file /after/ the export process has finished. | |
(advice-add | |
#'org-pandoc-sentinel | |
:after | |
`(lambda (process event) | |
(with-temp-file ,filename | |
(insert-file-contents ,filename) | |
(goto-char (point-min)) | |
;; Remove default header | |
(re-search-forward "---\\(.\\|\n\\)+?---\n\n") | |
(replace-match "") | |
(goto-char (point-min)) | |
;; Insert new properties | |
(insert | |
(format | |
"---\ntitle: %s\nslug: %s\ndate: %s\ncategories: %s\n---\n\n" | |
,title ,slug ,date ,categories)) | |
;; Demote headings and tweak code blocks | |
(dolist (reps '(("^#" . "##") | |
("``` {\\.\\(.+?\\)}" . "```\\1"))) | |
(goto-char (point-min)) | |
(while (re-search-forward (car reps) nil t) | |
(replace-match (cdr reps)))))) | |
'((name . "hugo-advice"))) | |
;; We don't want our advice to stick around afterwards | |
(advice-remove #'org-pandoc-sentinel 'hugo-advice) | |
(when (string= (org-get-todo-state) "↑") | |
(org-todo)))))))) | |
;; Functions:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Turn%20this%20into%20an%20elisp%20function][Turn this into an elisp function:1]] | |
(d/with-eval-after-load 'org | |
(fset 'd/org-wrap-with-quote | |
[?\{ ?i return ?# ?+ ?b ?e ?g ?i ?n ?_ ?q ?u ?o ?t ?e ?\C-/ ?\} ?i return | |
up ?# ?+ ?e ?n ?d ?_ ?q ?u ?o ?t ?e ?\C-/ ?\{ ?j ?i ? ? ?\M-q | |
?\M-q ?\M-q ?\C-/])) | |
;; Turn this into an elisp function:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Bindings][Bindings:1]] | |
(d/mode-leader-keys | |
:keymaps 'org-mode-map | |
"$" 'org-archive-subtree | |
"'" 'org-edit-special | |
"." 'org-time-stamp | |
"/" 'org-sparse-tree | |
":" 'd/org-set-tags | |
"-" 'org-decrypt-entry | |
"A" 'org-archive-subtree | |
"N" 'widen | |
"P" 'org-set-property | |
"R" 'org-refile | |
"^" 'org-sort | |
"a" 'org-agenda | |
"c" 'org-capture | |
"d" 'org-deadline | |
"g" 'counsel-org-goto | |
"G" 'counsel-org-goto-all | |
"l" 'd/org-choose-bullet-type | |
"n" 'org-narrow-to-subtree | |
"s" 'org-schedule | |
"i" '(:ignore t :wk "insert") | |
"ic" 'org-table-insert-column | |
"ir" 'org-table-insert-row | |
"il" 'org-insert-link | |
"if" 'org-footnote-new | |
"id" 'org-insert-drawer | |
"e" '(:ignore t :wk "eval/export") | |
"ed" 'org-export-dispatch | |
"eh" 'd/org-hugo-export | |
"es" 'd/eval-surrounding-sexp | |
"er" 'eval-region | |
"eb" 'd/eval-buffer | |
"ef" 'd/eval-defun | |
"b" 'org-babel-tangle | |
"x" '(:ignore t :wk "text") | |
"xb" 'd/org-bold | |
"xi" 'd/org-italic | |
"xc" 'd/org-code | |
"xu" 'd/org-underline | |
"xv" 'd/org-verbatim | |
"xs" 'd/org-strike-through | |
"xr" 'd/org-clear | |
"xq" 'd/org-wrap-with-quote | |
"xx" 'org-cut-special | |
"xp" 'org-paste-special | |
;; tables | |
"t" '(:ignore t :wk "table") | |
"ta" 'org-table-align | |
"tb" 'org-table-blank-field | |
"tc" 'org-table-convert | |
"tdc" 'org-table-delete-column | |
"tdr" 'org-table-kill-row | |
"te" 'org-table-eval-formula | |
"tE" 'org-table-export | |
"th" 'org-table-previous-field | |
"tH" 'org-table-move-column-left | |
"tic" 'org-table-insert-column | |
"tih" 'org-table-insert-hline | |
"tiH" 'org-table-hline-and-move | |
"tir" 'org-table-insert-row | |
"tI" 'org-table-import | |
"tj" 'org-table-next-row | |
"tJ" 'org-table-move-row-down | |
"tK" 'org-table-move-row-up | |
"tl" 'org-table-next-field | |
"tL" 'org-table-move-column-right | |
"tn" 'org-table-create | |
"tN" 'org-table-create-with-table.el | |
"tr" 'org-table-recalculate | |
"ts" 'org-table-sort-lines | |
"ttf" 'org-table-toggle-formula-debugger | |
"tto" 'org-table-toggle-coordinate-overlays | |
"tw" 'org-table-wrap-region) | |
(d/with-eval-after-load 'org | |
(d/mode-leader-keys | |
:keymaps 'org-src-mode | |
:definer 'minor-mode | |
"'" 'org-edit-src-exit) | |
(d/leader-keys | |
:keymaps 'org-src-mode | |
:definer 'minor-mode | |
"fs" 'org-edit-src-save)) | |
;; Bindings:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Agenda][Agenda:1]] | |
(general-define-key :keymaps 'org-agenda-mode-map | |
"j" 'org-agenda-next-line | |
"k" 'org-agenda-previous-line | |
"n" 'org-agenda-next-date-line | |
"p" 'org-agenda-previous-date-line | |
"c" 'org-agenda-capture | |
"R" 'org-revert-all-org-buffers | |
"RET" 'org-agenda-switch-to) | |
(d/with-eval-after-load 'org-agenda | |
(setq org-habit-graph-column 50)) | |
(d/setup-mode org-agenda | |
(setq-local prettify-symbols-alist d/org-prettify-alist) | |
(prettify-symbols-mode)) | |
;; Agenda:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Capture][Capture:1]] | |
(imap :keymaps 'org-capture-mode-mop | |
"C-d" 'd/org-agenda-toggle-date) | |
(nmap :keymaps 'org-capture-mode-map | |
"C-d" 'd/org-agenda-toggle-date) | |
;; Capture:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Org][Org:1]] | |
(d/with-eval-after-load 'org | |
(dolist (char '("+" "-")) | |
(define-key org-mode-map (kbd char) | |
`(lambda () | |
(interactive) | |
(d/org-insert-list-leader-or-self ,char)))) | |
(setq org-bullets-bullet-list '("•"))) | |
(d/setup-mode org | |
(setq-local prettify-symbols-alist d/org-prettify-alist) | |
(prettify-symbols-mode) | |
;; (org-bullets-mode 1) | |
(goto-address-mode) | |
(org-indent-mode)) | |
;; Org:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/abo-abo/hydra%5D%5Bhydra%5D%5D][[[https://github.com/abo-abo/hydra][hydra]]:1]] | |
(use-package hydra | |
:config) | |
;; [[https://github.com/abo-abo/hydra][hydra]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/bbatsov/crux%5D%5Bcrux%5D%5D][[[https://github.com/bbatsov/crux][crux]]:1]] | |
(use-package crux | |
:defer 5 | |
:general | |
(d/leader-keys | |
"TAB" 'crux-switch-to-previous-buffer | |
"fd" 'crux-delete-file-and-buffer | |
"fr" 'crux-rename-file-and-buffer | |
"br" 'crux-sudo-edit ) | |
:commands (crux-with-region-or-line | |
crux-with-region-or-buffer | |
crux-switch-to-previous-buffer | |
crux-rename-file-and-buffer) | |
:config | |
(crux-with-region-or-line eval-region) | |
(crux-with-region-or-buffer indent-region) | |
(crux-with-region-or-buffer untabify) | |
(crux-with-region-or-buffer tabify) | |
(crux-with-region-or-buffer fill-region)) | |
;; [[https://github.com/bbatsov/crux][crux]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/company-mode/company-mode%5D%5Bcompany-mode%5D%5D][[[https://github.com/company-mode/company-mode][company-mode]]:1]] | |
(use-package company | |
:defer 5 | |
:general | |
(:keymaps 'company-active-map | |
[tab] 'company-complete-common-or-cycle) | |
:init | |
(setq company-idle-delay 0.3 | |
company-minimum-prefix-length 1 | |
company-selection-wrap-around t | |
company-dabbrev-char-regexp "\\sw\\|\\s_\\|[-_]") | |
:config | |
(defun company-mode/backend-with-yas (backend) | |
"Source: https://git.io/vQKE6" | |
(if (and (listp backend) (member 'company-yasnippet backend)) | |
backend | |
(append (if (consp backend) backend (list backend)) | |
'(:with company-yasnippet)))) | |
(setq company-backends (mapcar #'company-mode/backend-with-yas | |
company-backends)) | |
(global-company-mode t)) | |
;; [[https://github.com/company-mode/company-mode][company-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/justbur/emacs-which-key%5D%5Bemacs-which-key%5D%5D][[[https://github.com/justbur/emacs-which-key][emacs-which-key]]:1]] | |
(use-package which-key | |
:defer 10 | |
:general | |
(d/leader-keys | |
"hk" 'which-key-show-top-level) | |
:config | |
(which-key-mode) | |
(defmacro d/declare-prefix (&rest body) | |
(declare (indent defun)) | |
`(which-key-add-key-based-replacements | |
,@(cl-loop | |
for (prefix name) on body | |
by #'cddr | |
while name | |
append `(,(concat "SPC " prefix) ,name | |
,(concat "C-SPC " prefix) ,name)))) | |
(defmacro d/declare-mode-prefix (modes &rest body) | |
(declare (indent defun)) | |
(let ((modes (if (listp modes) modes (list modes)))) | |
`(progn | |
,@(cl-loop | |
for mode in modes collect | |
`(which-key-add-major-mode-key-based-replacements ',mode | |
,@(cl-loop | |
for (prefix name) on body | |
by #'cddr | |
while name | |
append `(,(concat ", " prefix) ,name | |
,(concat "C-, " prefix) ,name))))))) | |
(defmacro d/which-key-remove-prefix (&rest body) | |
(declare (indent defun)) | |
`(progn | |
,@(cl-loop for regexp in body collect | |
`(push '((nil . ,(concat regexp "\\(.+\\)")) . (nil . "\\1")) | |
which-key-replacement-alist)))) | |
(d/declare-prefix | |
"a" "applications" | |
"b" "buffer" | |
"f" "file" | |
"h" "help" | |
"hd" "describe" | |
"i" "insert" | |
"j" "jump" | |
"n" "narrow/numbers" | |
"q" "quit" | |
"s" "search" | |
"w" "window" | |
"xi" "indent" | |
"xl" "lines" | |
"SPC" "root") | |
(d/declare-mode-prefix (emacs-lisp-mode lisp-interaction-mode) | |
"e" "eval" | |
"p" "pp") | |
(setq which-key-sort-order 'which-key-key-order-alpha) | |
(setq which-key-sort-uppercase-first nil) | |
(d/which-key-remove-prefix | |
"avy-" | |
"counsel-" | |
"counsel-projectile-" | |
"crux-" | |
"customize-" | |
"d/" | |
"evil-mc-" | |
"evilnc-" | |
"eyebrowse-" | |
"eyebrowse-switch-to-" | |
"ivy-" | |
"magit-" | |
"projectile-")) | |
;; [[https://github.com/justbur/emacs-which-key][emacs-which-key]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/milkypostman/powerline%5D%5Bpowerline%5D%5D][[[https://github.com/milkypostman/powerline][powerline]]:1]] | |
(use-package powerline) | |
;; [[https://github.com/milkypostman/powerline][powerline]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Leader][Leader:1]] | |
(d/leader-keys | |
"qf" 'delete-frame | |
"qq" 'save-buffers-kill-emacs | |
"&" 'async-shell-command | |
":" 'eval-expression | |
"r" 'repeat | |
"u" 'universal-argument) | |
;; Leader:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*macOS%20fullscreen][macOS fullscreen:1]] | |
(when (eq system-type 'darwin) | |
(global-set-key (kbd "<s-return>") #'toggle-frame-fullscreen)) | |
;; macOS fullscreen:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Macros][Macros:1]] | |
(general-define-key | |
"<f11>" 'kmacro-start-macro-or-insert-counter | |
"<f12>" 'kmacro-end-or-call-macro) | |
;; Macros:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Minibuffer][Minibuffer:1]] | |
(general-define-key | |
:keymaps '(minibuffer-local-map | |
minibuffer-local-ns-map | |
minibuffer-local-completion-map | |
minibuffer-local-must-match-map | |
minibuffer-local-isearch-map) | |
[?\C-/] 'minibuffer-keyboard-quit | |
[?\C-_] 'minibuffer-keyboard-quit | |
[escape] 'minibuffer-keyboard-quit) | |
;; Minibuffer:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Ret][Ret:1]] | |
(mmap "RET" | |
(general-predicate-dispatch nil | |
(thing-at-point 'url) 'goto-address-at-point | |
(d/fbound-and-true-p org-at-openable-item-p) 'org-open-at-point | |
(d/fbound-and-true-p org-at-item-checkbox-p) 'org-toggle-checkbox | |
(d/fbound-and-true-p org-in-src-block-p) 'org-babel-execute-src-block)) | |
;; Ret:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*universal%20argument][universal argument:1]] | |
(general-define-key | |
:keymaps 'universal-argument-map | |
"SPC u" 'universal-argument-more) | |
;; universal argument:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Defaults][Defaults:1]] | |
(add-hook 'help-mode-hook #'goto-address-mode) | |
;; Defaults:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/abo-abo/define-word%5D%5Bdefine-word%5D%5D][[[https://github.com/abo-abo/define-word][define-word]]:1]] | |
(use-package define-word | |
:commands d/define-word | |
:general | |
(d/leader-keys "sw" 'd/define-word) | |
:config | |
(defun d/define-word (&optional word) | |
(interactive) | |
(if word | |
(define-word word) | |
(let ((word (read-string | |
(concat "Define word [" | |
(if (region-active-p) | |
(buffer-substring (region-beginning) (region-end)) | |
(thing-at-point 'word)) "]: ") | |
nil nil | |
(thing-at-point 'word)))) | |
(define-word word))))) | |
;; [[https://github.com/abo-abo/define-word][define-word]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/xuchunyang/devdocs.el%5D%5Bdevdocs%5D%5D][[[https://github.com/xuchunyang/devdocs.el][devdocs]]:1]] | |
(use-package devdocs | |
:general | |
(d/leader-keys "hdd" 'devdocs-search)) | |
;; [[https://github.com/xuchunyang/devdocs.el][devdocs]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/Malabarba/emacs-google-this%5D%5Bemacs-google-this%5D%5D][[[https://github.com/Malabarba/emacs-google-this][emacs-google-this]]:1]] | |
(use-package google-this | |
:commands ddg-this-search | |
:general | |
(d/leader-keys | |
"sd" 'ddg-this-search | |
"sg" 'google-this-search) | |
:config | |
(defun ddg-this-parse-and-search-string (text prefix &optional search-url) | |
"Convert illegal characters in TEXT to their %XX versions, and then duckduckgo. | |
PREFIX determines quoting. | |
Don't call this function directly, it could change depending on | |
version. Use `ddg-this-string' instead." | |
(let* (;; Create the url | |
(query-string (google-this--maybe-wrap-in-quotes text prefix)) | |
;; Perform the actual search. | |
(browse-result (funcall google-this-browse-url-function | |
(format (or search-url "https://duckduckgo.com/?q=%s") | |
(url-hexify-string query-string))))) | |
;; Maybe suspend emacs. | |
(when google-this-suspend-after-search (suspend-frame)) | |
;; Return what browse-url returned (very usefull for tests). | |
browse-result)) | |
(defun ddg-this-pick-term (prefix) | |
"Decide what \"this\" and return it. | |
PREFIX determines quoting." | |
(let* ((term (if (region-active-p) | |
(buffer-substring (region-beginning) (region-end)) | |
(or (thing-at-point 'symbol) | |
(thing-at-point 'word) | |
(buffer-substring (line-beginning-position) | |
(line-end-position))))) | |
(term (read-string (concat "DuckDuckGo [" term "]: ") nil nil term))) | |
term)) | |
(defun ddg-this-search (prefix &optional search-string) | |
"Write and do a DuckDuckGo search. | |
Interactively PREFIX determines quoting. | |
Non-interactively SEARCH-STRING is the string to search." | |
(interactive "P") | |
(let* ((term (ddg-this-pick-term prefix))) | |
(if (stringp term) | |
(ddg-this-parse-and-search-string term prefix search-string) | |
(message "[google-this-string] Empty query."))))) | |
;; [[https://github.com/Malabarba/emacs-google-this][emacs-google-this]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/atykhonov/google-translate%5D%5Bgoogle-translate%5D%5D][[[https://github.com/atykhonov/google-translate][google-translate]]:1]] | |
(use-package google-translate) | |
;; [[https://github.com/atykhonov/google-translate][google-translate]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://www.emacswiki.org/emacs/info+.el%5D%5Binfo+%5D%5D][[[https://www.emacswiki.org/emacs/info+.el][info+]]:1]] | |
(use-package info+) | |
;; [[https://www.emacswiki.org/emacs/info+.el][info+]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/vermiculus/sx.el/%5D%5Bsx%5D%5D][[[https://github.com/vermiculus/sx.el/][sx]]:1]] | |
(use-package sx) | |
;; [[https://github.com/vermiculus/sx.el/][sx]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/kuanyui/tldr.el%5D%5Btldr%5D%5D][[[https://github.com/kuanyui/tldr.el][tldr]]:1]] | |
(use-package tldr | |
:general | |
(d/leader-keys "ht" 'tldr) | |
(nmap :keymaps 'tldr-mode-map | |
"q" 'quit-window)) | |
;; [[https://github.com/kuanyui/tldr.el][tldr]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Bindings][Bindings:1]] | |
(d/leader-keys | |
"hc" '(:ignore t :wk "customize") | |
"hca" 'customize-apropos | |
"hcf" 'customize-face-other-window | |
"hcg" 'customize-group-other-window | |
"hcm" 'customize-mode | |
"hcv" 'customize-variable-other-window | |
"hdV" 'apropos-value | |
"hdc" 'describe-char | |
"hdk" 'describe-key | |
"hdm" 'describe-mode | |
"hdp" 'describe-package | |
"hds" 'describe-symbol | |
"hdt" 'describe-theme | |
"hm" 'man | |
"hn" 'view-emacs-news | |
"hs" 'system-name | |
"hv" 'version) | |
;; Bindings:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Defaults][Defaults:1]] | |
(setq ns-pop-up-frames nil) | |
;; Defaults:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Defaults][Defaults:2]] | |
(setq vc-follow-symlinks t) | |
;; Defaults:2 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Defaults][Defaults:3]] | |
(setq help-window-select t) | |
;; Defaults:3 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Defaults][Defaults:4]] | |
(add-hook 'before-save-hook #'whitespace-cleanup) | |
;; Defaults:4 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Defaults][Defaults:5]] | |
(d/with-eval-after-load 'dired | |
(autoload 'dired-async-mode "dired-async.el" nil t) | |
(dired-async-mode 1)) | |
;; Defaults:5 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/lunaryorn/osx-trash.el%5D%5Bosx-trash%5D%5D][[[https://github.com/lunaryorn/osx-trash.el][osx-trash]]:1]] | |
(use-package osx-trash | |
:defer 5 | |
:if (eq system-type 'darwin) | |
:config | |
(osx-trash-setup) | |
(setq delete-by-moving-to-trash t)) | |
;; [[https://github.com/lunaryorn/osx-trash.el][osx-trash]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://www.emacswiki.org/emacs/dired%25252b.el%5D%5Bdired+%5D%5D][[[https://www.emacswiki.org/emacs/dired%252b.el][dired+]]:1]] | |
(use-package dired+ | |
:after ranger) | |
;; [[https://www.emacswiki.org/emacs/dired%252b.el][dired+]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/ralesi/ranger.el%5D%5Branger%5D%5D][[[https://github.com/ralesi/ranger.el][ranger]]:1]] | |
(use-package ranger | |
:commands d/deer | |
:general | |
(d/leader-keys | |
"ad" 'd/deer | |
"ar" 'ranger) | |
:init | |
(require 'bookmark) | |
:config | |
(ranger-override-dired-mode t) | |
(setq ranger-show-literal nil | |
ranger-show-hidden nil | |
ranger-cleanup-eagerly t | |
ranger-parent-depth 0) | |
(define-advice ranger-travel (:override nil with-ivy) | |
"Use ivy for ranger-travel instead." | |
(interactive) | |
(cond | |
((featurep 'ivy) | |
(counsel-find-file default-directory)) | |
(t (call-interactively #'ido-find-file)))) | |
(defun d/deer (arg) | |
(interactive "P") | |
(if arg | |
(deer) | |
(deer-jump-other-window)))) | |
;; [[https://github.com/ralesi/ranger.el][ranger]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/bbatsov/projectile%5D%5Bprojectile%5D%5D][[[https://github.com/bbatsov/projectile][projectile]]:1]] | |
(use-package projectile | |
:general | |
(d/leader-keys | |
"p" '(:ignore t :wk "project") | |
"pg" 'projectile-vc | |
"pk" 'projectile-kill-buffers | |
"po" 'projectile-multi-occur | |
"pr" 'projectil-recentf) | |
:config | |
(setq projectile-globally-ignored-files '("TAGS" ".DS_Store") | |
projectile-ignored-projects '("/usr/local")) | |
(projectile-mode)) | |
;; [[https://github.com/bbatsov/projectile][projectile]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/ericdanan/counsel-projectile%5D%5Bcounsel-projectile%5D%5D][[[https://github.com/ericdanan/counsel-projectile][counsel-projectile]]:1]] | |
(use-package counsel-projectile | |
:commands d/project-find-file | |
:general | |
(d/leader-keys | |
"pb" 'counsel-projectile-switch-to-buffer | |
"pd" 'counsel-projectile-find-dir | |
"pf" 'counsel-projectile-find-file | |
"pp" 'counsel-projectile | |
"ps" 'counsel-projectile-switch-project) | |
:config | |
(defun d/project-find-file () | |
(interactive) | |
(condition-case nil | |
(counsel-git) | |
(error (counsel-projectile-find-file))))) | |
;; [[https://github.com/ericdanan/counsel-projectile][counsel-projectile]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/abo-abo/headlong%5D%5Bheadlong%5D%5D][[[https://github.com/abo-abo/headlong][headlong]]:1]] | |
(use-package headlong | |
:general | |
(d/leader-keys "fB" 'headlong-bookmark-jump-other | |
"fb" 'headlong-bookmark-jump) | |
:config | |
(bookmark-maybe-load-default-file)) | |
;; [[https://github.com/abo-abo/headlong][headlong]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*File%20Manipulation][File Manipulation:1]] | |
(defun d/copy-file () | |
"Copy file to another location. | |
Source: https://git.io/vQKES" | |
(interactive) | |
(call-interactively #'write-file)) | |
(defun d/safe-erase-buffer () | |
"Prompt before erasing buffer. | |
Source: https://git.io/vQKEd" | |
(interactive) | |
(if (y-or-n-p (format "Erase content of buffer %s ? " (current-buffer))) | |
(progn | |
(erase-buffer) | |
(message "Buffer erased.")) | |
(message "erase-buffer cancelled"))) | |
(defun d/download-file () | |
"Download a file from url to specified path." | |
(interactive) | |
(let* ((file-url (read-from-minibuffer "URL: ")) | |
(file-name | |
(read-from-minibuffer "File : " | |
(concat default-directory | |
(file-name-nondirectory file-url))))) | |
(url-copy-file file-url file-name))) | |
;; File Manipulation:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Switching][Switching:1]] | |
(defun d/switch-to-scratch () | |
"Switch to scratch buffer." | |
(interactive) | |
(switch-to-buffer "*scratch*")) | |
(defun d/switch-to-star () | |
"Switch to '*' buffers." | |
(interactive) | |
(let ((ivy-initial-inputs-alist '((ivy-switch-buffer . "^*")))) | |
(ivy-switch-buffer))) | |
(defun d/switch-to-customize () | |
"Switch to \"Customize\" buffers." | |
(interactive) | |
(let ((ivy-initial-inputs-alist '((ivy-switch-buffer . "^*customize ")))) | |
(ivy-switch-buffer))) | |
(defun d/switch-to-messages () | |
"Switch to *Messages* buffer." | |
(interactive) | |
(switch-to-buffer "*Messages*")) | |
;; Switching:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Narrowing][Narrowing:1]] | |
(defun d/narrow-and-set-normal () | |
"Narrow to the region and, if in a visual mode, set normal mode. | |
Source: https://git.io/vQKEx" | |
(interactive) | |
(narrow-to-region (region-beginning) (region-end)) | |
(if (string= evil-state "visual") | |
(progn (evil-normal-state nil) | |
(evil-goto-first-line)))) | |
(defun d/narrow-to-region-or-subtree () | |
"Narrow to a region, if set, otherwise to an Org subtree, if present. | |
Source: https://git.io/vQKuf" | |
(interactive) | |
(if (and mark-active | |
(not (= (region-beginning) (region-end)))) | |
(d/narrow-and-set-normal) | |
(if (derived-mode-p 'org-mode) | |
(org-narrow-to-subtree)))) | |
(defun d/narrow-dwim () | |
"Narrow to a thing or widen based on context. | |
Attempts to follow the Do What I Mean philosophy. | |
Source: https://git.io/vQKuU" | |
(interactive) | |
(if (buffer-narrowed-p) | |
(widen) | |
(d/narrow-to-region-or-subtree))) | |
;; Narrowing:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Bindings][Bindings:1]] | |
(d/leader-keys | |
"b*" 'd/switch-to-star | |
"bC" 'd/switch-to-customize | |
"bK" 'kill-buffer | |
"bM" 'd/switch-to-messages | |
"bR" 'revert-buffer | |
"bS" 'd/switch-to-scratch | |
"bc" 'clone-indirect-buffer-other-window | |
"be" 'd/safe-erase-buffer | |
"bi" 'ibuffer | |
"bk" 'kill-this-buffer | |
"bm" 'kill-matching-buffers | |
"bv" 'view-mode | |
"fc" 'd/copy-file | |
"fs" 'save-buffer | |
"nf" 'narrow-to-defun | |
"nn" 'd/narrow-dwim | |
"np" 'narrow-to-page | |
"nr" 'narrow-to-region) | |
;; Bindings:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Defaults][Defaults:1]] | |
(setq-default major-mode 'text-mode) | |
;; Defaults:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Defaults][Defaults:2]] | |
(setq-default fill-column 79) | |
(add-hook 'text-mode-hook 'auto-fill-mode) | |
;; Defaults:2 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Defaults][Defaults:3]] | |
(setq default-input-method "TeX") | |
;; Defaults:3 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Defaults][Defaults:4]] | |
(setq sentence-end-double-space nil) | |
;; Defaults:4 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Defaults][Defaults:5]] | |
(setq-default indent-tabs-mode nil | |
tab-width 4) | |
;; Defaults:5 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/abo-abo/auto-yasnippet%5D%5Bauto-yasnippet%5D%5D][[[https://github.com/abo-abo/auto-yasnippet][auto-yasnippet]]:1]] | |
(use-package auto-yasnippet) | |
;; [[https://github.com/abo-abo/auto-yasnippet][auto-yasnippet]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/gabesoft/evil-mc%5D%5Bevil-mc%5D%5D][[[https://github.com/gabesoft/evil-mc][evil-mc]]:1]] | |
(use-package evil-mc | |
:general | |
(nmap | |
"gr" '(:ignore t :wk "mc") | |
"grm" 'evil-mc-make-all-cursors | |
"gru" 'evil-mc-undo-all-cursors | |
"grs" 'evil-mc-pause-cursors | |
"grr" 'evil-mc-resume-cursors | |
"grf" 'evil-mc-make-and-goto-first-cursor | |
"grl" 'evil-mc-make-and-goto-last-cursor | |
"grh" 'evil-mc-make-cursor-here | |
"grj" 'evil-mc-make-cursor-move-next-line | |
"grk" 'evil-mc-make-cursor-move-prev-line | |
;; "M-n" 'evil-mc-skip-and-goto-next-cursor | |
"grN" 'evil-mc-make-and-goto-next-cursor | |
;; "M-p" 'evil-mc-skip-and-goto-prev-cursor | |
"grP" 'evil-mc-make-and-goto-prev-cursor | |
;; "C-n" 'evil-mc-skip-and-goto-next-match | |
"grn" 'evil-mc-make-and-goto-next-match | |
;; "C-p" 'evil-mc-skip-and-goto-prev-match | |
"grp" 'evil-mc-make-and-goto-prev-match) | |
:init | |
(setq evil-mc-key-map nil) | |
:config | |
(global-evil-mc-mode) | |
(push 'evil-smartparens-mode evil-mc-incompatible-minor-modes) | |
(push 'fci-mode evil-mc-incompatible-minor-modes)) | |
;; [[https://github.com/gabesoft/evil-mc][evil-mc]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/hlissner/evil-multiedit%5D%5Bevil-multiedit%5D%5D][[[https://github.com/hlissner/evil-multiedit][evil-multiedit]]:1]] | |
(use-package evil-multiedit | |
:config | |
(evil-ex-define-cmd "ie[dit]" 'evil-multiedit-ex-match)) | |
;; [[https://github.com/hlissner/evil-multiedit][evil-multiedit]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://www.emacswiki.org/emacs/FlySpell%5D%5Bflyspell%5D%5D][[[https://www.emacswiki.org/emacs/FlySpell][flyspell]]:1]] | |
(use-package flyspell | |
:config | |
(defun d/flyspell-correct-next () | |
(interactive "p") | |
(flyspell-goto-next-error) | |
(flyspell-auto-correct-word)) | |
(defun d/flyspell-add-to-dictionary () | |
"Add word at point to flyspell dictionary at `/Users/d/.ispell_english'. | |
Source: http://tinyurl.com/k8g9sex" | |
(interactive) | |
(let ((current-location (point)) | |
(word (flyspell-get-word))) | |
(when (consp word) | |
(flyspell-do-correct 'save | |
nil | |
(car word) | |
current-location | |
(cl-caddr word) | |
(cl-caddr word) | |
current-location))))) | |
(use-package flyspell-correct-ivy | |
:after flyspell) | |
;; [[https://www.emacswiki.org/emacs/FlySpell][flyspell]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/syohex/emacs-fontawesome%5D%5Bfontawesome%5D%5D][[[https://github.com/syohex/emacs-fontawesome][fontawesome]]:1]] | |
(use-package fontawesome) | |
;; [[https://github.com/syohex/emacs-fontawesome][fontawesome]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/nflath/hungry-delete%5D%5Bhungry-delete%5D%5D][[[https://github.com/nflath/hungry-delete][hungry-delete]]:1]] | |
(use-package hungry-delete | |
:defer 5 | |
:config | |
(global-hungry-delete-mode)) | |
;; [[https://github.com/nflath/hungry-delete][hungry-delete]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/Fuco1/smartparens%5D%5Bsmartparens%5D%5D][[[https://github.com/Fuco1/smartparens][smartparens]]:1]] | |
(use-package smartparens | |
:defer 5 | |
:config | |
(require 'smartparens-config) | |
(smartparens-global-mode) | |
(show-smartparens-global-mode) | |
(add-hook 'eval-expression-minibuffer-setup-hook #'smartparens-strict-mode) | |
(add-hook 'eval-expression-minibuffer-setup-hook #'show-smartparens-mode) | |
(let ((modes '(text-mode | |
org-mode | |
markdown-mode | |
minibuffer-inactive-mode | |
html-mode))) | |
(sp-local-pair modes "'" nil :actions nil) | |
(sp-local-pair modes "`" nil :actions nil)) | |
(defmacro d/sp-wrap-with (&rest args) | |
"Make function(s) for wrapping with character using `sp-wrap-with-pair'" | |
`(progn | |
,@(cl-loop for (char-name char) on args | |
by #'cddr collect | |
(let ((fname (intern (concat "d/sp-wrap-with-" char-name)))) | |
`(defun ,fname (&optional arg) | |
(interactive "P") | |
(sp-wrap-with-pair ,char)))))) | |
(d/sp-wrap-with | |
"paren" "(" | |
"curly" "{" | |
"double-quote" "\"" | |
"single-quote" "'")) | |
(use-package evil-smartparens | |
:after smartparens | |
:config | |
(add-hook 'smartparens-enabled-hook #'evil-smartparens-mode)) | |
;; [[https://github.com/Fuco1/smartparens][smartparens]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://www.emacswiki.org/emacs/UndoTree%5D%5Bundo-tree%5D%5D][[[https://www.emacswiki.org/emacs/UndoTree][undo-tree]]:1]] | |
(use-package undo-tree | |
:general | |
(d/leader-keys "au" 'undo-tree-visualize) | |
:config | |
(setq undo-tree-visualizer-timestamps t)) | |
;; [[https://www.emacswiki.org/emacs/UndoTree][undo-tree]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/purcell/unfill%5D%5Bunfill%5D%5D][[[https://github.com/purcell/unfill][unfill]]:1]] | |
(use-package unfill | |
:general | |
(d/leader-keys "xq" 'unfill-toggle) | |
([remap fill-paragraph] 'unfill-toggle)) | |
;; [[https://github.com/purcell/unfill][unfill]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/joaotavora/yasnippet%5D%5Byasnippet%5D%5D][[[https://github.com/joaotavora/yasnippet][yasnippet]]:1]] | |
(use-package yasnippet | |
:defer 5 | |
:general (d/leader-keys "iy" 'yas-insert-snippet) | |
:config | |
(yas-global-mode 1)) | |
;; [[https://github.com/joaotavora/yasnippet][yasnippet]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/haskell/haskell-snippets%5D%5Bhaskell-snippets%5D%5D][[[https://github.com/haskell/haskell-snippets][haskell-snippets]]:1]] | |
(use-package haskell-snippets) | |
;; [[https://github.com/haskell/haskell-snippets][haskell-snippets]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Move%20text][Move text:1]] | |
(defun d/transpose-chars (arg) | |
"Move character at point forward one character. | |
With prefix arg ARG, effect is to take character at point | |
and drag it forward past ARG other characters (backward if ARG negative)." | |
(interactive "P") | |
(forward-char) | |
(if arg | |
(transpose-chars arg) | |
(transpose-chars 1)) | |
(backward-char)) | |
(defun d/backward-transpose-chars (arg) | |
"Move character at point backward one character. | |
With prefix arg ARG, effect is to take character at point | |
and drag it backward past ARG other characters (backward if ARG negative)." | |
(interactive "P") | |
(forward-char) | |
(if arg | |
(transpose-chars (- arg)) | |
(transpose-chars -1)) | |
(backward-char)) | |
(defun d/backward-transpose-words (arg) | |
"Interchange words around point, leaving point at end of them. | |
With prefix arg ARG, effect is to take word before or around point | |
and drag it forward past ARG other words (backward if ARG negative). | |
If ARG is zero, the words around or after point and around or after mark | |
are interchanged." | |
(interactive "P") | |
(if arg | |
(transpose-words (- arg)) | |
(transpose-words -1))) | |
(defun d/move-line-or-region (arg) | |
"Move line or region down one one line. | |
With prefix arg ARG, effect is to take line at point and | |
drag it down past ARG other lines (up if ARG negative)." | |
(interactive "P") | |
(if (or (not arg) (>= arg 0)) | |
(let ((reg-or-lin (if (region-active-p) "'>" ".")) | |
(reactivate-region (if (region-active-p) "gv=gv" "")) | |
(num (if arg arg 1))) | |
(execute-kbd-macro | |
(concat ":m" reg-or-lin "+" (number-to-string num) (kbd "RET") reactivate-region))) | |
(d/backward-move-line-or-region (- arg)))) | |
(defun d/backward-move-line-or-region (arg) | |
"Move line or region up one one line. | |
With prefix arg ARG, effect is to take line at point and | |
drag it up past ARG other lines (down if ARG negative)." | |
(interactive "P") | |
(if (or (not arg) (>= arg 0)) | |
(let ((reg-or-lin (if (region-active-p) "'<" ".")) | |
(reactivate-region (if (region-active-p) "gv=gv" "")) | |
(num (if arg (+ arg 1) 2))) | |
(execute-kbd-macro | |
(concat ":m" reg-or-lin "-" (number-to-string num) (kbd "RET") reactivate-region))) | |
(d/move-line-or-region (- arg)))) | |
;; Move text:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Align][Align:1]] | |
(defun d/align-repeat (start end regexp &optional justify-right after) | |
"Repeat alignment with respect to the given regular expression. | |
If JUSTIFY-RIGHT is non nil justify to the right instead of the | |
left. If AFTER is non-nil, add whitespace to the left instead of | |
the right. | |
Source: https://git.io/vQKul" | |
(interactive "r\nsAlign regexp: ") | |
(let* ((ws-regexp (if (string-empty-p regexp) | |
"\\(\\s-+\\)" | |
"\\(\\s-*\\)")) | |
(complete-regexp (if after | |
(concat regexp ws-regexp) | |
(concat ws-regexp regexp))) | |
(group (if justify-right -1 1))) | |
(message "%S" complete-regexp) | |
(align-regexp start end complete-regexp group 1 t))) | |
(defmacro d/create-align-repeat-x (&rest args) | |
"Create an alignment function given name and alignment regexp. | |
Source: https://git.io/vQKu4" | |
`(progn | |
,@(cl-loop | |
for (name regexp justify-right default-after) on args | |
by #'cddddr collect | |
(let ((new-func (intern (concat "d/align-repeat-" name)))) | |
`(defun ,new-func (start end switch) | |
(interactive "r\nP") | |
(let ((after (not (eq (if switch t nil) (if ,default-after t nil))))) | |
(d/align-repeat start end ,regexp ,justify-right after))))))) | |
(d/create-align-repeat-x | |
"comma" "," nil t | |
"semicolon" ";" nil t | |
"colon" ":" nil t | |
"equal" "=" nil nil | |
"math-oper" "[+\\-*/]" nil nil | |
"ampersand" "&" nil nil | |
"bar" "|" nil nil | |
"left-paren" "(" nil nil | |
"right-paren" ")" t nil | |
"backslash" "\\\\" nil nil | |
"single-quote" "'" nil nil) | |
(defun d/align-repeat-decimal (start end) | |
"Align a table of numbers on decimal points and dollar signs (both optional). | |
Source: https://git.io/vQKu2" | |
(interactive "r") | |
(require 'align) | |
(align-region start end nil | |
'((nil (regexp . "\\([\t ]*\\)\\$?\\([\t ]+[0-9]+\\)\\.?") | |
(repeat . t) | |
(group 1 2) | |
(spacing 1 1) | |
(justify nil t))) | |
nil)) | |
;; Align:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Justify][Justify:1]] | |
(defmacro d/create-justify-x (&rest types) | |
"Create justification function(s), one per given TYPE." | |
`(progn | |
,@(cl-loop | |
for type in types collect | |
(let ((func-name (intern (concat "d/justify-" type))) | |
(current-type type)) | |
`(defun ,func-name () | |
(interactive) | |
(if (region-active-p) | |
(set-justification (region-beginning) | |
(region-end) | |
(intern ,current-type)) | |
(set-justification (line-beginning-position) | |
(line-end-position) | |
(intern ,current-type)))))))) | |
(d/create-justify-x | |
"left" | |
"right" | |
"full" | |
"center" | |
"none") | |
;; Justify:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Paragraph][Paragraph:1]] | |
(defun d/paragraphize () | |
"Remove newlines from region." | |
(interactive) | |
(if (region-active-p) | |
(flush-lines "^$" (region-beginning) (region-end)) | |
(message "No region active."))) | |
;; Paragraph:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Url][Url:1]] | |
(defun d/shorten-url-at-point () | |
"Shorten the url at point using the github url shortener or the TinyURL api. | |
Source: http://tinyurl.com/l8z7vph" | |
(interactive) | |
(if (thing-at-point 'url) | |
(let* ((long-url (thing-at-point 'url)) | |
(short-url | |
(cond ((save-match-data | |
(string-match "https://\\(github.com\\|gist.github.com\\)" long-url)) | |
(let ((info (shell-command-to-string | |
(format "curl -i \"https://git.io\" -F \"url=%s\"" | |
long-url)))) | |
(save-match-data | |
(and (string-match "Location: \\(.*?\\) " info) | |
(match-string 1 info))))) | |
(t | |
(shell-command-to-string | |
(format "curl -s \"http://tinyurl.com/api-create.php?url=%s\"" | |
(url-hexify-string long-url)))))) | |
(bounds (bounds-of-thing-at-point 'url))) | |
(kill-region (car bounds) (cdr bounds)) | |
(insert short-url)) | |
(error "No url at point."))) | |
(defun d/expand-url-at-point () | |
(interactive) | |
(if (thing-at-point 'url) | |
(let* ((short-url (thing-at-point 'url)) | |
(long-url (shell-command-to-string (format "curl -Ls -o /dev/null -w '%%{url_effective}' \"%s\"" | |
short-url))) | |
(bounds (bounds-of-thing-at-point 'url))) | |
(kill-region (car bounds) (cdr bounds)) | |
(insert long-url)) | |
(error "No url at point."))) | |
;; Url:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Multiedit][Multiedit:1]] | |
(d/with-eval-after-load 'hydra | |
(defhydra h/multiedit (:hint nil) | |
" | |
multiedit: | |
_r_estore _t_oggle/restrict match _a_ll | |
_n_ext match and _N_ext | |
_p_rev match and _P_rev | |
" | |
("a" evil-multiedit-match-all) | |
("n" evil-multiedit-next) | |
("p" evil-multiedit-prev) | |
("r" evil-multiedit-restore) | |
("t" evil-multiedit-toggle-or-restrict-region) | |
("N" evil-multiedit-match-and-next) | |
("P" evil-multiedit-match-and-prev) | |
("q" evil-multiedit-abort :exit t))) | |
;; Multiedit:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Transpose][Transpose:1]] | |
(d/with-eval-after-load 'hydra | |
(defhydra h/transpose () | |
"transpose" | |
("c" d/transpose-chars "char") | |
("C" d/backward-transpose-chars "backward char") | |
("j" d/move-line-or-region "line/region") | |
("k" d/backward-move-line-or-region "backward line/region") | |
("w" transpose-words "word") | |
("W" d/backward-transpose-words "backward word") | |
("s" transpose-sexps "sexp" :exit t))) | |
;; Transpose:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Justify][Justify:1]] | |
(d/with-eval-after-load 'hydra | |
(defhydra h/justify (:exit t) | |
"justify" | |
("r" d/justify-right "right") | |
("l" d/justify-left "left") | |
("c" d/justify-center "center") | |
("f" d/justify-full "full") | |
("n" d/justify-none "none"))) | |
;; Justify:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Smartparens][Smartparens:1]] | |
(d/with-eval-after-load 'hydra | |
(defhydra h/smartparens (:hint nil) | |
" | |
smartparens: | |
_r_ewrap _s_lurp _(_ | |
_u_nwrap _S_lurp (back) _[_ wrap _{_ | |
_b_arf _'_ _\"_ | |
_B_arf (back) | |
" | |
("r" sp-rewrap-sexp) | |
("u" sp-unwrap-sexp) | |
("b" sp-forward-barf-sexp) | |
("B" sp-backward-barf-sexp) | |
("s" sp-forward-slurp-sexp) | |
("S" sp-backward-slurp-sexp) | |
("(" d/sp-wrap-with-paren) | |
("[" d/sp-wrap-with-bracket) | |
("{" d/sp-wrap-with-curly) | |
("\"" d/sp-wrap-with-quote2) | |
("'" d/sp-wrap-with-quote))) | |
;; Smartparens:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Evil-numbers][Evil-numbers:1]] | |
(d/with-eval-after-load 'hydra | |
(defhydra h/numbers () | |
"evil-numbers" | |
("=" evil-numbers/inc-at-pt "inc") | |
("-" evil-numbers/dec-at-pt "dec"))) | |
;; Evil-numbers:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Spelling][Spelling:1]] | |
(d/with-eval-after-load 'hydra | |
(defhydra h/flyspell (:pre (require 'flyspell)) | |
"flyspell" | |
("b" flyspell-buffer "buffer") | |
("j" flyspell-goto-next-error "next") | |
("a" d/flyspell-add-to-dictionary "add to dict") | |
("n" flyspell-correct-next-word-generic "correct next generic") | |
("p" flyspell-correct-previous-word-generic "correct prev generic") | |
("N" d/flyspell-correct-next "correct next") | |
("P" flyspell-auto-correct-previous-word "correct pref"))) | |
;; Spelling:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Bindings][Bindings:1]] | |
(general-define-key :keymaps 'indent-rigidly-map | |
"h" 'indent-rigidly-left | |
"l" 'indent-rigidly-right | |
"H" 'indent-rigidly-left-to-tab-stop | |
"L" 'indent-rigidly-right-to-tab-stop) | |
;; Bindings:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Bindings][Bindings:2]] | |
(d/leader-keys | |
"n-" 'h/numbers/evil-numbers/dec-at-pt | |
"n=" 'h/numbers/evil-numbers/inc-at-pt | |
"x" '(:ignore t :wk "text") | |
"xa" '(:ignore t :wk "align") | |
"xa&" 'd/align-repeat-ampersand | |
"xa'" 'd/align-repeat-single-quote | |
"xa(" 'd/align-repeat-left-paren | |
"xa)" 'd/align-repeat-right-paren | |
"xa," 'd/align-repeat-comma | |
"xa." 'd/align-repeat-decimal | |
"xa:" 'd/align-repeat-colon | |
"xa;" 'd/align-repeat-semicolon | |
"xa=" 'd/align-repeat-equal | |
"xaa" 'align | |
"xac" 'align-current | |
"xam" 'd/align-repeat-math-oper | |
"xar" 'align-regexp | |
"xar" 'd/align-repeat | |
"xa|" 'd/align-repeat-bar | |
"xib" 'indent-buffer | |
"xii" 'indent-rigidly | |
"xir" 'indent-region | |
"xj" '(:command h/justify/body :wk "justify") | |
"xls" 'sort-lines | |
"xt" '(:command h/transpose/body :wk "transpose") | |
"xc" 'count-words | |
"xm" '(:command h/multiedit/body :wk "multiedit") | |
"xp" '(:command h/smartparens/body :wk "smartparens") | |
"xs" 'd/shorten-url-at-point | |
"xe" 'd/expand-url-at-point | |
"im" 'insert-kbd-macro) | |
;; Bindings:2 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/abo-abo/ace-window%5D%5Bace-window%5D%5D][[[https://github.com/abo-abo/ace-window][ace-window]]:1]] | |
(use-package ace-window | |
:general | |
(d/leader-keys | |
"\\" 'ace-window | |
"wD" 'ace-delete-window | |
"wS" 'ace-swap-window | |
"wa" 'ace-window) | |
:config | |
(setq aw-keys (string-to-list "aoeuidhtns"))) | |
;; [[https://github.com/abo-abo/ace-window][ace-window]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/abo-abo/avy%5D%5Bavy%5D%5D][[[https://github.com/abo-abo/avy][avy]]:1]] | |
(use-package avy | |
:general | |
(d/leader-keys | |
"jc" 'avy-goto-char-2 | |
"jl" 'avy-goto-line | |
"jw" 'avy-goto-word-1) | |
:config | |
(setq avy-keys (string-to-list "aoeuidhtns"))) | |
;; [[https://github.com/abo-abo/avy][avy]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/wasamasa/eyebrowse%5D%5Beyebrowse%5D%5D][[[https://github.com/wasamasa/eyebrowse][eyebrowse]]:1]] | |
(use-package eyebrowse | |
:commands (eyebrowse-switch-to-window-config | |
eyebrowse-next-window-config | |
eyebrowse-prev-window-config | |
eyebrowse-rename-window-config | |
eyebrowse-close-window-connfig | |
eyebrowse-close-window-config | |
eyebrowse-last-window-config | |
eyebrowse-switch-to-window-config-0 | |
eyebrowse-switch-to-window-config-1 | |
eyebrowse-switch-to-window-config-2 | |
eyebrowse-switch-to-window-config-3 | |
eyebrowse-switch-to-window-config-4 | |
eyebrowse-switch-to-window-config-5 | |
eyebrowse-switch-to-window-config-6 | |
eyebrowse-switch-to-window-config-7 | |
eyebrowse-switch-to-window-config-8 | |
eyebrowse-switch-to-window-config-9) | |
:general | |
("<f10>" 'eyebrowse-switch-to-window-config-0 | |
"<f1>" 'eyebrowse-switch-to-window-config-1 | |
"<f2>" 'eyebrowse-switch-to-window-config-2 | |
"<f3>" 'eyebrowse-switch-to-window-config-3 | |
"<f4>" 'eyebrowse-switch-to-window-config-4 | |
"<f5>" 'eyebrowse-switch-to-window-config-5 | |
"<f6>" 'eyebrowse-switch-to-window-config-6 | |
"<f7>" 'eyebrowse-switch-to-window-config-7 | |
"<f8>" 'eyebrowse-switch-to-window-config-8 | |
"<f9>" 'eyebrowse-switch-to-window-config-9) | |
(d/leader-keys | |
"e" '(:ignore t :wk "eyebrowse") | |
"es" 'eyebrowse-switch-to-window-config | |
"el" 'eyebrowse-next-window-config | |
"eh" 'eyebrowse-prev-window-config | |
"er" 'eyebrowse-rename-window-config | |
"ec" 'eyebrowse-close-window-config | |
"e'" 'eyebrowse-last-window-config | |
"e0" 'eyebrowse-switch-to-window-config-0 | |
"e1" 'eyebrowse-switch-to-window-config-1 | |
"e2" 'eyebrowse-switch-to-window-config-2 | |
"e3" 'eyebrowse-switch-to-window-config-3 | |
"e4" 'eyebrowse-switch-to-window-config-4 | |
"e5" 'eyebrowse-switch-to-window-config-5 | |
"e6" 'eyebrowse-switch-to-window-config-6 | |
"e7" 'eyebrowse-switch-to-window-config-7 | |
"e8" 'eyebrowse-switch-to-window-config-8 | |
"e9" 'eyebrowse-switch-to-window-config-9) | |
:config | |
(setq eyebrowse-wrap-around t | |
eyebrowse-new-workspace t | |
eyebrowse-switch-back-and-forth t) | |
(eyebrowse-mode)) | |
;; [[https://github.com/wasamasa/eyebrowse][eyebrowse]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/jacktasia/dumb-jump%5D%5Bdumb-jump%5D%5D][[[https://github.com/jacktasia/dumb-jump][dumb-jump]]:1]] | |
(use-package dumb-jump | |
:general | |
(d/leader-keys | |
"jE" 'dumb-jump-go-prefer-external-other-window | |
"jG" 'dumb-jump-go-other-window | |
"jb" 'dumb-jump-back | |
"je" 'dumb-jump-go-prefer-external | |
"jg" 'dumb-jump-go) | |
:config | |
(setq dumb-jump-selector 'ivy | |
dumb-jump-prefer-searcher 'rg)) | |
;; [[https://github.com/jacktasia/dumb-jump][dumb-jump]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/vspinu/imenu-anywhere%5D%5Bimenu-anywhere%5D%5D][[[https://github.com/vspinu/imenu-anywhere][imenu-anywhere]]:1]] | |
(use-package imenu-anywhere) | |
;; [[https://github.com/vspinu/imenu-anywhere][imenu-anywhere]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/syohex/emacs-zoom-window%5D%5Bzoom-window%5D%5D][[[https://github.com/syohex/emacs-zoom-window][zoom-window]]:1]] | |
(use-package zoom-window | |
:general | |
(d/leader-keys | |
"wz" 'zoom-window-zoom) | |
:config | |
(setq zoom-window-mode-line-color "#1D2021")) | |
;; [[https://github.com/syohex/emacs-zoom-window][zoom-window]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Functions][Functions:1]] | |
(defun d/toggle-window-split () | |
"Switch between vertical and horizontal window split. | |
Source: http://tinyurl.com/k7s96fa" | |
(interactive) | |
(if (= (count-windows) 2) | |
(let* ((this-win-buffer (window-buffer)) | |
(next-win-buffer (window-buffer (next-window))) | |
(this-win-edges (window-edges (selected-window))) | |
(next-win-edges (window-edges (next-window))) | |
(this-win-2nd (not (and (<= (car this-win-edges) | |
(car next-win-edges)) | |
(<= (cadr this-win-edges) | |
(cadr next-win-edges))))) | |
(splitter | |
(if (= (car this-win-edges) | |
(car (window-edges (next-window)))) | |
#'split-window-horizontally | |
#'split-window-vertically))) | |
(delete-other-windows) | |
(let ((first-win (selected-window))) | |
(funcall splitter) | |
(if this-win-2nd (other-window 1)) | |
(set-window-buffer (selected-window) this-win-buffer) | |
(set-window-buffer (next-window) next-win-buffer) | |
(select-window first-win) | |
(if this-win-2nd (other-window 1)))))) | |
(defun d/split-vert-focus () | |
"Split window vertically and move focus to other window." | |
(interactive) | |
(split-window-right) | |
(other-window 1)) | |
(defun d/split-horz-focus () | |
"Split window horizontally and move focus to other window." | |
(interactive) | |
(split-window-below) | |
(other-window 1)) | |
(defun d/move-splitter-left (arg) | |
"Move window splitter left. | |
Source: https://git.io/vQKuS" | |
(interactive "p") | |
(if (let ((windmove-wrap-around)) | |
(windmove-find-other-window 'right)) | |
(shrink-window-horizontally arg) | |
(enlarge-window-horizontally arg))) | |
(defun d/move-splitter-right (arg) | |
"Move window splitter right. | |
Source: https://git.io/vQKu7" | |
(interactive "p") | |
(if (let ((windmove-wrap-around)) | |
(windmove-find-other-window 'right)) | |
(enlarge-window-horizontally arg) | |
(shrink-window-horizontally arg))) | |
(defun d/move-splitter-up (arg) | |
"Move window splitter up. | |
Source: https://git.io/vQKu5" | |
(interactive "p") | |
(if (let ((windmove-wrap-around)) | |
(windmove-find-other-window 'up)) | |
(enlarge-window arg) | |
(shrink-window arg))) | |
(defun d/move-splitter-down (arg) | |
"Move window splitter down. | |
Source: https://git.io/vQKuF" | |
(interactive "p") | |
(if (let ((windmove-wrap-around)) | |
(windmove-find-other-window 'up)) | |
(shrink-window arg) | |
(enlarge-window arg))) | |
;; Functions:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Hydras][Hydras:1]] | |
(d/with-eval-after-load 'hydra | |
(defhydra h/splitter () | |
"splitter" | |
("h" d/move-splitter-left "←") | |
("j" d/move-splitter-down "↓") | |
("k" d/move-splitter-up "↑") | |
("l" d/move-splitter-right "→" ) | |
("=" balance-windows "balance"))) | |
;; Hydras:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Bindings][Bindings:1]] | |
(d/leader-keys | |
"jI" 'imenu-anywhere | |
"jf" 'find-function | |
"ji" 'imenu | |
"jv" 'find-variable | |
"wd" 'delete-window | |
"wf" 'make-frame | |
"wh" 'd/split-horz-focus | |
"wo" 'delete-other-windows | |
"ws" 'h/splitter/body | |
"wt" 'd/toggle-window-split | |
"wv" 'd/split-vert-focus) | |
;; Bindings:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/magit/magit%5D%5Bmagit%5D%5D][[[https://github.com/magit/magit][magit]]:1]] | |
(use-package magit | |
:general | |
(d/leader-keys | |
"g" '(:ignore t :wk "magit") | |
"gB" 'd/magit-blame-toggle | |
"gC" 'magit-clone | |
"gL" 'magit-log-buffer-file | |
"ga" 'magit-submodule-add | |
"gb" 'magit-branch | |
"gc" 'magit-checkout | |
"gf" 'magit-find-file | |
"gl" 'magit-log-all | |
"gs" 'magit-status) | |
:defines (magit-diff-use-overlays) | |
:config | |
(setq magit-diff-use-overlays nil | |
auto-revert-check-vc-info t | |
git-commit-summary-max-length 50 | |
git-commit-major-mode 'org-mode) | |
(add-hook 'git-commit-mode-hook #'evil-insert-state) | |
(d/setup-mode git-commit | |
(setq-local fill-column 72) | |
(setq-local org-hide-emphasis-markers nil))) | |
;; [[https://github.com/magit/magit][magit]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/emacs-evil/evil-magit%5D%5Bevil-magit%5D%5D][[[https://github.com/emacs-evil/evil-magit][evil-magit]]:1]] | |
(use-package evil-magit | |
:after magit) | |
;; [[https://github.com/emacs-evil/evil-magit][evil-magit]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/syohex/emacs-git-gutter-fringe%5D%5Bgit-gutter-fringe%5D%5D][[[https://github.com/syohex/emacs-git-gutter-fringe][git-gutter-fringe]]:1]] | |
(use-package git-gutter-fringe | |
:demand t | |
:commands fringe-helper-define | |
:config | |
(global-git-gutter-mode) | |
(add-hook 'focus-in-hook #'git-gutter:update-all-windows) | |
(fringe-helper-define 'git-gutter-fr:modified nil | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX") | |
(fringe-helper-define 'git-gutter-fr:added nil | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX") | |
(fringe-helper-define 'git-gutter-fr:deleted nil | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX" | |
"....XXXX")) | |
;; [[https://github.com/syohex/emacs-git-gutter-fringe][git-gutter-fringe]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/defunkt/gist.el%5D%5Bgist%5D%5D][[[https://github.com/defunkt/gist.el][gist]]:1]] | |
(use-package gist | |
:config | |
(let ((gh-vals (cdar gh-profile-alist))) | |
(setf gh-vals (plist-put gh-vals :username "therockmandolinist") | |
gh-vals (plist-put gh-vals :token (password-store-get "tokens/github/gist"))))) | |
;; [[https://github.com/defunkt/gist.el][gist]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Functions][Functions:1]] | |
(d/with-eval-after-load 'magit | |
(defun d/magit-blame-toggle () | |
"Toggle magit-blame-mode on and off interactively. | |
Source: https://git.io/vQKub" | |
(interactive) | |
(if (and (boundp 'magit-blame-mode) magit-blame-mode) | |
(magit-blame-quit) | |
(call-interactively 'magit-blame)))) | |
;; Functions:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Startup][Startup:1]] | |
(setq inhibit-splash-screen t | |
inhibit-startup-screen t | |
inhibit-startup-echo-area-message t) | |
;; Startup:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Gui%20elements][Gui elements:1]] | |
(menu-bar-mode 0) | |
(tool-bar-mode 0) | |
(scroll-bar-mode 0) | |
(setq custom-raised-buttons nil | |
use-dialog-box nil) | |
(blink-cursor-mode 0) | |
;; Gui elements:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Buffer%20display][Buffer display:1]] | |
(setq-default truncate-lines t) | |
(setq whitespace-style '(face trailing tabs)) | |
(global-whitespace-mode) | |
(setq whitespace-global-modes '(not erc-mode ses-mode)) | |
;; Buffer display:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Font][Font:1]] | |
(when window-system | |
(cond ((x-list-fonts "Iosevka Term") | |
(add-to-list 'default-frame-alist '(font . "Iosevka Term-9.5")) | |
(set-face-attribute 'default t :font "Iosevka Term-9.5")) | |
((x-list-fonts "Input") | |
(add-to-list 'default-frame-alist '(font . "Input-10")) | |
(set-face-attribute 'default t :font "Input-10")) | |
((x-list-fonts "Office Code Pro D") | |
(add-to-list 'default-frame-alist '(font . "Office Code Pro D-11")) | |
(set-face-attribute 'default t :font "Office Code Pro D-11")) | |
((x-list-fonts "Consolas") | |
(add-to-list 'default-frame-alist '(font . "Consolas-11")) | |
(set-face-attribute 'default t :font "Consolas-11")) | |
((x-list-fonts "Menlo") | |
(add-to-list 'default-frame-alist '(font . "Menlo-11")) | |
(set-face-attribute 'default t :font "Menlo-11"))) | |
;; Font:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Font][Font:2]] | |
(when (and window-system (x-list-fonts "FontAwesome")) | |
(set-fontset-font t 'unicode "FontAwesome" nil 'prepend))) | |
;; Font:2 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Minibuffer][Minibuffer:1]] | |
(add-hook 'minibuffer-setup-hook | |
(lambda () (setq-local cursor-type '(bar . 1)))) | |
;; Minibuffer:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Helpers][Helpers:1]] | |
(defun d/flycheck-lighter (state) | |
"Return flycheck information for the given error type STATE. | |
Source: https://git.io/vQKzv" | |
(let* ((counts (flycheck-count-errors flycheck-current-errors)) | |
(errorp (flycheck-has-current-errors-p state)) | |
(err (or (cdr (assq state counts)) "?")) | |
(running (eq 'running flycheck-last-status-change))) | |
(if (or errorp running) (format "•%s" err)))) | |
(defmacro d/with-window-status (&rest body) | |
(declare (indent defun)) | |
`(let ((window-active? (powerline-selected-window-active))) | |
(cl-flet ((propertize-active | |
(&rest arguments) | |
(let ((str (car arguments))) | |
(cond ((and window-active? (stringp str)) | |
(apply #'propertize arguments) ) | |
((stringp str) | |
(car arguments)))))) | |
,@body))) | |
(defmacro d/with-evil-tag-color (&rest body) | |
(declare (indent defun)) | |
`(let ((evil-tag-color | |
(pcase (substring-no-properties | |
evil-mode-line-tag) | |
(" N " "#B8BB26") | |
(" I " "#66999D") | |
(" M " "#D3869B") | |
(" V " "#FE8019") | |
(" E " "#FABD2F" ) | |
(" R " "#FE8019") | |
(" O " "#B8BB26")))) | |
,@body)) | |
(defun d/make-xpm (color height width) | |
"Create an XPM bitmap. | |
Source: https://git.io/vQKzL" | |
(propertize | |
" " 'display | |
(let ((data (make-list height (make-list width 1))) | |
(color (or color "None"))) | |
(create-image | |
(concat | |
(format "/* XPM */\nstatic char * percent[] = {\n\"%i %i 2 1\",\n\". c %s\",\n\" c %s\"," | |
(length (car data)) | |
(length data) | |
color | |
color) | |
(apply #'concat | |
(cl-loop with idx = 0 | |
with len = (length data) | |
for dl in data | |
do (cl-incf idx) | |
collect | |
(concat "\"" | |
(cl-loop for d in dl | |
if (= d 0) collect (string-to-char " ") | |
else collect (string-to-char ".")) | |
(if (eq idx len) "\"};" "\",\n"))))) | |
'xpm t :ascent 'center)))) | |
(defun d/eyebrowse-relevant-p () | |
(and (featurep 'eyebrowse) | |
(< 1 (length (eyebrowse--get 'window-configs))))) | |
(defun d/in-macro-p () | |
(or defining-kbd-macro executing-kbd-macro)) | |
(defun d/in-evil-substitution-p () | |
(or (assq 'evil-ex-substitute evil-ex-active-highlights-alist) | |
(assq 'evil-ex-global-match evil-ex-active-highlights-alist) | |
(assq 'evil-ex-buffer-match evil-ex-active-highlights-alist))) | |
(defun d/evil-substitute-num-matches () | |
"Return the number of matches for the current evil substitution. | |
Source: https://git.io/vQKzq" | |
(let ((range (if evil-ex-range | |
(cons (car evil-ex-range) (cadr evil-ex-range)) | |
(cons (line-beginning-position) (line-end-position)))) | |
(pattern (car-safe (evil-delimited-arguments evil-ex-argument 2)))) | |
(if pattern | |
(format "%s matches" (how-many pattern (car range) (cdr range))) | |
" ... "))) | |
;; Helpers:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Mode-line][Mode-line:1]] | |
(defvar d/mode-line | |
'((:eval | |
(d/with-evil-tag-color | |
(d/with-window-status | |
(cond ((and window-active? | |
(not (or (d/eyebrowse-relevant-p) | |
(bound-and-true-p anzu--state) | |
(d/in-macro-p) | |
(d/in-evil-substitution-p)))) | |
(d/make-xpm evil-tag-color 56 8)) | |
((not window-active?) | |
(d/make-xpm "#1D2021" 56 8)))))) | |
((:eval | |
(d/with-window-status | |
(d/with-evil-tag-color | |
(when window-active? | |
(propertize-active | |
(cond ((d/in-evil-substitution-p) | |
(d/evil-substitute-num-matches)) | |
((d/in-macro-p) | |
(if (bound-and-true-p evil-this-macro) | |
(char-to-string evil-this-macro) | |
"Macro")) | |
((bound-and-true-p anzu--state) | |
(anzu--update-mode-line)) | |
((d/eyebrowse-relevant-p) | |
(let* ((num (eyebrowse--get 'current-slot)) | |
(tag (nth 2 (assoc num (eyebrowse--get 'window-configs))))) | |
(if (and tag (< 0 (length tag))) | |
tag | |
(int-to-string num))))) | |
'face | |
`(:foreground | |
"#3E3D31" | |
:weight bold | |
:background ,evil-tag-color | |
:box (:color ,evil-tag-color :line-width 14)))))))) | |
;; File modified | |
" %* " | |
;; Buffer name & recursive editing | |
"%[" mode-line-buffer-identification "%] " | |
;; Remote | |
(:eval (d/with-window-status | |
(let ((host (file-remote-p default-directory 'host))) | |
(propertize-active | |
(cond ((and host | |
default-directory | |
(string= host (system-name))) | |
(concat "@" | |
(file-remote-p default-directory 'user) | |
" ")) | |
((and host default-directory) | |
(concat "@" host " "))) | |
'face | |
'(:foreground "#D3869B"))))) | |
;; Line/column number | |
(:eval (d/with-window-status | |
(propertize-active "%4l:%2c " | |
'face '(:foreground "#A89984")))) | |
;; Major mode | |
(:eval | |
(d/with-window-status | |
(propertize-active | |
(concat mode-name " ") | |
'face '(:foreground "#83A598" :weight bold)))) | |
;; Version control | |
(:eval | |
(d/with-window-status | |
(when vc-mode | |
(propertize-active | |
(concat (replace-regexp-in-string "^ Git." " " vc-mode) " ") | |
'face '(:foreground "#FE8019" ))))) | |
;; Flycheck | |
(:eval | |
(d/with-window-status | |
(when (and (bound-and-true-p flycheck-mode) | |
(or flycheck-current-errors | |
(eq 'running flycheck-last-status-change))) | |
(concat | |
(cl-loop for state in '((error . "#FB4933") | |
(warning . "#FABD2F") | |
(info . "#83A598")) | |
as lighter = (d/flycheck-lighter (car state)) | |
when lighter | |
concat (propertize-active | |
lighter | |
'face `(:foreground ,(cdr state)))) | |
" ")))) | |
;; Input method | |
(:eval | |
(d/with-window-status | |
(when (or current-input-method | |
(and (bound-and-true-p evil-mode) | |
(bound-and-true-p evil-input-method))) | |
(cond | |
(current-input-method | |
(propertize-active | |
(concat current-input-method-title " ") | |
'face | |
'bold)) | |
((and (featurep 'evil) (bound-and-true-p evil-input-method)) | |
(concat (nth 3 (assoc default-input-method input-method-alist)) | |
" ")))))) | |
erc-modified-channels-object)) | |
(setq-default mode-line-format d/mode-line) | |
(with-current-buffer "*Messages*" | |
(setq-local mode-line-format d/mode-line)) | |
;; Mode-line:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/larstvei/Focus%5D%5Bfocus%5D%5D][[[https://github.com/larstvei/Focus][focus]]:1]] | |
(use-package focus) | |
;; [[https://github.com/larstvei/Focus][focus]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttp://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/packages/rainbow-mode/rainbow-mode.el%5D%5Brainbow-mode%5D%5D][[[http://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/packages/rainbow-mode/rainbow-mode.el][rainbow-mode]]:1]] | |
(use-package rainbow-mode | |
:config | |
(setq rainbow-x-colors-major-mode-list '(c-mode c++-mode java-mode)) | |
(add-hook 'help-mode-hook #'rainbow-mode)) | |
;; [[http://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/packages/rainbow-mode/rainbow-mode.el][rainbow-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/therockmandolinist/emacs-theme-darktooth%5D%5Bdarktooth-theme%5D%5D][[[https://github.com/therockmandolinist/emacs-theme-darktooth][darktooth-theme]]:1]] | |
(use-package darktooth-theme | |
:demand t | |
:recipe (:host github | |
:repo "therockmandolinist/emacs-theme-darktooth" | |
:upstream (:host github | |
:repo "emacsfodder/emacs-theme-darktooth"))) | |
;; [[https://github.com/therockmandolinist/emacs-theme-darktooth][darktooth-theme]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/alpaker/Fill-Column-Indicator%5D%5Bfill-column-indicator%5D%5D][[[https://github.com/alpaker/Fill-Column-Indicator][fill-column-indicator]]:1]] | |
(use-package fill-column-indicator | |
:init | |
(setq-default fci-rule-column 79) | |
(defvar-local company-fci-mode-on-p nil) | |
(defun company-turn-off-fci (&rest _ignore) | |
(when (boundp 'fci-mode) | |
(setq company-fci-mode-on-p fci-mode) | |
(when fci-mode (fci-mode -1)))) | |
(defun company-maybe-turn-on-fci (&rest _ignore) | |
(when company-fci-mode-on-p (fci-mode 1))) | |
(add-hook 'company-completion-started-hook 'company-turn-off-fci) | |
(add-hook 'company-completion-finished-hook 'company-maybe-turn-on-fci) | |
(add-hook 'company-completion-cancelled-hook 'company-maybe-turn-on-fci)) | |
;; [[https://github.com/alpaker/Fill-Column-Indicator][fill-column-indicator]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/ankurdave/color-identifiers-mode%5D%5Bcolor-identifiers%5D%5D][[[https://github.com/ankurdave/color-identifiers-mode][color-identifiers]]:1]] | |
(use-package color-identifiers-mode) | |
;; [[https://github.com/ankurdave/color-identifiers-mode][color-identifiers]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/Fanael/highlight-numbers%5D%5Bhighlight-numbers%5D%5D][[[https://github.com/Fanael/highlight-numbers][highlight-numbers]]:1]] | |
(use-package highlight-numbers) | |
;; [[https://github.com/Fanael/highlight-numbers][highlight-numbers]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/tsdh/highlight-parentheses.el%5D%5Bhighlight-parentheses%5D%5D][[[https://github.com/tsdh/highlight-parentheses.el][highlight-parentheses]]:1]] | |
(use-package highlight-parentheses) | |
;; [[https://github.com/tsdh/highlight-parentheses.el][highlight-parentheses]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/Fanael/rainbow-delimiters%5D%5Brainbow-delimiters%5D%5D][[[https://github.com/Fanael/rainbow-delimiters][rainbow-delimiters]]:1]] | |
(use-package rainbow-delimiters) | |
;; [[https://github.com/Fanael/rainbow-delimiters][rainbow-delimiters]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Hydras][Hydras:1]] | |
(d/with-eval-after-load 'hydra | |
(defhydra h/zoom () | |
"zoom" | |
("=" text-scale-increase "in") | |
("-" text-scale-decrease "out") | |
("0" (text-scale-adjust 0) "reset"))) | |
;; Hydras:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Bindings][Bindings:1]] | |
(d/leader-keys | |
"z" '(:command h/zoom/body :wk "zoom")) | |
;; Bindings:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/Malabarba/aggressive-indent-mode/%5D%5Baggressive-indent%5D%5D][[[https://github.com/Malabarba/aggressive-indent-mode/][aggressive-indent]]:1]] | |
(use-package aggressive-indent) | |
;; [[https://github.com/Malabarba/aggressive-indent-mode/][aggressive-indent]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/flycheck/flycheck%5D%5Bflycheck%5D%5D][[[https://github.com/flycheck/flycheck][flycheck]]:1]] | |
(use-package flycheck | |
:config | |
(setq flycheck-completing-read-function 'ivy-completing-read) | |
(define-fringe-bitmap 'flycheck-fringe-bitmap-double-arrow | |
(vector #b00000000 | |
#b10000000 | |
#b11000000 | |
#b11100000 | |
#b11110000 | |
#b11111000 | |
#b11111100 | |
#b11111110 | |
#b11111111 | |
#b11111110 | |
#b11111100 | |
#b11111000 | |
#b11110000 | |
#b11100000 | |
#b11000000 | |
#b10000000 | |
#b00000000))) | |
;; [[https://github.com/flycheck/flycheck][flycheck]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Hydras][Hydras:1]] | |
(d/with-eval-after-load 'hydra | |
(defhydra h/flycheck | |
(:pre (progn | |
(flycheck-mode 1) | |
(setq hydra-lv t) | |
(flycheck-list-errors)) | |
:post (progn | |
(setq hydra-lv nil) | |
(quit-windows-on "*Flycheck errors*")) | |
:hint nil) | |
"Errors" | |
("f" flycheck-error-list-set-filter "Filter") | |
("j" flycheck-next-error "Next") | |
("k" flycheck-previous-error "Previous") | |
("gg" flycheck-first-error "First") | |
("G" (progn (goto-char (point-max)) (flycheck-previous-error)) "Last") | |
("q" nil))) | |
;; Hydras:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Bindings][Bindings:1]] | |
(d/mode-leader-keys | |
:keymaps 'prog-mode-map | |
"f" '(:command h/flycheck/body :wk "flycheck")) | |
;; Bindings:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Setup][Setup:1]] | |
(d/setup-mode prog | |
(subword-mode) | |
(smartparens-strict-mode) | |
(highlight-parentheses-mode 1) | |
(rainbow-delimiters-mode) | |
(goto-address-prog-mode) | |
(fci-mode) | |
(highlight-numbers-mode) | |
(d/rlines-mode) | |
(auto-fill-mode 1) | |
(setq-local comment-auto-fill-only-comments t) | |
(setq-local calc-embedded-open-mode (concat comment-start " ")) | |
(setq-local calc-embedded-close-mode (concat comment-end "\n")) | |
(hl-line-mode 1)) | |
;; Setup:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/proofit404/anaconda-mode%5D%5Banaconda-mode%5D%5D][[[https://github.com/proofit404/anaconda-mode][anaconda-mode]]:1]] | |
(use-package anaconda-mode) | |
;; [[https://github.com/proofit404/anaconda-mode][anaconda-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/proofit404/company-anaconda%5D%5Bcompany-anaconda%5D%5D][[[https://github.com/proofit404/company-anaconda][company-anaconda]]:1]] | |
(use-package company-anaconda | |
:after company) | |
;; [[https://github.com/proofit404/company-anaconda][company-anaconda]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/proofit404/pyenv-mode%5D%5Bpyenv-mode%5D%5D][[[https://github.com/proofit404/pyenv-mode][pyenv-mode]]:1]] | |
(use-package pyenv-mode | |
:config | |
(pyenv-mode)) | |
;; [[https://github.com/proofit404/pyenv-mode][pyenv-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/ssbb/pyenv-mode-auto%5D%5Bpyenv-mode-auto%5D%5D][[[https://github.com/ssbb/pyenv-mode-auto][pyenv-mode-auto]]:1]] | |
(use-package pyenv-mode-auto | |
:after pyenv-mode) | |
;; [[https://github.com/ssbb/pyenv-mode-auto][pyenv-mode-auto]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/naiquevin/sphinx-doc.el%5D%5Bsphinx-doc%5D%5D][[[https://github.com/naiquevin/sphinx-doc.el][sphinx-doc]]:1]] | |
(use-package sphinx-doc) | |
;; [[https://github.com/naiquevin/sphinx-doc.el][sphinx-doc]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/JorisE/yapfify%5D%5Byapfify%5D%5D][[[https://github.com/JorisE/yapfify][yapfify]]:1]] | |
(use-package yapfify) | |
;; [[https://github.com/JorisE/yapfify][yapfify]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Variables][Variables:1]] | |
(defvar d/python-prettify-alist | |
'(("<=" . "≤") | |
(">=" . "≥") | |
("!=" . "≠") | |
("is" . "≡") | |
("=" . "←") | |
("==" . "≣") | |
("not" . "¬") | |
("is not" . "≢") | |
("sum" . "∑") | |
("sqrt" . "√") | |
("pi" . "π") | |
("lambda" . "λ") | |
("and" . "⋏") | |
("or" . "⋎") | |
("self" . "↻") | |
("in" . "∈") | |
("def" . "ƒ") | |
("not in" . "∉") | |
("return" . "→") | |
("yield" . "⊢") | |
("None" . "∅") | |
("*" . "·") | |
("inf" . "∞") | |
("all" . "∀") | |
("^" . "⊻") | |
("**" . "^"))) | |
;; Variables:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Functions][Functions:1]] | |
(defun d/ipython-shell () | |
"Open an ipython shell using multi-term, respecting virtualenv." | |
(interactive) | |
(let ((sane-term-shell-command "ipython")) | |
(sane-term-create))) | |
;; Functions:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Setup][Setup:1]] | |
(d/setup-mode python | |
(set (make-local-variable 'comment-inline-offset) 2) | |
(flycheck-mode) | |
(anaconda-mode) | |
(anaconda-eldoc-mode) | |
(require 'company) | |
(add-to-list 'company-backends | |
(company-mode/backend-with-yas 'company-anaconda)) | |
(setq-local prettify-symbols-alist | |
d/python-prettify-alist)) | |
;; Setup:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/slime/slime%5D%5Bslime%5D%5D][[[https://github.com/slime/slime][slime]]:1]] | |
(use-package slime | |
:general | |
(imap :keymaps 'slime-repl-mode-map | |
[up] 'slime-repl-previous-input | |
[down] 'slime-repl-next-input) | |
:config | |
(setq inferior-lisp-program "/usr/local/bin/sbcl") | |
(setq slime-contribs '(slime-fancy slime-company))) | |
(use-package slime-company | |
:after slime) | |
;; [[https://github.com/slime/slime][slime]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/tkf/emacs-request%5D%5Brequest%5D%5D][[[https://github.com/tkf/emacs-request][request]]:1]] | |
(use-package request) | |
(use-package request-deferred) | |
;; [[https://github.com/tkf/emacs-request][request]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/magnars/s.el%5D%5Bs%5D%5D][[[https://github.com/magnars/s.el][s]]:1]] | |
(use-package s) | |
;; [[https://github.com/magnars/s.el][s]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/magnars/dash.el%5D%5Bdash%5D%5D][[[https://github.com/magnars/dash.el][dash]]:1]] | |
(use-package dash) | |
;; [[https://github.com/magnars/dash.el][dash]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/rejeep/f.el%5D%5Bf%5D%5D][[[https://github.com/rejeep/f.el][f]]:1]] | |
(use-package f) | |
;; [[https://github.com/rejeep/f.el][f]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/purcell/flycheck-package%5D%5Bflycheck-package%5D%5D][[[https://github.com/purcell/flycheck-package][flycheck-package]]:1]] | |
(use-package flycheck-package | |
:after flycheck | |
:config | |
(flycheck-package-setup)) | |
;; [[https://github.com/purcell/flycheck-package][flycheck-package]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/Wilfred/suggest.el%5D%5Bsuggest%5D%5D][[[https://github.com/Wilfred/suggest.el][suggest]]:1]] | |
(use-package suggest) | |
;; [[https://github.com/Wilfred/suggest.el][suggest]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Variables][Variables:1]] | |
(defvar d/lisp-prettify-alist | |
(prettify-utils-generate | |
("<=" "≤") | |
(">=" "≥") | |
("/=" "≠") | |
("eq" "≡") | |
("equal" "≣") | |
("sqrt" "√") | |
("float-pi" "π") | |
("lambda" "λ") | |
("and" "⋏") | |
("or" "⋎") | |
("defun" "ƒ") | |
("defmacro" "ƒₘ") | |
("not" "¬") | |
("nil" "∅"))) | |
;; Variables:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Functions][Functions:1]] | |
(defun d/eval-surrounding-sexp (levels) | |
"Eval sexp around point, specifying depth with LEVELS. | |
Source: http://tinyurl.com/le6wxuo" | |
(interactive "p") | |
(save-excursion | |
(sp-end-of-sexp (abs levels)) | |
(eval-last-sexp nil))) | |
(defun d/pp-eval-surrounding-sexp (levels) | |
"Replace the preceding sexp with its value. | |
Source: http://tinyurl.com/mh5ev6x" | |
(interactive "p") | |
(let (pp-escape-newlines) | |
(save-excursion | |
(sp-end-of-sexp (abs levels)) | |
(pp-eval-last-sexp nil)))) | |
(defun d/pp-macroexpand-surrounding-sexp (levels) | |
(interactive "p") | |
(let (pp-escape-newlines) | |
(save-excursion | |
(sp-end-of-sexp (abs levels)) | |
(pp-macroexpand-last-sexp nil)))) | |
(defun d/eval-buffer () | |
(interactive) | |
(if (eq major-mode 'org-mode) | |
(org-babel-execute-src-block) | |
(eval-buffer))) | |
(defun d/eval-defun () | |
(interactive) | |
(if (eq major-mode 'org-mode) | |
(progn | |
(when (org-in-src-block-p) | |
(org-edit-special) | |
(eval-defun nil) | |
(org-edit-src-exit))) | |
(eval-defun))) | |
(defmacro d/let (&rest clause) | |
(declare (indent defun)) | |
(pcase clause | |
((and `(,name ,vars . ,body) (guard (symbolp name))) | |
(let ((args (cl-loop for i in vars if (listp i) collect (car i) else collect i)) | |
(init-vals (cl-loop for i in vars if (listp i) append (cdr i) else collect nil))) | |
`(cl-labels ((,name ,args ,@body)) | |
(,name ,@init-vals)))) | |
(_ `(let ,@clause)))) | |
(defun d/lisp-indent-function (indent-point state) | |
"This function is the normal value of the variable `lisp-indent-function'. | |
The function `calculate-lisp-indent' calls this to determine | |
if the arguments of a Lisp function call should be indented specially. | |
INDENT-POINT is the position at which the line being indented begins. | |
Point is located at the point to indent under (for default indentation); | |
STATE is the `parse-partial-sexp' state for that position. | |
If the current line is in a call to a Lisp function that has a non-nil | |
property `lisp-indent-function' (or the deprecated `lisp-indent-hook'), | |
it specifies how to indent. The property value can be: | |
* `defun', meaning indent `defun'-style | |
\(this is also the case if there is no property and the function | |
has a name that begins with \"def\", and three or more arguments); | |
* an integer N, meaning indent the first N arguments specially | |
(like ordinary function arguments), and then indent any further | |
arguments like a body; | |
* a function to call that returns the indentation (or nil). | |
`lisp-indent-function' calls this function with the same two arguments | |
that it itself received. | |
This function returns either the indentation to use, or nil if the | |
Lisp function does not specify a special indentation. | |
Source: https://git.io/vQKz8" | |
(let ((normal-indent (current-column)) | |
(orig-point (point))) | |
(goto-char (1+ (elt state 1))) | |
(parse-partial-sexp (point) calculate-lisp-indent-last-sexp 0 t) | |
(cond | |
;; car of form doesn't seem to be a symbol, or is a keyword | |
((and (elt state 2) | |
(or (not (looking-at "\\sw\\|\\s_")) | |
(looking-at ":"))) | |
(if (not (> (save-excursion (forward-line 1) (point)) | |
calculate-lisp-indent-last-sexp)) | |
(progn (goto-char calculate-lisp-indent-last-sexp) | |
(beginning-of-line) | |
(parse-partial-sexp (point) | |
calculate-lisp-indent-last-sexp 0 t))) | |
;; Indent under the list or under the first sexp on the same | |
;; line as calculate-lisp-indent-last-sexp. Note that first | |
;; thing on that line has to be complete sexp since we are | |
;; inside the innermost containing sexp. | |
(backward-prefix-chars) | |
(current-column)) | |
((and (save-excursion | |
(goto-char indent-point) | |
(skip-syntax-forward " ") | |
(not (looking-at ":"))) | |
(save-excursion | |
(goto-char orig-point) | |
(looking-at ":"))) | |
(save-excursion | |
(goto-char (+ 2 (elt state 1))) | |
(current-column))) | |
(t | |
(let ((function (buffer-substring (point) | |
(progn (forward-sexp 1) (point)))) | |
method) | |
(setq method (or (function-get (intern-soft function) | |
'lisp-indent-function) | |
(get (intern-soft function) 'lisp-indent-hook))) | |
(cond ((or (eq method 'defun) | |
(and (null method) | |
(> (length function) 3) | |
(string-match "\\`def" function))) | |
(lisp-indent-defform state indent-point)) | |
((integerp method) | |
(lisp-indent-specform method state | |
indent-point normal-indent)) | |
(method | |
(funcall method indent-point state)))))))) | |
;; Functions:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Bindings][Bindings:1]] | |
(d/mode-leader-keys | |
:keymaps '(emacs-lisp-mode-map lisp-interaction-mode-map) | |
"eb" 'd/eval-buffer | |
"ef" 'eval-defun | |
"er" 'eval-region | |
"eR" 'd/eval-and-replace | |
"es" 'd/eval-surrounding-sexp | |
"el" 'eval-last-sexp | |
"pm" 'd/pp-macroexpand-surrounding-sexp | |
"ps" 'd/pp-eval-surrounding-sexp) | |
;; Bindings:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Setup][Setup:1]] | |
(d/setup-mode (lisp lisp-interaction emacs-lisp) | |
(hs-minor-mode) | |
(aggressive-indent-mode) | |
(push '(? . ("`" . "'")) evil-surround-pairs-alist) | |
(general-define-key | |
:keymaps 'local | |
"C-c <up>" 'hs-hide-all | |
"C-c <down>" 'hs-show-all | |
"C-c <left>" 'hs-hide-block | |
"C-c <right>" 'hs-show-block) | |
(setq-local lisp-indent-function #'d/lisp-indent-function) | |
(setq-local prettify-symbols-alist d/lisp-prettify-alist)) | |
;; Setup:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Setup][Setup:1]] | |
(d/setup-mode c | |
(aggressive-indent-mode)) | |
;; Setup:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/haskell/haskell-mode%5D%5Bhaskell-mode%5D%5D][[[https://github.com/haskell/haskell-mode][haskell-mode]]:1]] | |
(use-package haskell-mode | |
:mode "\\.hs\\'" | |
:config | |
(setq haskell-indentation-layout-offset 4 | |
haskell-indentation-left-offset 4 | |
haskell-indentation-ifte-offset 4)) | |
;; [[https://github.com/haskell/haskell-mode][haskell-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Variables][Variables:1]] | |
(defvar d/haskell-prettify-alist | |
'(("=>" . "⇒") | |
("forall" . "∀") | |
("->" . "→") | |
("<-" . "←") | |
("not" . "¬") | |
("lambda" . "λ"))) | |
;; Variables:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Setup][Setup:1]] | |
(d/setup-mode haskell | |
(setq-local prettify-symbols-alist d/haskell-prettify-alist)) | |
;; Setup:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/jaor/geiser%5D%5Bgeiser%5D%5D][[[https://github.com/jaor/geiser][geiser]]:1]] | |
(use-package geiser | |
:config | |
(setq geiser-active-implementations '(chicken))) | |
;; [[https://github.com/jaor/geiser][geiser]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Variables][Variables:1]] | |
(defvar d/scheme-prettify-alist | |
(prettify-utils-generate | |
("<=" "≤") | |
(">=" "≥") | |
("/=" "≠") | |
("eqv?" "≡") | |
("equal?" "≣") | |
("sqrt" "√") | |
("float-pi" "π") | |
("lambda" "λ") | |
("and" "⋏") | |
("or" "⋎") | |
("define" "ƒ") | |
("define-syntax" "ƒₛ") | |
("not" "¬") | |
("->" "→"))) | |
;; Variables:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Setup][Setup:1]] | |
(d/setup-mode scheme | |
(hs-minor-mode) | |
(aggressive-indent-mode) | |
(push '(? . ("`" . "'")) evil-surround-pairs-alist) | |
(general-define-key | |
:keymaps 'local | |
"C-c <up>" 'hs-hide-all | |
"C-c <down>" 'hs-show-all | |
"C-c <left>" 'hs-hide-block | |
"C-c <right>" 'hs-show-block) | |
(setq-local prettify-symbols-alist d/scheme-prettify-alist)) | |
;; Setup:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Setup][Setup:1]] | |
(d/setup-mode conf | |
(d/setup-prog-mode)) | |
(add-to-list 'auto-mode-alist '("\\.service\\'" . conf-mode)) | |
;; Setup:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Calc][Calc:1]] | |
(use-package calc | |
:ensure nil | |
:general | |
(d/leader-keys | |
"ac" 'calc-dispatch) | |
(emap :keymaps 'calc-mode-map | |
"x" (lambda () (interactive) (counsel-M-x "^calc-"))) | |
:config | |
(setq calc-multiplication-has-precedence nil) | |
(setq calc-symbolic-mode t)) | |
;; Calc:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Defaults][Defaults:1]] | |
(setq eshell-prefer-lisp-functions t | |
eshell-scroll-to-bottom-on-input t) | |
;; Defaults:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*egp][egp:1]] | |
(use-package egp | |
:ensure nil | |
:after eshell | |
:config | |
(setq eshell-highlight-prompt nil | |
eshell-prompt-function 'egp-theme)) | |
;; egp:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/xuchunyang/eshell-z%5D%5Beshell-z%5D%5D][[[https://github.com/xuchunyang/eshell-z][eshell-z]]:1]] | |
(use-package eshell-z | |
:after eshell) | |
;; [[https://github.com/xuchunyang/eshell-z][eshell-z]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/adamrt/sane-term%5D%5Bsane-term%5D%5D][[[https://github.com/adamrt/sane-term][sane-term]]:1]] | |
(use-package sane-term | |
:general (d/leader-keys "at" 'sane-term-create)) | |
;; [[https://github.com/adamrt/sane-term][sane-term]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Functions][Functions:1]] | |
(d/with-eval-after-load 'eshell | |
(defun d/eshell-run (str args) | |
(eshell-do-eval | |
(eshell-parse-command | |
(string-join (append `(,str) args) " ")) | |
t)) | |
(cl-defmacro d/eshell-defun (name &rest pats &key path opts &allow-other-keys) | |
(declare (indent defun)) | |
(let ((command-name (or path | |
(concat "/usr/bin/" (symbol-name name)))) | |
(pats (cl-loop for (key value) on pats by #'cddr | |
if (and value (not (keywordp key))) | |
append `(,key ,value) | |
else if (not (keywordp key)) collect key))) | |
`(defun ,(intern (concat "eshell/" (symbol-name name))) (&rest args) | |
(pcase args | |
,@(cl-loop for pattern in pats | |
if (listp (car pattern)) | |
collect pattern | |
else collect `('(,(car pattern)) | |
,(cadr pattern))) | |
(_ (d/eshell-run ,(concat command-name " " opts) | |
args)))))) | |
(defun eshell/clear () | |
"Custom `eshell' clear function to clear to top." | |
(interactive) | |
(let ((inhibit-read-only t)) | |
(erase-buffer))) | |
(defun eshell/cpg (&optional x) | |
(let* ((ghq-dirs | |
(split-string (shell-command-to-string "ghq list") | |
"\n" | |
t)) | |
(current (string-remove-prefix "/home/diego/.ghq/" (eshell/pwd))) | |
(current-pos (cl-position current ghq-dirs :test 'string=))) | |
(cond ((string= x "next") | |
(eshell/cd (concat "~/.ghq/" (nth (1+ current-pos) ghq-dirs)))) | |
((string= x "prev") | |
(eshell/cd (concat "~/.ghq/" (nth (1- current-pos) ghq-dirs)))) | |
(t | |
(ivy-read "[cpg] " | |
ghq-dirs | |
:action (lambda (x) | |
(eshell/cd (concat "~/.ghq/" x)))))))) | |
(defun eshell/cpwd () | |
(kill-new (eshell/pwd))) | |
(defun eshell/csi () | |
(call-interactively #'geiser)) | |
(defun eshell/sbcl () | |
(call-interactively #'slime)) | |
(d/eshell-defun git | |
:path "/home/diego/.zplug/bin/hub" | |
:opts "-c color.ui=always" | |
("status" (magit-status-internal (eshell/pwd))) | |
("diff" (magit-status-internal (eshell/pwd))) | |
("log" (call-interactively #'magit-log-current)) | |
(`("log" . ,ll) (magit-log ll))) | |
(d/eshell-defun pass | |
("rm" (call-interactively #'password-store-remove)) | |
("generate" (call-interactively #'password-store-generate)) | |
("insert" (call-interactively #'password-store-insert)) | |
("mv" (call-interactively #'password-store-rename)) | |
("edit" (call-interactively #'password-store-edit)) | |
("cp" (call-interactively #'password-store-copy)) | |
("-c" (call-interactively #'password-store-copy)) | |
(`("edit" . ,ll) (password-store-edit ll))) | |
(defun eshell/rg (&rest args) | |
(eshell-grep "rg" (push "--no-heading" args)) | |
(other-window 1)) | |
(defun eshell/cool-peco-ps () | |
(interactive) | |
(let ((ps (split-string | |
(shell-command-to-string | |
"ps axco user,pid,%cpu,%mem,start,time,command") | |
"\n" | |
t))) | |
(ivy-read "[ps] " | |
ps | |
:action (lambda (x) | |
(insert (cadr (split-string x " " t)))))))) | |
;; Functions:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Text][Text:1]] | |
(d/mode-leader-keys | |
:keymap 'text-mode-map | |
"f" '(:command h/flyspell/body :wk "flyspell")) | |
;; Text:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*json][json:1]] | |
(d/setup-mode json | |
(highlight-numbers-mode -1)) | |
;; json:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Defaults][Defaults:1]] | |
(d/with-eval-after-load 'erc | |
(setq erc-prompt " | |
❱❱" | |
erc-fill-prefix " " | |
erc-notice-prefix " *** " | |
erc-format-nick-function 'd/erc-format-nick | |
erc-nick "diegs_" | |
erc-password (password-store-get "social/freenode") | |
erc-prompt-for-password nil | |
erc-hide-timestamps t | |
erc-input-line-position -1 | |
erc-autojoin-timing 'ident | |
erc-header-line-format nil | |
erc-fill-column 79 | |
erc-hide-list '("353") | |
erc-lurker-threshold-time (* 6 60 60) | |
erc-lurker-hide-list '("JOIN" "PART" "QUIT" "NICK") | |
erc-kill-buffer-on-part t | |
erc-kill-queries-on-quit t | |
erc-kill-server-buffer-on-quit t | |
erc-rename-buffers t | |
erc-join-buffer 'bury | |
erc-track-use-faces nil | |
erc-track-priority-faces-only 'all | |
erc-track-exclude-server-buffer t | |
erc-format-query-as-channel-p t | |
erc-track-faces-priority-list '(erc-error-face | |
erc-current-nick-face | |
erc-keyword-face | |
erc-nick-msg-face | |
erc-direct-msg-face | |
erc-dangerous-host-face) | |
erc-autojoin-channels-alist '(("freenode.net" | |
"#emacs" | |
"#gaygeeks" | |
"##linux" | |
"#zsh" | |
"#python" | |
"##programming" | |
"#i3" | |
"#lisp" | |
"#chicken"))) | |
(erc-define-catalog-entry 'english 'ACTION " * %n %a")) | |
;; Defaults:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Packages][Packages:1]] | |
(use-package erc | |
:ensure nil | |
:general | |
(d/mode-leader-keys | |
:keymaps 'erc-mode-map | |
"g" (lambda () (interactive) (let ((ivy-use-virtual-buffers nil)) (erc-switch-to-buffer)))) | |
(d/leader-keys | |
"ai" 'd/erc) | |
(imap :keymaps 'erc-mode-map | |
[up] 'erc-previous-command | |
[down] 'erc-next-command) | |
:config | |
(add-hook 'window-configuration-change-hook #'d/erc-to-bottom)) | |
;; Packages:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/leathekd/erc-hl-nicks%5D%5Berc-hl-nicks%5D%5D][[[https://github.com/leathekd/erc-hl-nicks][erc-hl-nicks]]:1]] | |
(use-package erc-hl-nicks | |
:recipe (:host github | |
:repo "therockmandolinist/erc-hl-nicks" | |
:upstream (:host github | |
:repo "leathekd/erc-hl-nicks")) | |
:after erc | |
:config | |
(setq erc-hl-nicks-skip-nicks '("diegs")) | |
(setq erc-lurker-ignore-chars erc-hl-nicks-ignore-chars) | |
(push "erc-current-nick-face" erc-hl-nicks-skip-faces)) | |
;; [[https://github.com/leathekd/erc-hl-nicks][erc-hl-nicks]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Variables][Variables:1]] | |
(d/with-eval-after-load 'erc | |
(defvar d/erc-last-speaker (make-hash-table :test 'equal)) | |
(setq erc-lurker-state (make-hash-table :test 'equal))) | |
;; Variables:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Functions][Functions:1]] | |
(d/with-eval-after-load 'erc | |
(defmacro d/erc-nick-format-function-body (cond nick &optional else) | |
`(if ,cond | |
(let* ((nick ,nick) | |
(trimmed (erc-hl-nicks-trim-irc-nick nick)) | |
(server (erc-canonicalize-server-name | |
erc-server-announced-name))) | |
(unless (gethash server d/erc-last-speaker) | |
(puthash server (make-hash-table :test 'equal) d/erc-last-speaker)) | |
(let* ((channel (buffer-name)) | |
(mode (erc-get-user-mode-prefix nick)) | |
(nick-was-last (string= | |
(gethash channel | |
(gethash server d/erc-last-speaker)) | |
nick)) | |
(long-char (if (and (> (length nick) 10) | |
(not nick-was-last)) | |
(erc-propertize "…" 'face '(:foreground "#D3869B" )) | |
" "))) | |
(when (>= (cl-incf erc-lurker-cleanup-count) | |
erc-lurker-cleanup-interval) | |
(setq erc-lurker-cleanup-count 0) | |
(erc-lurker-cleanup)) | |
(unless (gethash server erc-lurker-state) | |
(puthash server (make-hash-table :test 'equal) erc-lurker-state)) | |
(puthash trimmed (current-time) | |
(gethash server erc-lurker-state)) | |
(puthash channel nick (gethash server d/erc-last-speaker)) | |
(format "%10.10s%s " | |
(cond (nick-was-last | |
(erc-propertize | |
"↳" | |
'face | |
(gethash trimmed erc-hl-nicks-face-table))) | |
((not (member trimmed erc-hl-nicks-skip-nicks)) | |
(concat | |
(erc-propertize mode 'face 'erc-nick-prefix-face) | |
(erc-propertize nick 'face (erc-hl-nicks-make-face trimmed)))) | |
(t | |
(concat | |
(erc-propertize mode 'face 'erc-nick-prefix-face) | |
nick))) | |
long-char))) | |
,else)) | |
(defun d/erc-format-nick (&optional user channel-data) | |
"Truncate nick when too long, substitute when repeated speaker, and | |
update lurker status." | |
(d/erc-nick-format-function-body | |
user | |
(erc-server-user-nickname user))) | |
(define-advice erc-format-my-nick (:override nil truncate-substitute-lurk) | |
"Truncate nick when too long, substitute when repeated speaker, and | |
update lurker status." | |
(d/erc-nick-format-function-body | |
erc-show-my-nick | |
(erc-current-nick) | |
(let ((prefix "> ")) | |
(erc-propertize prefix 'font-lock-face 'erc-default-face)))) | |
(define-advice erc-format-privmessage (:override (nick msg privp msgp) no-brackets) | |
"Remove the annoying angle brackets." | |
(let* ((mark-s (if msgp (if privp "*" "") " -")) | |
(mark-e (if msgp (if privp "*" "") "- ")) | |
(str (format "%s%s%s%s" mark-s nick mark-e msg)) | |
(nick-face (if privp 'erc-nick-msg-face 'erc-nick-default-face)) | |
(msg-face (if privp 'erc-direct-msg-face 'erc-default-face))) | |
;; add text properties to text before the nick, the nick and after the nick | |
(erc-put-text-property 0 (length mark-s) 'font-lock-face msg-face str) | |
(erc-put-text-property (length mark-s) (+ (length mark-s) (length nick)) | |
'font-lock-face nick-face str) | |
(erc-put-text-property (+ (length mark-s) (length nick)) (length str) | |
'font-lock-face msg-face str) | |
str)) | |
(define-advice erc-track-find-face (:around (fn faces) promote-query) | |
"Promote query buffers as if everything contains current nick. | |
Source: http://tinyurl.com/y8tj8vxx" | |
(if (erc-query-buffer-p) | |
(setq ad-return-value (intern "erc-current-nick-face")) | |
(funcall fn faces))) | |
(define-advice erc-track-modified-channels (:around (fn) promote-query) | |
"Promote query buffers as if everything contains current nick when | |
only tracking priority faces. | |
Source: http://tinyurl.com/y8tj8vxx" | |
(when (erc-query-buffer-p) (setq erc-track-priority-faces-only nil)) | |
(funcall fn) | |
(when (erc-query-buffer-p) (setq erc-track-priority-faces-only 'all))) | |
(define-advice erc-notifications-notify (:override (nick msg) channel-title) | |
"Use channel as notification title and remove erc-fill-prefix." | |
(let ((server (erc-canonicalize-server-name | |
erc-server-announced-name)) | |
(channel (buffer-name)) | |
(msg (string-join | |
(cdr (split-string | |
(replace-regexp-in-string erc-fill-prefix "" msg) | |
" " | |
t | |
" ")) " "))) | |
(dbus-ignore-errors | |
(setq erc-notifications-last-notification | |
(notifications-notify :bus erc-notifications-bus | |
:title (xml-escape-string (format "%s@%s" channel server)) | |
:body (xml-escape-string (format "%s: %s" nick msg)) | |
:replaces-id erc-notifications-last-notification | |
:app-icon erc-notifications-icon))))) | |
(defun d/erc-to-bottom () | |
(and (eq major-mode 'erc-mode) | |
(erc-scroll-to-bottom)))) | |
;; Functions:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Setup][Setup:1]] | |
(d/setup-mode erc | |
(erc-hl-nicks-mode 1) | |
(smartparens-mode -1) | |
(erc-stamp-mode -1) | |
(erc-notifications-mode 1) | |
(evil-smartparens-mode -1) | |
(show-smartparens-mode -1) | |
(erc-move-to-prompt-mode 1)) | |
;; Setup:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttp://elpa.gnu.org/packages/csv-mode.html%5D%5Bcsv-mode%5D%5D][[[http://elpa.gnu.org/packages/csv-mode.html][csv-mode]]:1]] | |
(use-package csv-mode | |
:mode "\\.csv\\'" | |
:config | |
(add-hook 'csv-mode-hook #'csv-align-fields)) | |
;; [[http://elpa.gnu.org/packages/csv-mode.html][csv-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/Kitware/CMake%5D%5Bcmake-mode%5D%5D][[[https://github.com/Kitware/CMake][cmake-mode]]:1]] | |
(use-package cmake-mode) | |
;; [[https://github.com/Kitware/CMake][cmake-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttp://jblevins.org/projects/markdown-mode/%5D%5Bmarkdown-mode%5D%5D][[[http://jblevins.org/projects/markdown-mode/][markdown-mode]]:1]] | |
(use-package markdown-mode | |
:mode "\\.md\\'" | |
:config) | |
;; [[http://jblevins.org/projects/markdown-mode/][markdown-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/yoshiki/yaml-mode%5D%5Byaml-mode%5D%5D][[[https://github.com/yoshiki/yaml-mode][yaml-mode]]:1]] | |
(use-package yaml-mode | |
:mode "\\.yml\\'") | |
;; [[https://github.com/yoshiki/yaml-mode][yaml-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/clojure-emacs/clojure-mode%5D%5Bclojure-mode%5D%5D][[[https://github.com/clojure-emacs/clojure-mode][clojure-mode]]:1]] | |
(use-package clojure-mode) | |
;; [[https://github.com/clojure-emacs/clojure-mode][clojure-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/joshwnj/json-mode%5D%5Bjson-mode%5D%5D][[[https://github.com/joshwnj/json-mode][json-mode]]:1]] | |
(use-package json-mode | |
:mode "\\.json\\'") | |
;; [[https://github.com/joshwnj/json-mode][json-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/defunkt/coffee-mode%5D%5Bcoffee-mode%5D%5D][[[https://github.com/defunkt/coffee-mode][coffee-mode]]:1]] | |
(use-package coffee-mode | |
:mode "\\.coffee\\'") | |
;; [[https://github.com/defunkt/coffee-mode][coffee-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/millejoh/emacs-ipython-notebook%5D%5BEIN%5D%5D][[[https://github.com/millejoh/emacs-ipython-notebook][EIN]]:1]] | |
(use-package ein) | |
;; [[https://github.com/millejoh/emacs-ipython-notebook][EIN]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/immerrr/lua-mode%5D%5Blua-mode%5D%5D][[[https://github.com/immerrr/lua-mode][lua-mode]]:1]] | |
(use-package lua-mode) | |
;; [[https://github.com/immerrr/lua-mode][lua-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/mcandre/vimrc-mode%5D%5Bvimrc-mode%5D%5D][[[https://github.com/mcandre/vimrc-mode][vimrc-mode]]:1]] | |
(use-package vimrc-mode) | |
;; [[https://github.com/mcandre/vimrc-mode][vimrc-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/politza/pdf-tools%5D%5Bpdf-tools%5D%5D][[[https://github.com/politza/pdf-tools][pdf-tools]]:1]] | |
;; (use-package pdf-tools | |
;; ;; :defer-install t | |
;; :defer 10 | |
;; :general | |
;; (nmap :keymaps 'pdf-view-mode-map | |
;; "s" 'pdf-view-fit-width-to-window | |
;; "a" 'pdf-view-fit-height-to-window | |
;; "/" 'isearch-forward | |
;; "J" 'pdf-view-next-page | |
;; "K" 'pdf-view-previous-page | |
;; "j" 'pdf-view-next-line-or-next-page | |
;; "k" 'pdf-view-previou-line-or-previous-page | |
;; "-" 'pdf-view-shrink | |
;; "+" 'pdf-view-enlarg) | |
;; :config | |
;; (pdf-tools-install)) | |
;; [[https://github.com/politza/pdf-tools][pdf-tools]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/fxbois/web-mode%5D%5Bweb-mode%5D%5D][[[https://github.com/fxbois/web-mode][web-mode]]:1]] | |
(use-package web-mode | |
:mode ("\\.html?\\'" "\\.xml\\'" "\\.launch\\'") | |
:config | |
(setq web-mode-markup-indent-offset 2)) | |
;; [[https://github.com/fxbois/web-mode][web-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/therockmandolinist/turing-machine%5D%5Bturing-machine%5D%5D][[[https://github.com/therockmandolinist/turing-machine][turing-machine]]:1]] | |
(use-package turing-machine) | |
;; [[https://github.com/therockmandolinist/turing-machine][turing-machine]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/purcell/disable-mouse%5D%5Bdisable-mouse%5D%5D][[[https://github.com/purcell/disable-mouse][disable-mouse]]:1]] | |
(use-package disable-mouse | |
:demand t | |
:config | |
(global-disable-mouse-mode) | |
(dolist (key '([mouse-1] | |
[mouse-2] | |
[mouse-4] | |
[mouse-5] | |
[mouse-6] | |
[mouse-7] | |
[down-mouse-1] | |
[drag-mouse-1] | |
[wheel-right] | |
[double-wheel-right] | |
[triple-wheel-right] | |
[wheel-left] | |
[double-wheel-left] | |
[triple-wheel-left] | |
[wheel-down] | |
[double-wheel-down] | |
[triple-wheel-down] | |
[wheel-up] | |
[double-wheel-up] | |
[triple-wheel-up])) | |
(define-key evil-motion-state-map key #'ignore))) | |
;; [[https://github.com/purcell/disable-mouse][disable-mouse]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/lewang/flx%5D%5Bflx%5D%5D][[[https://github.com/lewang/flx][flx]]:1]] | |
(use-package flx) | |
;; [[https://github.com/lewang/flx][flx]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/nonsequitur/smex%5D%5Bsmex%5D%5D][[[https://github.com/nonsequitur/smex][smex]]:1]] | |
(use-package smex) | |
;; [[https://github.com/nonsequitur/smex][smex]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/Fanael/persistent-scratch%5D%5Bpersistent-scratch%5D%5D][[[https://github.com/Fanael/persistent-scratch][persistent-scratch]]:1]] | |
(use-package persistent-scratch | |
:defer 10 | |
:config | |
(persistent-scratch-setup-default)) | |
;; [[https://github.com/Fanael/persistent-scratch][persistent-scratch]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/iqbalansari/restart-emacs%5D%5Brestart-emacs%5D%5D][[[https://github.com/iqbalansari/restart-emacs][restart-emacs]]:1]] | |
(use-package restart-emacs | |
:general (d/leader-keys "qr" 'restart-emacs) | |
:init | |
(evil-ex-define-cmd "qr[estart]" 'restart-emacs)) | |
;; [[https://github.com/iqbalansari/restart-emacs][restart-emacs]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/Malabarba/paradox%5D%5Bparadox%5D%5D][[[https://github.com/Malabarba/paradox][paradox]]:1]] | |
(use-package paradox | |
:general | |
(d/leader-keys "ap" 'paradox-list-packages) | |
(nmap :keymaps 'paradox-menu-mode-map | |
"(" 'package-menu-toggle-hiding | |
"?" 'package-menu-describe-package | |
"F" 'package-menu-filter | |
"RET" 'paradox-push-button | |
"S*" 'paradox-sort-by-★ | |
"Sp" 'paradox-sort-by-package | |
"Ss" 'paradox-sort-by-status | |
"TAB" 'forward-button | |
"U" 'package-menu-mark-upgrades | |
"d" 'package-menu-mark-delete | |
"f" 'hydra-paradox-filter/body | |
"i" 'package-menu-mark-install | |
"q" 'paradox-quit-and-close | |
"r" 'package-menu-refresh | |
"u" 'package-menu-mark-unmark | |
"vh" 'paradox-menu-visit-homepage | |
"vl" 'paradox-menu-view-commit-list | |
"x" 'paradox-menu-execute | |
"~" 'package-menu-mark-obsolete-for-deletion | |
[backtab] 'backward-button) | |
:config | |
(setq paradox-execute-asynchronously t | |
paradox-github-token (password-store-get "tokens/github/paradox") | |
paradox-automatically-star nil)) | |
;; [[https://github.com/Malabarba/paradox][paradox]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://git.zx2c4.com/password-store/tree/contrib/emacs%5D%5Bpassword-store%5D%5D][[[https://git.zx2c4.com/password-store/tree/contrib/emacs][password-store]]:1]] | |
(use-package password-store | |
:config | |
(setq password-store-password-length 20)) | |
;; [[https://git.zx2c4.com/password-store/tree/contrib/emacs][password-store]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/jschaf/esup%5D%5Besup%5D%5D][[[https://github.com/jschaf/esup][esup]]:1]] | |
(use-package esup | |
:config | |
(setq esup-insignificant-time 0.001)) | |
;; [[https://github.com/jschaf/esup][esup]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://www.emacswiki.org/emacs/centered-cursor-mode.el%5D%5Bcentered-cursor-mode%5D%5D][[[https://www.emacswiki.org/emacs/centered-cursor-mode.el][centered-cursor-mode]]:1]] | |
(use-package centered-cursor-mode) | |
;; [[https://www.emacswiki.org/emacs/centered-cursor-mode.el][centered-cursor-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/Silex/elmacro%5D%5Belmacro%5D%5D][[[https://github.com/Silex/elmacro][elmacro]]:1]] | |
(use-package elmacro | |
:disabled t | |
:defer 10 | |
:config | |
(elmacro-mode)) | |
;; [[https://github.com/Silex/elmacro][elmacro]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*toggle][toggle:1]] | |
(d/with-eval-after-load 'hydra | |
(defhydra h/toggle | |
(:pre (progn | |
(defvar flycheck-mode nil) | |
(defvar focus-mode nil) | |
(defvar d/show-async-tangle-results nil)) | |
:color pink | |
:timeout 1 | |
:hint nil) | |
" | |
_a_ abbrev: %-3s`abbrev-mode _d_ debug-on-error: %-3s`debug-on-error _P_ prettify-symbols: %-3s`prettify-symbols-mode | |
_i_ aggressive-indent: %-3s`aggressive-indent-mode _l_ rlines: %-3s`d/rlines-mode _F_ focus: %-3s`focus-mode | |
_c_ column-indicator: %-3s`fci-mode _p_ smartparens: %-3s`smartparens-mode _z_ async-tangle-results: %-3s`d/show-async-tangle-results | |
_f_ flycheck: %-3s`flycheck-mode _e_ evil-smartparens: %-3s`evil-smartparens-mode | |
_s_ flyspell: %-3s`flyspell-mode _w_ global-whitespace: %-3s`global-whitespace-mode | |
" | |
("a" abbrev-mode nil) | |
("i" aggressive-indent-mode nil) | |
("d" toggle-debug-on-error nil) | |
("c" fci-mode nil) | |
("l" d/rlines-mode nil) | |
("p" smartparens-mode nil) | |
("P" prettify-symbols-mode nil) | |
("e" evil-smartparens-mode nil) | |
("f" flycheck-mode nil) | |
("F" focus-mode nil) | |
("s" flyspell-mode nil) | |
("w" global-whitespace-mode nil) | |
("z" (if d/show-async-tangle-results | |
(setq d/show-async-tangle-results nil) | |
(setq d/show-async-tangle-results t)) nil) | |
("q" nil))) | |
;; toggle:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Bindings][Bindings:1]] | |
(d/leader-keys | |
"t" '(:command h/toggle/body :wk "toggle")) | |
(nmap :keymaps 'custom-mode-map | |
"q" #'Custom-buffer-done) | |
(evil-add-hjkl-bindings occur-mode-map 'emacs | |
(kbd "/") 'evil-search-forward | |
(kbd "n") 'evil-search-next | |
(kbd "N") 'evil-search-previous | |
(kbd "C-d") 'evil-scroll-down | |
(kbd "C-u") 'evil-scroll-up | |
(kbd "C-w C-w") 'other-window) | |
;; Bindings:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/syohex/emacs-evil-anzu%5D%5Bevil-anzu%5D%5D][[[https://github.com/syohex/emacs-evil-anzu][evil-anzu]]:1]] | |
(use-package evil-anzu | |
:after evil | |
:config | |
(setq anzu-cons-mode-line-p nil) | |
(defun d/anzu-update-mode-line (here total) | |
(when anzu--state | |
(let ((status (cl-case anzu--state | |
(search (format "%s/%d%s" | |
(anzu--format-here-position here total) | |
total (if anzu--overflow-p "+" ""))) | |
(replace-query (format "(%d replace)" total)) | |
(replace (format "(%d/%d)" here total))))) | |
status))) | |
(setq anzu-mode-line-update-function #'d/anzu-update-mode-line)) | |
;; [[https://github.com/syohex/emacs-evil-anzu][evil-anzu]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/TheBB/evil-indent-plus%5D%5Bevil-indent-plus%5D%5D][[[https://github.com/TheBB/evil-indent-plus][evil-indent-plus]]:1]] | |
(use-package evil-indent-plus | |
:after evil | |
:config | |
(evil-indent-plus-default-bindings)) | |
;; [[https://github.com/TheBB/evil-indent-plus][evil-indent-plus]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/redguardtoo/evil-matchit%5D%5Bevil-matchit%5D%5D][[[https://github.com/redguardtoo/evil-matchit][evil-matchit]]:1]] | |
(use-package evil-matchit | |
:after evil | |
:config (global-evil-matchit-mode 1)) | |
;; [[https://github.com/redguardtoo/evil-matchit][evil-matchit]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/redguardtoo/evil-nerd-commenter%5D%5Bevil-nerd-commenter%5D%5D][[[https://github.com/redguardtoo/evil-nerd-commenter][evil-nerd-commenter]]:1]] | |
(use-package evil-nerd-commenter | |
:commands (evilnc-comment-operator | |
d/comment-or-uncomment-lines-inverse) | |
:general | |
(nmap | |
"gc" 'evilnc-comment-operator | |
"gy" 'evilnc-copy-and-comment-lines) | |
(d/leader-keys | |
";" 'evilnc-comment-operator | |
"c" '(:ignore t :wk "comment") | |
"ci" 'd/comment-or-uncomment-lines-inverse | |
"cl" 'evilnc-comment-or-uncomment-lines | |
"cp" 'evilnc-comment-or-uncomment-paragraphs | |
"ct" 'evilnc-comment-or-uncomment-to-the-line | |
"cy" 'evilnc-copy-and-comment-lines) | |
:config | |
(defun d/comment-or-uncomment-lines-inverse (&optional arg) | |
"Source: https://git.io/vQKza" | |
(interactive "p") | |
(let ((evilnc-invert-comment-line-by-line t)) | |
(evilnc-comment-or-uncomment-lines arg)))) | |
;; [[https://github.com/redguardtoo/evil-nerd-commenter][evil-nerd-commenter]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/therockmandolinist/evil-numbers%5D%5Bevil-numbers%5D%5D][[[https://github.com/therockmandolinist/evil-numbers][evil-numbers]]:1]] | |
(use-package evil-numbers | |
:recipe (:host github | |
:repo "therockmandolinist/evil-numbers" | |
:upstream (:host github | |
:repo "cofi/evil-numbers"))) | |
;; [[https://github.com/therockmandolinist/evil-numbers][evil-numbers]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/emacs-evil/evil-surround%5D%5Bevil-surround%5D%5D][[[https://github.com/emacs-evil/evil-surround][evil-surround]]:1]] | |
(use-package evil-surround | |
:after evil | |
:config | |
(global-evil-surround-mode 1)) | |
;; [[https://github.com/emacs-evil/evil-surround][evil-surround]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/cute-jumper/evil-embrace.el%5D%5Bevil-embrace%5D%5D][[[https://github.com/cute-jumper/evil-embrace.el][evil-embrace]]:1]] | |
(use-package evil-embrace | |
:after evil-surround | |
:config | |
(add-hook 'org-mode-hook 'embrace-org-mode-hook) | |
(evil-embrace-enable-evil-surround-integration)) | |
;; [[https://github.com/cute-jumper/evil-embrace.el][evil-embrace]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/kawabata/ox-pandoc%5D%5Box-pandoc%5D%5D][[[https://github.com/kawabata/ox-pandoc][ox-pandoc]]:1]] | |
(use-package ox-pandoc | |
:after ox | |
:config | |
;; default options for all output formats | |
(setq org-pandoc-options '((standalone . t) | |
(latex-engine . xelatex) | |
(mathjax . t) | |
(parse-raw . t))) | |
;; cancel above settings only for 'docx' format | |
(setq org-pandoc-options-for-docx '((standalone . nil)))) | |
;; [[https://github.com/kawabata/ox-pandoc][ox-pandoc]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/marsmining/ox-twbs%5D%5Box-twbs%5D%5D][[[https://github.com/marsmining/ox-twbs][ox-twbs]]:1]] | |
(use-package ox-twbs | |
:after ox) | |
;; [[https://github.com/marsmining/ox-twbs][ox-twbs]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/snosov1/toc-org%5D%5Btoc-org%5D%5D][[[https://github.com/snosov1/toc-org][toc-org]]:1]] | |
(use-package toc-org | |
:after org | |
:config | |
(add-hook 'org-mode-hook #'toc-org-enable)) | |
;; [[https://github.com/snosov1/toc-org][toc-org]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/myuhe/org-gcal.el%5D%5Borg-gcal%5D%5D][[[https://github.com/myuhe/org-gcal.el][org-gcal]]:1]] | |
(use-package org-gcal | |
:commands org-gcal-sync | |
:config | |
(setq org-gcal-client-id (password-store-get "api/org-gcal-id") | |
org-gcal-client-secret (password-store-get "api/org-gcal-secret") | |
org-gcal-file-alist '(("diegoamundo@gmail.com" . "~/Dropbox/org/gcal.org")))) | |
;; [[https://github.com/myuhe/org-gcal.el][org-gcal]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/larstvei/ox-gfm%5D%5Box-gfm%5D%5D][[[https://github.com/larstvei/ox-gfm][ox-gfm]]:1]] | |
(use-package ox-gfm | |
:after ox) | |
;; [[https://github.com/larstvei/ox-gfm][ox-gfm]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/josuah/drawille%5D%5Bdrawille%5D%5D][[[https://github.com/josuah/drawille][drawille]]:1]] | |
(use-package drawille) | |
;; [[https://github.com/josuah/drawille][drawille]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://www.gnu.org/software/emms/%5D%5Bemms%5D%5D][[[https://www.gnu.org/software/emms/][emms]]:1]] | |
(use-package emms | |
:commands emms-smart-browse | |
:general | |
(d/leader-keys | |
"mc" 'emms-pause | |
"mb" 'emms-next | |
"mz" 'emms-previous | |
"ml" 'emms-seek-forward | |
"mh" 'emms-seek-backward) | |
:config | |
(d/setup-mode emms-browser | |
(hl-line-mode 1)) | |
(require 'emms-setup) | |
(emms-all) | |
(setq emms-source-file-default-directory "~/Music/" | |
emms-player-mpd-music-directory "~/Music/" | |
emms-seek-seconds 5) | |
(require 'emms-player-mpd) | |
(add-to-list 'emms-player-list 'emms-player-mpd) | |
(emms-player-mpd-connect) | |
;; (nmap :keymaps emms-browser-mode-map | |
;; "SPC" 'emms-browser-toggle-subitems) | |
;; (defhydra h/emms (:hint nil/) | |
;; " | |
;; ⏯ | |
;; _p_ | |
;; ") | |
) | |
;; [[https://www.gnu.org/software/emms/][emms]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/johanvts/emacs-fireplace/%5D%5Bfireplace%5D%5D][[[https://github.com/johanvts/emacs-fireplace/][fireplace]]:1]] | |
(use-package fireplace | |
:config | |
:general | |
(nmap :keymaps 'fireplace-mode-map | |
"q" 'fireplace-off | |
"Q" 'fireplace-off | |
"-" 'fireplace-down | |
"=" 'fireplace-up | |
"*" 'fireplace-toggle-smoke)) | |
;; [[https://github.com/johanvts/emacs-fireplace/][fireplace]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/therockmandolinist/emacs-hacker-typer%5D%5Bhacker-typer%5D%5D][[[https://github.com/therockmandolinist/emacs-hacker-typer][hacker-typer]]:1]] | |
(use-package hacker-typer | |
:config | |
(setq hacker-typer-show-hackerman t) | |
(setq hacker-typer-remove-comments t)) | |
;; [[https://github.com/therockmandolinist/emacs-hacker-typer][hacker-typer]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://www.emacswiki.org/emacs/highlight-tail.el%5D%5Bhighlight-tail%5D%5D][[[https://www.emacswiki.org/emacs/highlight-tail.el][highlight-tail]]:1]] | |
(use-package highlight-tail) | |
;; [[https://www.emacswiki.org/emacs/highlight-tail.el][highlight-tail]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/rbanffy/selectric-mode%5D%5Bselectric-mode%5D%5D][[[https://github.com/rbanffy/selectric-mode][selectric-mode]]:1]] | |
(use-package selectric-mode) | |
;; [[https://github.com/rbanffy/selectric-mode][selectric-mode]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/parkouss/speed-type%5D%5Bspeed-type%5D%5D][[[https://github.com/parkouss/speed-type][speed-type]]:1]] | |
(use-package speed-type | |
:general (d/leader-keys "as" 'speed-type-text) | |
:config | |
(setq speed-type--gb-url-format | |
"http://www.gutenberg.org/cache/epub/%d/pg%d.txt")) | |
;; [[https://github.com/parkouss/speed-type][speed-type]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://gitlab.com/iankelling/spray%5D%5Bspray%5D%5D][[[https://gitlab.com/iankelling/spray][spray]]:1]] | |
(use-package spray) | |
;; [[https://gitlab.com/iankelling/spray][spray]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/vibhavp/emacs-xkcd%5D%5Bxkcd%5D%5D][[[https://github.com/vibhavp/emacs-xkcd][xkcd]]:1]] | |
(use-package xkcd | |
:general (d/leader-keys "ax" 'xkcd) | |
:general | |
(nmap :keymaps 'xkcd-mode-map | |
"j" 'xkcd-next | |
"h" 'xkcd-prev | |
"k" 'xkcd-prev | |
"l" 'xkcd-next | |
"t" 'xkcd-alt-text | |
"q" 'xkcd-kill-buffer | |
"c" 'xkcd-copy-link | |
"g" 'xkcd-get | |
"r" 'xkcd-rand | |
"o" 'xkcd-open-browser | |
"e" 'xkcd-open-explanation-browser | |
"G" 'xkcd-get-latest) | |
:config) | |
;; [[https://github.com/vibhavp/emacs-xkcd][xkcd]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Functions][Functions:1]] | |
(eval-when-compile | |
(defvar zone-programs)) | |
(defun d/zone-choose () | |
"Choose a PGM to run for `zone'. | |
Source: http://tinyurl.com/lo96nwc" | |
(interactive) | |
(require 'zone nil t) | |
(let* ((pgm (completing-read | |
"Program: " | |
(mapcar #'symbol-name zone-programs))) | |
(zone-programs (list (intern pgm)))) | |
(redisplay) | |
(zone))) | |
;; Functions:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Bindings][Bindings:1]] | |
(d/leader-keys | |
"ag" '(:ignore t :wk "games") | |
"agd" 'dunnet | |
"agg" 'gomoku | |
"agt" 'tetris) | |
;; Bindings:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*%5B%5Bhttps://github.com/aaronbieber/sunshine.el%5D%5Bsunshine%5D%5D][[[https://github.com/aaronbieber/sunshine.el][sunshine]]:1]] | |
(use-package sunshine | |
:general | |
(d/leader-keys | |
"aW" 'sunshine-quick-forecast | |
"aw" 'sunshine-forecast) | |
:config | |
(setq sunshine-location "02139,USA" | |
sunshine-appid (password-store-get "api/openweathermap"))) | |
;; [[https://github.com/aaronbieber/sunshine.el][sunshine]]:1 ends here | |
;; [[file:~/dotfiles/emacs.d/init.org::*Finalize][Finalize:1]] | |
(straight-declare-init-finished) | |
(when (not (bufferp "*Warnings*")) | |
(message "Init succeeded.") | |
(straight-declare-init-succeeded)) | |
(when window-system | |
(let ((elapsed (float-time (time-subtract (current-time) | |
d/emacs-start-time)))) | |
(message "Loading %s...done (%.3fs)" load-file-name elapsed)) | |
(add-hook 'after-init-hook | |
`(lambda () | |
(let ((elapsed (float-time (time-subtract (current-time) | |
d/emacs-start-time)))) | |
(message "Loading %s...done (%.3fs) [after-init]" | |
,load-file-name elapsed))) | |
t)) | |
;; Finalize:1 ends here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment