Human Readable Emacs Configuration using Org mode
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3070 lines
121 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. #+TITLE: Emacs Configuration
  2. #+AUTHOR: Levi Olson
  3. #+EMAIL: olson.levi@gmail.com
  4. #+DATE: <2019-01-30 Wed>
  5. #+LANGUAGE: en
  6. #+BABEL: :cache yes
  7. #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="public/style.css" />
  8. #+EXPORT_FILE_NAME: index.html
  9. #+PROPERTY: header-args :tangle yes
  10. #+OPTIONS: num:10 whn:nil toc:10 H:10
  11. #+STARTUP: content
  12. * Summary
  13. I've really been wanting to have a nicely formatted emacs config file and this is my attempt at it.
  14. * Required Magic
  15. ** Lexical Binding
  16. #+BEGIN_SRC emacs-lisp :results silent
  17. ;;; -*- lexical-binding: t -*-
  18. ;;; DO NOT EDIT THIS FILE DIRECTLY
  19. ;;; EDIT ~init.org~ instead
  20. #+END_SRC
  21. ** The Magical Glue
  22. The following auto compiles the emacs-lisp within the =init.org= file.
  23. Simply run `org-babel-tangle` to make it RAIN!
  24. #+BEGIN_SRC emacs-lisp :results silent
  25. ;; (setq byte-compile-warnings nil)
  26. (defun tangle-init ()
  27. "If the current buffer is 'init.org' the code-blocks are tangled, and the tangled file is compiled."
  28. (when (equal (buffer-file-name)
  29. (expand-file-name (concat user-emacs-directory "init.org")))
  30. ;; Avoid running hooks when tangling.
  31. (let ((prog-mode-hook nil))
  32. (org-babel-tangle)
  33. (byte-compile-file (concat user-emacs-directory "init.el")))))
  34. (add-hook 'after-save-hook 'tangle-init)
  35. #+END_SRC
  36. * Config
  37. ** Packages
  38. #+BEGIN_SRC emacs-lisp :results silent
  39. (require 'package)
  40. (package-initialize)
  41. (defvar my-packages
  42. '(all-the-icons
  43. amx
  44. anzu
  45. base16-theme
  46. bbdb
  47. better-defaults
  48. company
  49. company-go
  50. counsel
  51. counsel-projectile
  52. dash-at-point
  53. dashboard
  54. diminish
  55. dockerfile-mode
  56. doom-modeline
  57. doom-themes
  58. ein
  59. eldoc-eval
  60. elfeed
  61. elfeed-org
  62. elpy
  63. emmet-mode
  64. excorporate
  65. expand-region
  66. fic-mode
  67. flycheck
  68. gitignore-mode
  69. go-mode
  70. go-playground
  71. gorepl-mode
  72. iedit
  73. indium
  74. ivy
  75. ivy-hydra
  76. jabber
  77. json-mode
  78. magit
  79. markdown-mode
  80. material-theme
  81. multiple-cursors
  82. ox-reveal
  83. poporg
  84. projectile
  85. rainbow-delimiters
  86. rust-mode
  87. shrink-path
  88. tide
  89. typescript-mode
  90. ;; use-package
  91. web-mode
  92. which-key))
  93. (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
  94. (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/"))
  95. (when (not package-archive-contents)
  96. (package-refresh-contents))
  97. (package-initialize)
  98. (dolist (p my-packages)
  99. (when (not (package-installed-p p))
  100. (package-install p)))
  101. #+END_SRC
  102. ** Server
  103. #+BEGIN_SRC emacs-lisp :results silent :tangle no
  104. (require 'edit-server)
  105. (edit-server-start)
  106. #+END_SRC
  107. ** Better Defaults
  108. #+BEGIN_SRC emacs-lisp :results silent
  109. (require 'better-defaults)
  110. ;; Instead of the annoying giant warning icon, just flash the modeline.
  111. ;; (this happens when you do something like C-g)
  112. (setq ring-bell-function
  113. (lambda ()
  114. (let ((orig-fg (face-foreground 'mode-line)))
  115. (set-face-foreground 'mode-line "#F2804F")
  116. (run-with-idle-timer 0.1 nil
  117. (lambda (fg) (set-face-foreground 'mode-line fg))
  118. orig-fg))))
  119. (defun set-frame-size-according-to-resolution ()
  120. "Set the Emacs window size on startup."
  121. (interactive)
  122. (if window-system
  123. (progn
  124. ;; WIDTH
  125. (if (> (x-display-pixel-width) 1280)
  126. ;; Large Screen (only show 120 cols)
  127. (add-to-list 'default-frame-alist (cons 'width 240))
  128. ;; Small Screen (fill window)
  129. (add-to-list 'default-frame-alist (cons 'width (/ (x-display-pixel-width) (frame-char-width)))))
  130. ;; HEIGHT
  131. (if (> (x-display-pixel-height) 1080)
  132. ;; Large Screen (only fill half screen)
  133. (add-to-list 'default-frame-alist (cons 'height (/ (/ (x-display-pixel-height) 2)
  134. (frame-char-height))))
  135. ;; Small Screen (fill window)
  136. (add-to-list 'default-frame-alist (cons 'height (/ (x-display-pixel-height) (frame-char-height)))))
  137. )))
  138. ;; (set-frame-size-according-to-resolution)
  139. (defun window-px-width ()
  140. "Get the width of the Emacs window in pixels."
  141. (interactive)
  142. (* (* (window-total-width) 2.874) (frame-char-width)))
  143. (defun window-px-left-pos ()
  144. "Calculate the left position of the Emacs window."
  145. (interactive)
  146. (/ (- (x-display-pixel-width) (window-px-width)) 2))
  147. ;; (add-to-list 'default-frame-alist (cons 'top 0))
  148. ;; (add-to-list 'default-frame-alist (cons 'left 1000))
  149. #+END_SRC
  150. ** Enable Disabled Commands
  151. #+BEGIN_SRC emacs-lisp :results silent
  152. (put 'narrow-to-region 'disabled nil)
  153. (put 'upcase-region 'disabled nil)
  154. (put 'downcase-region 'disabled nil)
  155. #+END_SRC
  156. ** Splash Screen
  157. #+BEGIN_SRC emacs-lisp :results silent
  158. (require 'dashboard)
  159. (dashboard-setup-startup-hook)
  160. ;; Set the title
  161. (setq dashboard-banner-logo-title "Let's begin...")
  162. ;; Set the banner
  163. (setq dashboard-startup-banner "~/.emacs.d/public/emacs-logo-350.png")
  164. ;; Value can be
  165. ;; 'official which displays the official emacs logo
  166. ;; 'logo which displays an alternative emacs logo
  167. ;; 1, 2 or 3 which displays one of the text banners
  168. ;; "path/to/your/image.png" which displays whatever image you would prefer
  169. ;; Content is not centered by default. To center, set
  170. (setq dashboard-center-content t)
  171. ;; To disable shortcut "jump" indicators for each section, set
  172. (setq dashboard-show-shortcuts t)
  173. (setq show-week-agenda-p t)
  174. (setq dashboard-items '((recents . 5)
  175. (bookmarks . 5)
  176. (projects . 5)
  177. (agenda . 5)
  178. (registers . 5)))
  179. #+END_SRC
  180. ** Basic Customization
  181. #+BEGIN_SRC emacs-lisp :results silent
  182. (defvar backup-dir (expand-file-name "~/.emacs.d/backup/"))
  183. (defvar autosave-dir (expand-file-name "~/.emacs.d/autosave/"))
  184. (setq initial-scratch-message nil
  185. backup-directory-alist (list (cons ".*" backup-dir))
  186. auto-save-list-file-prefix autosave-dir
  187. auto-save-file-name-transforms `((".*" ,autosave-dir t)))
  188. (menu-bar-mode 0)
  189. (scroll-bar-mode 0)
  190. (tool-bar-mode 0)
  191. (setq auth-sources '("~/.authinfo.gpg"))
  192. (set-default 'truncate-lines t)
  193. ;; (load-theme 'doom-city-lights t)
  194. ;; (load-theme 'doom-dracula t)
  195. ;; (load-theme 'doom-nord t)
  196. (load-theme 'doom-one t)
  197. ;; (load-theme 'doom-spacegrey t)
  198. ;; (load-theme 'base16-ocean t)
  199. (load-theme 'base16-onedark t)
  200. (global-linum-mode t)
  201. (global-auto-revert-mode t)
  202. (defalias 'yes-or-no-p 'y-or-n-p)
  203. #+END_SRC
  204. *** Diary
  205. #+BEGIN_SRC emacs-lisp :results silent
  206. (defvar diary-file (expand-file-name "~/.emacs.d/diary/main"))
  207. (add-hook 'diary-list-entries-hook 'diary-sort-entries t)
  208. (add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)
  209. (add-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files)
  210. (add-hook 'calendar-today-visible-hook 'calendar-mark-today)
  211. (setq calendar-latitude 44
  212. calendar-longitude -97
  213. calendar-location-name "Hayti, SD")
  214. #+END_SRC
  215. ** Custom Modes
  216. *** OpenHAB Mode
  217. #+BEGIN_SRC emacs-lisp :results silent
  218. (require 'font-lock)
  219. (defvar openhab-mode-hook nil)
  220. (defvar openhab-mode-map
  221. (let ((map (make-keymap)))
  222. (define-key map "\C-j" 'newline-and-indent)
  223. map)
  224. "Keymap for OPENHAB major mode.")
  225. (add-to-list 'auto-mode-alist '("\\.sitemap\\'" . openhab-mode))
  226. (add-to-list 'auto-mode-alist '("\\.items\\'" . openhab-mode))
  227. (add-to-list 'auto-mode-alist '("\\.rules\\'" . openhab-mode))
  228. (add-to-list 'auto-mode-alist '("\\.things\\'" . openhab-mode))
  229. (defconst openhab-font-lock-keywords
  230. `(
  231. ("\<.*\>" . font-lock-constant-face)
  232. (,(regexp-opt
  233. '(
  234. ;; KEYWORDS
  235. "Selection" "Slider" "List" "Setpoint" "Video" "Chart" "Webview" "Colorpicker"
  236. "Timer" "Number" "String"
  237. "Switch" "Rollershutter" "Number" "String" "Dimmer" "Contact" "DateTime" "Color"
  238. "Text" "Group" "Image" "Frame"
  239. "Thing" "Bridge"
  240. "Time" "System"
  241. "sitemap"
  242. "rule" "when" "then" "end"
  243. "if" "val"
  244. "import" "var" "say" "postUpdate" "switch" "println" "case" "or" "sendCommand"
  245. )
  246. 'words)
  247. (1 font-lock-keyword-face))
  248. (,(regexp-opt
  249. '(
  250. "ON" "OFF" "on" "off"
  251. "AND" "OR" "NAND" "NOR" "AVG" "SUM" "MAX" "MIN"
  252. "true" "false"
  253. )
  254. 'words)
  255. (1 font-lock-constant-face))
  256. (,(regexp-opt
  257. '(
  258. "name" "label" "item" "period" "refresh" "icon" "mappings" "minValue" "maxValue" "step" "switchsupport" "url" "height" "refresh" "visibility" "valuecolor"
  259. )
  260. 'words)
  261. (1 font-lock-type-face))
  262. ("\(.*\)" . font-lock-variable-name-face)
  263. ("[^a-zA-Z0-9_:]\\([0-9]*\\)[^a-zA-Z0-9_:]" . (1 font-lock-variable-name-face))
  264. ("\s@\s" . font-lock-variable-name-face)
  265. ("\s\\([a-zA-Z0-9_:]*\\)\\(\s\\|$\\)" . (1 font-lock-type-face))
  266. ("=\\([a-zA-Z_]*\\)" . (1 font-lock-string-face))
  267. ("\\([a-zA-Z]*\\)=" . (1 font-lock-type-face))
  268. )
  269. "The regexps to highlight in openHAB mode.")
  270. (defvar openhab-mode-syntax-table
  271. (let ((st (make-syntax-table)))
  272. (modify-syntax-entry ?/ ". 12b" st) ;; C-style comments // ...
  273. (modify-syntax-entry ?\n "> b" st) ;; \n ends comment
  274. ;; Block comments /*...*/
  275. (modify-syntax-entry ?\/ ". 14" st)
  276. (modify-syntax-entry ?* ". 23" st)
  277. st)
  278. "Syntax table for openhab-mode.")
  279. (defun openhab-mode ()
  280. "Major mode for editing OPENHAB config files."
  281. (interactive)
  282. (kill-all-local-variables)
  283. (set-syntax-table openhab-mode-syntax-table)
  284. (use-local-map openhab-mode-map)
  285. (set (make-local-variable 'font-lock-defaults) '(openhab-font-lock-keywords nil t))
  286. (electric-pair-mode -1)
  287. (flycheck-mode -1)
  288. (setq major-mode 'openhab-mode)
  289. (setq mode-name "OpenHAB")
  290. (run-hooks 'openhab-mode-hook))
  291. (provide 'openhab-mode)
  292. #+END_SRC
  293. ** Custom Packages
  294. *** Hyperspace
  295. #+BEGIN_SRC emacs-lisp :results silent
  296. ;;; hyperspace.el --- Get there from here -*- lexical-binding: t; -*-
  297. ;; Copyright (C) 2017-2019 Ian Eure
  298. ;; Author: Ian Eure <ian@retrospec.tv>
  299. ;; URL: https://github.com/ieure/hyperspace-el
  300. ;; Version: 0.8.4
  301. ;; Package-Requires: ((emacs "25") (s "1.12.0"))
  302. ;; Keywords: tools, convenience
  303. ;; This program is free software; you can redistribute it and/or modify
  304. ;; it under the terms of the GNU General Public License as published by
  305. ;; the Free Software Foundation, either version 3 of the License, or
  306. ;; (at your option) any later version.
  307. ;; This program is distributed in the hope that it will be useful,
  308. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  309. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  310. ;; GNU General Public License for more details.
  311. ;; You should have received a copy of the GNU General Public License
  312. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  313. ;;; Commentary:
  314. ;; Hyperspace is a way to get nearly anywhere from wherever you are,
  315. ;; whether that's within Emacs or on the web. It's somewhere in
  316. ;; between Quicksilver and keyword URLs, giving you a single,
  317. ;; consistent interface to get directly where you want to go. It’s
  318. ;; for things that you use often, but not often enough to justify a
  319. ;; dedicated binding.
  320. ;;
  321. ;; When you enter Hyperspace, it prompts you where to go:
  322. ;;
  323. ;; HS:
  324. ;;
  325. ;; This prompt expects a keyword and a query. The keyword picks where
  326. ;; you want to go, and the remainder of the input is an optional
  327. ;; argument which can be used to further search or direct you within
  328. ;; that space.
  329. ;;
  330. ;; Some concrete examples:
  331. ;;
  332. ;; | *If you enter* | *then Hyperspace* |
  333. ;; |------------------+----------------------------------------------------------|
  334. ;; | "el" | opens info node "(elisp)Top" |
  335. ;; | "el eval-region" | searches for "eval-region" in the elisp Info index |
  336. ;; | "bb" | shows all BBDB entries |
  337. ;; | "bb kenneth" | shows all BBDB entries with a name matching "kenneth" |
  338. ;; | "ddg foo" | searches DuckDuckGo for "foo" using browse-url |
  339. ;; | "wp foo" | searches Wikipedia for "foo" using browse-url |
  340. ;;
  341. ;;; Code:
  342. (require 'subr-x)
  343. (require 's)
  344. ;; Action helpers
  345. (defun hyperspace-action->browse-url-pattern (pattern query)
  346. "Browse a URL former from PATTERN and QUERY."
  347. (browse-url (format pattern query)))
  348. (defun hyperspace-action->info (node &optional query)
  349. "Open an Info buffer for NODE.
  350. If QUERY is present, look it up in the index."
  351. (info node)
  352. (when query
  353. (Info-index query)))
  354. ;; Package definitions
  355. (defvar hyperspace-history nil
  356. "History of Hyperspace actions.")
  357. (defgroup hyperspace nil
  358. "Getting there from here"
  359. :prefix "hyperspace-"
  360. :group 'applications)
  361. (defcustom hyperspace-actions
  362. '(("ddg" . "https://duckduckgo.com/?q=%s")
  363. ("dis" . "https://duckduckgo.com/?q=%s&iax=images&ia=images")
  364. ("wp" . "https://en.wikipedia.org/wiki/%s")
  365. ("g" . "https://www.google.com/search?q=%s")
  366. ("gi" . "https://www.google.com/search?tbm=isch&q=%s")
  367. ("gm" . "https://www.google.com/maps/search/%s")
  368. ("yt" . "https://www.youtube.com/results?search_query=%s")
  369. ("clp" . "https://portland.craigslist.org/search/sss?query=%s")
  370. ("eb" . "https://www.ebay.com/sch/i.html?_nkw=%s")
  371. ("nf" . "https://www.netflix.com/search?q=%s")
  372. ("sh" . (lambda (query) (interactive) (shell-command query)))
  373. ("imdb" . "https://www.imdb.com/find?q=peter+jackson&s=all")
  374. ("bb" . bbdb-search-name)
  375. ("el" . (apply-partially #'hyperspace-action->info "(elisp)Top"))
  376. ("av" . apropos-variable)
  377. ("ac" . apropos-command)
  378. ("af" . (lambda (query) (apropos-command query t))))
  379. "Where Hyperspace should send you.
  380. Hyperspace actions are a cons of (KEYWORD . DISPATCHER). When
  381. Hyperspace is invoked, the keyword is extracted from the user
  382. input and looked up in this alist. The remainder of the
  383. string is passed to the dispatcher as its QUERY argument.
  384. DISPATCHER can be a function which performs the action.
  385. DISPATCHER can also be an expression which returns a function
  386. to perform the action.
  387. Finally, DISPATCHER can be a string with a URL pattern containing
  388. '%s'. The '%s' will be replaced with the query, and the URL browsed."
  389. :group 'hyperspace
  390. :type '(alist :key-type (string :tag "Keyword")
  391. :value-type (choice
  392. (function :tag "Function")
  393. (string :tag "URL Pattern")
  394. (sexp :tag "Expression"))))
  395. (defcustom hyperspace-default-action
  396. (caar hyperspace-actions)
  397. "A place to go if you don't specify one."
  398. :group 'hyperspace
  399. :type `(radio
  400. ,@(mapcar (lambda (action) (list 'const (car action))) hyperspace-actions)))
  401. (defcustom hyperspace-max-region-size 256
  402. "Maximum size of a region to consider for a Hyperspace query.
  403. If the region is active when Hyperspace is invoked, it's used
  404. as the default query, unless it's more than this number of
  405. characters."
  406. :group 'hyperspace
  407. :type 'integer)
  408. (defun hyperspace--cleanup (text)
  409. "Clean TEXT so it can be used for a Hyperspace query."
  410. (save-match-data
  411. (string-trim
  412. (replace-regexp-in-string (rx (1+ (or blank "\n"))) " " text))))
  413. (defun hyperspace--initial-text ()
  414. "Return the initial text.
  415. This is whatever's in the active region, but cleaned up."
  416. (when (use-region-p)
  417. (let* ((start (region-beginning))
  418. (end (region-end))
  419. (size (- end start)))
  420. (when (<= size hyperspace-max-region-size)
  421. (hyperspace--cleanup
  422. (buffer-substring-no-properties start end))))))
  423. (defun hyperspace--initial (initial-text)
  424. "Turn INITIAL-TEXT into INITIAL-CONTENTS for reading."
  425. (when initial-text (cons (concat " " initial-text) 1)))
  426. (defun hyperspace--process-input (text)
  427. "Process TEXT into an actionable keyword and query."
  428. (let ((kw-text (s-split-up-to "\\s-+" text 1)))
  429. (if (assoc (car kw-text) hyperspace-actions)
  430. kw-text
  431. (list hyperspace-default-action text))))
  432. (defun hyperspace--query ()
  433. "Ask the user for the Hyperspace action and query.
  434. Returns (KEYWORD . QUERY).
  435. If the region isn't active, the user is prompted for the
  436. action and query.
  437. If the region is active, its text is used as the initial value
  438. for the query, and the user enters the action.
  439. If a prefix argument is specified and the region is active,
  440. `HYPERSPACE-DEFAULT-ACTION' is chosen without prompting."
  441. (let ((initial (hyperspace--initial-text)))
  442. (if (and initial current-prefix-arg)
  443. (list hyperspace-default-action initial)
  444. (hyperspace--process-input
  445. (read-from-minibuffer "HS: " (hyperspace--initial initial) nil nil
  446. 'hyperspace-history)))))
  447. (defun hyperspace--evalable-p (form)
  448. "Can FORM be evaluated?"
  449. (and (listp form)
  450. (or (functionp (car form))
  451. (subrp (car form)))))
  452. (defun hyperspace--dispatch (action &optional query)
  453. "Execute ACTION, with optional QUERY argument."
  454. (pcase action
  455. ((pred functionp) (funcall action query))
  456. ((pred hyperspace--evalable-p) (funcall (eval action) query))
  457. ((pred stringp) (hyperspace-action->browse-url-pattern action query))
  458. (_ (error "Unknown action"))))
  459. ;;;###autoload
  460. (defun hyperspace (keyword &optional query)
  461. "Execute action for keyword KEYWORD, with optional QUERY."
  462. (interactive (hyperspace--query))
  463. (let ((action (cdr (assoc keyword hyperspace-actions))))
  464. (hyperspace--dispatch (or action hyperspace-default-action) query)))
  465. ;;;###autoload
  466. (defun hyperspace-enter (&optional query)
  467. "Enter Hyperspace, sending QUERY to the default action.
  468. If the region is active, use that as the query for
  469. ‘hyperspace-default-action’. Otherwise, prompt the user."
  470. (interactive (list (hyperspace--initial-text)))
  471. (hyperspace
  472. hyperspace-default-action
  473. (or query
  474. (read-from-minibuffer
  475. (format "HS: %s " hyperspace-default-action) nil nil
  476. 'hyperspace-history))))
  477. ;; Minor mode
  478. (defvar hyperspace-minor-mode-map
  479. (let ((kmap (make-sparse-keymap)))
  480. (define-key kmap (kbd "H-SPC") #'hyperspace)
  481. (define-key kmap (kbd "<H-return>") #'hyperspace-enter)
  482. kmap))
  483. ;;;###autoload
  484. (define-minor-mode hyperspace-minor-mode
  485. "Global (universal) minor mode to jump from here to there."
  486. nil nil hyperspace-minor-mode-map
  487. :group 'hyperspace
  488. :global t)
  489. (provide 'hyperspace)
  490. ;;; hyperspace.el ends here
  491. #+END_SRC
  492. ** Tools
  493. *** General
  494. #+BEGIN_SRC emacs-lisp :results silent
  495. (require 'which-key)
  496. (which-key-setup-minibuffer)
  497. (which-key-mode)
  498. (require 'fic-mode)
  499. (add-hook 'js-mode-hook 'fic-mode)
  500. #+END_SRC
  501. *** Company
  502. #+BEGIN_SRC emacs-lisp :results silent
  503. (require 'company)
  504. (add-hook 'after-init-hook 'global-company-mode)
  505. (setq company-dabbrev-downcase nil)
  506. (setq company-idle-delay 0.1)
  507. #+END_SRC
  508. *** Diminish
  509. #+BEGIN_SRC emacs-lisp :results silent
  510. (require 'diminish)
  511. (diminish 'auto-revert-mode)
  512. (eval-after-load "company" '(diminish 'company-mode))
  513. (eval-after-load "counsel" '(diminish 'counsel-mode))
  514. (eval-after-load "elpy" '(diminish 'elpy-mode))
  515. (eval-after-load "go-mode" '(diminish 'go-mode))
  516. (eval-after-load "go-playground" '(diminish 'go-playground-mode))
  517. (eval-after-load "gorepl-mode" '(diminish 'gorepl-mode))
  518. (eval-after-load "flycheck" '(diminish 'flycheck-mode))
  519. (eval-after-load "ivy" '(diminish 'ivy-mode))
  520. (eval-after-load "projectile" '(diminish 'projectile-mode))
  521. (eval-after-load "which-key" '(diminish 'which-key-mode))
  522. #+END_SRC
  523. *** Dired
  524. #+BEGIN_SRC emacs-lisp :results silent
  525. (defun dired-mode-setup ()
  526. "Will run as hook for `dired-mode'."
  527. (dired-hide-details-mode nil))
  528. (add-hook 'dired-mode-hook 'dired-mode-setup)
  529. #+END_SRC
  530. *** Excorporate
  531. #+BEGIN_SRC emacs-lisp :results silent :tangle no
  532. ;;;
  533. ;;; Configuration for our Exchange server
  534. ;;;
  535. (setq-default
  536. excorporate-configuration
  537. '("lolson@eaglecrk.com" . "https://outlook.office365.com/EWS/Exchange.asmx")
  538. org-agenda-include-diary t)
  539. ;;;
  540. ;;; Make sure that Emacs diary knows how to follow `#include "..."'
  541. ;;; directives (needed by excorporate)
  542. ;;;
  543. (add-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files)
  544. ;;;
  545. ;;; Create a hook function to pull down Exchange meetings and
  546. ;;; update my Emacs diary whenever org-agenda merges diary into
  547. ;;; agenda.
  548. ;;;
  549. (defun my/agenda-update-diary ()
  550. "Update exchange diary."
  551. (interactive)
  552. (exco-diary-diary-advice
  553. (calendar-current-date)
  554. (calendar-current-date)
  555. #'message "Diary updated"))
  556. (add-hook 'org-agenda-cleanup-fancy-diary-hook 'my/agenda-update-diary)
  557. ;;;
  558. ;;; Finally, turn on excorporate and enable excorporate-diary
  559. ;;;
  560. (excorporate)
  561. (excorporate-diary-enable)
  562. #+END_SRC
  563. *** Ivy and Amx
  564. #+BEGIN_SRC emacs-lisp :results silent
  565. (require 'ivy-hydra)
  566. (require 'ivy)
  567. (require 'swiper)
  568. (ivy-mode 1)
  569. (counsel-mode)
  570. (setq ivy-use-virtual-buffers t
  571. enable-recursive-minibuffers t
  572. ivy-height 25
  573. ivy-initial-inputs-alist nil
  574. ivy-extra-directories nil)
  575. (global-set-key (kbd "C-s") 'swiper)
  576. (global-set-key (kbd "C-c C-r") 'ivy-resume)
  577. (global-set-key (kbd "M-x") 'counsel-M-x)
  578. (global-set-key (kbd "C-x C-f") 'counsel-find-file)
  579. (global-set-key (kbd "C-c g") 'counsel-git)
  580. (global-set-key (kbd "C-c j") 'counsel-git-grep)
  581. (global-set-key (kbd "C-c k") 'counsel-ag)
  582. (define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
  583. (defun ivy-open-current-typed-path ()
  584. (interactive)
  585. (when ivy--directory
  586. (let* ((dir ivy--directory)
  587. (text-typed ivy-text)
  588. (path (concat dir text-typed)))
  589. (delete-minibuffer-contents)
  590. (ivy--done path))))
  591. (define-key ivy-minibuffer-map (kbd "<return>") 'ivy-alt-done)
  592. (define-key ivy-minibuffer-map (kbd "C-f") 'ivy-open-current-typed-path)
  593. #+END_SRC
  594. *** Magit
  595. #+BEGIN_SRC emacs-lisp :results silent
  596. (require 'magit)
  597. (global-set-key (kbd "C-x g") 'magit-status)
  598. (global-set-key (kbd "C-c g") 'magit-status)
  599. (setq magit-completing-read-function 'ivy-completing-read)
  600. #+END_SRC
  601. *** Markdown
  602. #+BEGIN_SRC emacs-lisp :results silent
  603. (add-to-list 'exec-path "/home/locust/.local/bin")
  604. #+END_SRC
  605. *** Mu4e
  606. #+BEGIN_SRC emacs-lisp :results silent
  607. (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu/mu4e")
  608. (require 'mu4e)
  609. (setq mu4e-maildir "~/Mail"
  610. mu4e-mu-binary "/usr/local/bin/mu"
  611. mu4e-change-filenames-when-moving t ;; Rename files when moving (required by mbsync)
  612. mu4e-compose-in-new-frame t ;; New compose gets new frame
  613. mu4e-context-policy 'pick-first
  614. mu4e-get-mail-command "mbsync -a" ;; MBSYNC is the mail cmd
  615. mu4e-html2text-command "/usr/local/bin/w3m -T text/html" ;; HTML to text command
  616. mu4e-headers-include-related nil ;; Stop threading in INBOX
  617. mu4e-sent-messages-behavior 'delete ;; Delete sent messages
  618. mu4e-update-interval 300 ;; 5 mins
  619. mu4e-use-fancy-chars t ;; use 'fancy' chars
  620. mu4e-user-mail-address-list '("lolson@eaglecrk.com"
  621. "lolson@vlocity.com"
  622. "olson.levi@gmail.com")
  623. mu4e-view-show-images t ;; attempt to show images
  624. mu4e-view-image-max-width 400 ;; max image size
  625. message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n" ;; customize the reply-quote-string
  626. message-citation-line-function 'message-insert-formatted-citation-line ;; choose to use the formatted string
  627. message-kill-buffer-on-exit t ;; don't keep messages around
  628. send-mail-function 'smtpmail-send-it ;; Default email send function
  629. smtpmail-default-smtp-server "smtp.gmail.com"
  630. smtpmail-smtp-service 587
  631. )
  632. ;; (defun leo/convert-message-set-point ()
  633. ;; "Set the point to the start of the message body."
  634. ;; (interactive)
  635. ;; (beginning-of-buffer)
  636. ;; (search-forward "--text follows this line--")
  637. ;; (forward-char)
  638. ;; )
  639. ;; (defun leo/convert-message-from-markdown ()
  640. ;; "Convert a markdown flavored mail buffer to html w/mime support."
  641. ;; (interactive)
  642. ;; (if (y-or-n-p "Convert to HTML? ")
  643. ;; ((leo/convert-message-set-point)
  644. ;; (save-excursion
  645. ;; (message-goto-body)
  646. ;; (shell-command-on-region (point) (point-max) "~/.emacs.d/scripts/expand-mime.sh" nil t)))
  647. ;; (message "Aborting."))
  648. ;; )
  649. (setq mu4e-contexts
  650. `(
  651. ;; ,(make-mu4e-context
  652. ;; :name "Vlocity"
  653. ;; :enter-func (lambda () (mu4e-message "Entering Vlocity"))
  654. ;; :leave-func (lambda () (mu4e-message "Leaving Vlocity"))
  655. ;; ;; we match based on the contact-fields of the message
  656. ;; :match-func (lambda (msg)
  657. ;; (when msg
  658. ;; (string= (mu4e-message-field msg :maildir) "/Vlocity")))
  659. ;; :vars '( ( user-mail-address . "lolson@vlocity.com" )
  660. ;; ( smtpmail-mail-address . "lolson@vlocity.com" )
  661. ;; ( smtpmail-smtp-user . "lolson@vlocity.com" )
  662. ;; ( smtpmail-smtp-server . "smtp.gmail.com" )
  663. ;; ( user-full-name . "Levi Olson" )
  664. ;; ( mu4e-compose-signature .
  665. ;; (concat
  666. ;; "Levi Olson\n"
  667. ;; "Senior UI Developer"))
  668. ;; ( mu4e-sent-folder . "/Vlocity/[Gmail].Sent Mail" )
  669. ;; ( mu4e-drafts-folder . "/Vlocity/[Gmail].Drafts" )
  670. ;; ( mu4e-trash-folder . "/Vlocity/[Gmail].Trash" )
  671. ;; ( mu4e-maildir-shortcuts . (("/Vlocity/INBOX" . ?i)
  672. ;; ("/Vlocity/[Gmail].Sent Mail" . ?s)
  673. ;; ("/Vlocity/[Gmail].Trash" . ?t)
  674. ;; ("/Vlocity/[Gmail].All Mail" . ?a)))))
  675. ,(make-mu4e-context
  676. :name "EagleCreek"
  677. :enter-func (lambda () (mu4e-message "Entering EagleCreek"))
  678. :leave-func (lambda () (mu4e-message "Leaving EagleCreek"))
  679. ;; we match based on the contact-fields of the message
  680. :match-func (lambda (msg)
  681. (when msg
  682. (string= (mu4e-message-field msg :maildir) "/eaglecrk")))
  683. :vars '( ( user-mail-address . "lolson@eaglecrk.com" )
  684. ( smtpmail-mail-address . "lolson@eaglecrk.com" )
  685. ( smtpmail-smtp-user . "lolson@eaglecrk.com" )
  686. ( smtpmail-smtp-server . "smtp.office365.com" )
  687. ( user-full-name . "Levi Olson" )
  688. ;; ( mu4e-compose-signature .
  689. ;; (concat
  690. ;; "Levi Olson\n"
  691. ;; "Eagle Creek Software Services\n"
  692. ;; "Senior Application Developer Consultant\n"))
  693. ( mu4e-sent-folder . "/eaglecrk/Sent Items" )
  694. ( mu4e-drafts-folder . "/eaglecrk/Drafts" )
  695. ( mu4e-trash-folder . "/eaglecrk/Deleted Items" )
  696. ( mu4e-maildir-shortcuts . (("/eaglecrk/Inbox" . ?i)
  697. ("/eaglecrk/Sent Items" . ?s)
  698. ("/eaglecrk/Deleted Items" . ?t)
  699. ("/eaglecrk/Archive" . ?a)))))
  700. ;; ,(make-mu4e-context
  701. ;; :name "Gmail"
  702. ;; :enter-func (lambda () (mu4e-message "Entering Gmail"))
  703. ;; :leave-func (lambda () (mu4e-message "Leaving Gmail"))
  704. ;; ;; this matches maildir /Arkham and its sub-directories
  705. ;; :match-func (lambda (msg)
  706. ;; (when msg
  707. ;; (string= (mu4e-message-field msg :maildir) "/Gmail")))
  708. ;; :vars '( ( user-mail-address . "olson.levi@gmail.com" )
  709. ;; ( smtpmail-mail-address . "olson.levi@gmail.com" )
  710. ;; ( smtpmail-smtp-user . "olson.levi@gmail.com" )
  711. ;; ( smtpmail-smtp-server . "smtp.gmail.com" )
  712. ;; ( user-full-name . "Levi Olson" )
  713. ;; ( mu4e-compose-signature .
  714. ;; (concat
  715. ;; "Levi\n"))
  716. ;; ( mu4e-sent-folder . "/Gmail/[Gmail].Sent Mail" )
  717. ;; ( mu4e-drafts-folder . "/Gmail/[Gmail].Drafts" )
  718. ;; ( mu4e-trash-folder . "/Gmail/[Gmail].Trash" )
  719. ;; ( mu4e-maildir-shortcuts . (("/Gmail/INBOX" . ?i)
  720. ;; ("/Gmail/[Gmail].Sent Mail" . ?s)
  721. ;; ("/Gmail/[Gmail].Trash" . ?t)
  722. ;; ("/Gmail/[Gmail].All Mail" . ?a))
  723. ;; )))
  724. ))
  725. ;; Add option to view HTML in browser
  726. (add-to-list 'mu4e-headers-actions
  727. '("in browser" . mu4e-action-view-in-browser) t)
  728. (add-to-list 'mu4e-view-actions
  729. '("in browser" . mu4e-action-view-in-browser) t)
  730. (defun my-message-current-line-cited-p ()
  731. "Indicate whether the line at point is a cited line."
  732. (save-match-data
  733. (string-match (concat "^" message-cite-prefix-regexp)
  734. (buffer-substring (line-beginning-position) (line-end-position)))))
  735. (defun my-message-says-attachment-p ()
  736. "Return t if the message suggests there can be an attachment."
  737. (save-excursion
  738. (goto-char (point-min))
  739. (save-match-data
  740. (let (search-result)
  741. (while
  742. (and (setq search-result (re-search-forward "\\(attach\\|pdf\\|file\\)" nil t))
  743. (my-message-current-line-cited-p)))
  744. search-result))))
  745. (defun my-message-has-attachment-p ()
  746. "Return t if the message has an attachment."
  747. (save-excursion
  748. (goto-char (point-min))
  749. (save-match-data
  750. (re-search-forward "<#part" nil t))))
  751. (defun my-message-pre-send-check-attachment ()
  752. (when (and (my-message-says-attachment-p)
  753. (not (my-message-has-attachment-p)))
  754. (unless
  755. (y-or-n-p "No attachment. Send anyway?")
  756. (error "It seems that an attachment is needed, but none was found. Aborting sending."))))
  757. (add-hook 'message-send-hook 'my-message-pre-send-check-attachment)
  758. #+END_SRC
  759. *** Projectile
  760. #+BEGIN_SRC emacs-lisp :results silent
  761. (require 'projectile)
  762. (require 'counsel-projectile)
  763. (projectile-mode)
  764. (setq projectile-mode-line '(:eval (format " %s" (projectile-project-name)))
  765. projectile-remember-window-configs t
  766. projectile-completion-system 'ivy)
  767. (counsel-projectile-mode)
  768. #+END_SRC
  769. *** Poporg
  770. Edit comments in a separate window
  771. #+BEGIN_SRC emacs-lisp :results silent
  772. (autoload 'poporg-dwim "poporg" nil t)
  773. (global-set-key (kbd "C-c \"") 'poporg-dwim)
  774. #+END_SRC
  775. *** Notify
  776. #+BEGIN_SRC emacs-lisp :results silent
  777. ;;; notify.el --- notification front-end
  778. ;; Copyright (C) 2008 Mark A. Hershberger
  779. ;; Original Author: Mark A. Hershberger <mhersberger@intrahealth.org>
  780. ;; Modified by Andrey Kotlarski <m00naticus@gmail.com>
  781. ;; Modified by Andrew Gwozdziewycz <git@apgwoz.com>
  782. ;; Modified by Aidan Gauland <aidalgol@no8wireless.co.nz> October 2011
  783. ;; Modified by Olivier Sirven <the.slaa@gmail.com> November 2013
  784. ;; Keywords: extensions, convenience, lisp
  785. ;; This file is free software; you can redistribute it and/or modify
  786. ;; it under the terms of the GNU General Public License as published by
  787. ;; the Free Software Foundation; either version 2, or (at your option)
  788. ;; any later version.
  789. ;; This file is distributed in the hope that it will be useful,
  790. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  791. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  792. ;; GNU General Public License for more details.
  793. ;; You should have received a copy of the GNU General Public License
  794. ;; along with GNU Emacs; see the file COPYING. If not, write to
  795. ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  796. ;; Boston, MA 02111-1307, USA.
  797. ;;; Commentary:
  798. ;; This provides a single function, `notify', that will produce a notify
  799. ;; pop-up via D-Bus, libnotify, simple message or growl.
  800. ;; To use, just put (autoload 'notify "notify" "Notify TITLE, BODY.")
  801. ;; in your init file. You may override default chosen notification
  802. ;; method by assigning `notify-method' to one of 'notify-via-dbus
  803. ;; 'notify-via-libnotify or 'notify-via-message
  804. ;;; Code:
  805. (defvar notify-defaults (list :app "Emacs" :icon "emacs" :timeout 5000
  806. :urgency "low"
  807. :category "emacs.message")
  808. "Notification settings' defaults.
  809. May be overridden with key-value additional arguments to `notify'.")
  810. (defvar notify-delay '(0 5 0)
  811. "Minimum time allowed between notifications in time format.")
  812. (defvar notify-last-notification '(0 0 0) "Time of last notification.")
  813. (defvar notify-method 'notify-via-growl "Notification method among
  814. 'notify-via-dbus, 'notify-via-libnotify, 'notify-via-message or
  815. 'notify-via-growl")
  816. ;; determine notification method unless already set
  817. ;; prefer growl > D-Bus > libnotify > message
  818. (cond
  819. ((null notify-method)
  820. (setq notify-method
  821. (cond
  822. ((executable-find "growlnotify") 'notify-via-growl)
  823. ((and (require 'dbus nil t)
  824. (dbus-ping :session "org.freedesktop.Notifications"))
  825. (defvar notify-id 0 "Current D-Bus notification id.")
  826. 'notify-via-dbus)
  827. ((executable-find "notify-send") 'notify-via-libnotify)
  828. (t 'notify-via-message))))
  829. ((eq notify-method 'notify-via-dbus) ;housekeeping for pre-chosen DBus
  830. (if (and (require 'dbus nil t)
  831. (dbus-ping :session "org.freedesktop.Notifications"))
  832. (defvar notify-id 0 "Current D-Bus notification id.")
  833. (setq notify-method (if (executable-find "notify-send")
  834. 'notify-via-libnotify
  835. 'notify-via-message))))
  836. ((and (eq notify-method 'notify-via-libnotify)
  837. (not (executable-find "notify-send"))) ;housekeeping for pre-chosen libnotify
  838. (setq notify-method
  839. (if (and (require 'dbus nil t)
  840. (dbus-ping :session "org.freedesktop.Notifications"))
  841. (progn
  842. (defvar notify-id 0 "Current D-Bus notification id.")
  843. 'notify-via-dbus)
  844. 'notify-via-message)))
  845. ((and (eq notify-method 'notify-via-growl)
  846. (not (executable-find "growlnotify")))
  847. (setq notify-method 'notify-via-message)))
  848. (defun notify-via-dbus (title body)
  849. "Send notification with TITLE, BODY `D-Bus'."
  850. (dbus-call-method :session "org.freedesktop.Notifications"
  851. "/org/freedesktop/Notifications"
  852. "org.freedesktop.Notifications" "Notify"
  853. (get 'notify-defaults :app)
  854. (setq notify-id (+ notify-id 1))
  855. (get 'notify-defaults :icon) title body '(:array)
  856. '(:array :signature "{sv}") ':int32
  857. (get 'notify-defaults :timeout)))
  858. (defun notify-via-libnotify (title body)
  859. "Notify with TITLE, BODY via `libnotify'."
  860. (call-process "notify-send" nil 0 nil
  861. title body "-t"
  862. (number-to-string (get 'notify-defaults :timeout))
  863. "-i" (get 'notify-defaults :icon)
  864. "-u" (get 'notify-defaults :urgency)
  865. "-c" (get 'notify-defaults :category)))
  866. (defun notify-via-message (title body)
  867. "Notify TITLE, BODY with a simple message."
  868. (message "%s: %s" title body))
  869. (defun notify-via-growl (title body)
  870. "Notify TITLE, BODY with a growl"
  871. (call-process "growlnotify" nil 0 nil
  872. "-a" (get 'notify-defaults :app)
  873. "-n" (get 'notify-defaults :category)
  874. "-t" (notify-via-growl-stringify title)
  875. "-m" (notify-via-growl-stringify body)))
  876. (defun notify-via-growl-stringify (thing)
  877. (cond ((null thing) "")
  878. ((stringp thing) thing)
  879. (t (format "%s" thing))))
  880. (defun keywords-to-properties (symbol args &optional defaults)
  881. "Add to SYMBOL's property list key-values from ARGS and DEFAULTS."
  882. (when (consp defaults)
  883. (keywords-to-properties symbol defaults))
  884. (while args
  885. (put symbol (car args) (cadr args))
  886. (setq args (cddr args))))
  887. ;;;###autoload
  888. (defun notify (title body &rest args)
  889. "Notify TITLE, BODY via `notify-method'.
  890. ARGS may be amongst :timeout, :icon, :urgency, :app and :category."
  891. (when (time-less-p notify-delay
  892. (time-since notify-last-notification))
  893. (or (eq notify-method 'notify-via-message)
  894. (keywords-to-properties 'notify-defaults args
  895. notify-defaults))
  896. (setq notify-last-notification (current-time))
  897. (funcall notify-method title body)))
  898. (provide 'notify)
  899. ;;; notify.el ends here
  900. #+END_SRC
  901. *** Jabber
  902. #+BEGIN_SRC emacs-lisp :results silent
  903. (require 'jabber)
  904. (setq jabber-history-enabled t
  905. jabber-use-global-history nil
  906. jabber-backlog-number 40
  907. jabber-backlog-days 30
  908. jabber-alert-presence-message-function (lambda (_who _oldstatus _newstatus _statustext) nil)
  909. )
  910. (setq jabber-account-list '(
  911. ("olson.levi@gmail.com"
  912. (:network-server . "talk.google.com")
  913. (:connection-type . ssl))
  914. ;; ("lolson@vlocity.com"
  915. ;; (:network-server . "talk.google.com")
  916. ;; (:connection-type . ssl))
  917. ))
  918. (defvar my-chat-prompt "[%t] %n>\n" "Customized chat prompt")
  919. (when (featurep 'jabber)
  920. (setq
  921. jabber-chat-foreign-prompt-format my-chat-prompt
  922. jabber-chat-local-prompt-format my-chat-prompt
  923. jabber-groupchat-prompt-format my-chat-prompt
  924. jabber-muc-private-foreign-prompt-format "[%t] %g/%n>\n"
  925. )
  926. )
  927. (defun notify-jabber-notify (from buf text _proposed-alert)
  928. "(jabber.el hook) Notify of new Jabber chat messages via notify.el"
  929. (when (or jabber-message-alert-same-buffer
  930. (not (memq (selected-window) (get-buffer-window-list buf))))
  931. (if (jabber-muc-sender-p from)
  932. (notify (format "(PM) %s"
  933. (jabber-jid-displayname (jabber-jid-user from)))
  934. (format "%s: %s" (jabber-jid-resource from) text)))
  935. (notify (format "%s" (jabber-jid-displayname from))
  936. text)))
  937. ;; (add-hook 'jabber-alert-message-hooks 'notify-jabber-notify)
  938. ;; (require 'autosmiley)
  939. ;; (add-hook 'jabber-chat-mode-hook 'autosmiley-mode)
  940. (defun jabber ()
  941. (interactive)
  942. (jabber-connect-all)
  943. (switch-to-buffer "*-jabber-roster-*"))
  944. #+END_SRC
  945. *** Terminal-Notifier
  946. #+BEGIN_SRC emacs-lisp :results silent :tangle no
  947. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  948. ;; Terminal notifier
  949. ;; requires 'brew install terminal-notifier'
  950. ;; stolen from erc-notifier
  951. (defvar terminal-notifier-command (executable-find "terminal-notifier") "The path to terminal-notifier.")
  952. ; (terminal-notifier-notify "Emacs notification" "Something amusing happened")
  953. (defun terminal-notifier-notify (title message)
  954. "Show a message with
  955. terminal-notifier-command
  956. ."
  957. (start-process "terminal-notifier"
  958. "terminal-notifier"
  959. terminal-notifier-command
  960. "-title" title
  961. "-message" message
  962. "-activate" "org.gnu.Emacs"))
  963. (defun timed-notification (time msg)
  964. (interactive "sNotification when (e.g: 2 minutes, 60 seconds, 3 days): \nsMessage: ")
  965. (run-at-time time nil (lambda (msg) (terminal-notifier-notify "Emacs" msg)) msg))
  966. #+END_SRC
  967. *** Hyperspace
  968. #+BEGIN_SRC emacs-lisp :results silent
  969. (defun hyperspace-action->mu4e (&optional query)
  970. "Search mu4e with QUERY.
  971. If QUERY is unspecified, use the first bookmark in variable
  972. ‘mu4e-bookmarks’ and update mail and index."
  973. (mu4e-headers-search (or query (caar mu4e-bookmarks)))
  974. (unless query
  975. (mu4e-update-mail-and-index nil)))
  976. (add-to-list 'hyperspace-actions '("m4" . hyperspace-action->mu4e))
  977. (defun hyperspace-action->elfeed (&optional query)
  978. "Load elfeed, optionally searching for QUERY."
  979. (elfeed)
  980. (if query
  981. (elfeed-search-set-filter query)
  982. (elfeed-search-fetch nil)))
  983. (add-to-list 'hyperspace-actions '("lf" . hyperspace-action->elfeed))
  984. #+END_SRC
  985. ** Functions
  986. #+BEGIN_SRC emacs-lisp :results silent
  987. (defun find-user-init-file ()
  988. "Edit the `~/.emacs.d/init.org' file."
  989. (interactive)
  990. (find-file "~/.emacs.d/init.org"))
  991. (defun find-todo-file ()
  992. "Edit the `~/todo.org' file."
  993. (interactive)
  994. (find-file "~/Dropbox/Org/todo.org"))
  995. (defun load-user-init-file ()
  996. "LO: Reload the `~/.emacs.d/init.elc' file."
  997. (interactive)
  998. (load-file "~/.emacs.d/init.elc"))
  999. (defun leo-swiper ()
  1000. "LO: Custom swiper."
  1001. (interactive)
  1002. (let ((word (thing-at-point 'symbol)))
  1003. (if word (swiper (format "%s" word)))
  1004. (unless word (swiper (format ""))))
  1005. )
  1006. (defun jump-to-symbol-internal (&optional backwardp)
  1007. "Jumps to the next symbol near the point if such a symbol exists. If BACKWARDP is non-nil it jumps backward."
  1008. (let* ((point (point))
  1009. (bounds (find-tag-default-bounds))
  1010. (beg (car bounds)) (end (cdr bounds))
  1011. (str (isearch-symbol-regexp (find-tag-default)))
  1012. (search (if backwardp 'search-backward-regexp
  1013. 'search-forward-regexp)))
  1014. (goto-char (if backwardp beg end))
  1015. (funcall search str nil t)
  1016. (cond ((<= beg (point) end) (goto-char point))
  1017. (backwardp (forward-char (- point beg)))
  1018. (t (backward-char (- end point))))))
  1019. (defun jump-to-previous-like-this ()
  1020. "Jumps to the previous occurrence of the symbol at point."
  1021. (interactive)
  1022. (jump-to-symbol-internal t))
  1023. (defun jump-to-next-like-this ()
  1024. "Jumps to the next occurrence of the symbol at point."
  1025. (interactive)
  1026. (jump-to-symbol-internal))
  1027. (defun match-paren (arg)
  1028. "Go to the matching paren if on a paren; otherwise insert ARG (a literal % sign)."
  1029. (interactive "p")
  1030. (cond ((looking-at "\\s(") (forward-list 1))
  1031. ((looking-back "\\s(" 2) (backward-char 1) (forward-list 1))
  1032. ((looking-at "\\s)") (forward-char 1) (backward-list 1))
  1033. ((looking-back "\\s)" 2) (backward-list 1))
  1034. (t (self-insert-command (or arg 1)))))
  1035. (defun kill-this-buffer-unless-scratch ()
  1036. "Works like `kill-this-buffer' unless the current buffer is the *scratch* buffer. In which case the buffer content is deleted and the buffer is buried."
  1037. (interactive)
  1038. (if (not (string= (buffer-name) "*scratch*"))
  1039. (kill-this-buffer)
  1040. (delete-region (point-min) (point-max))
  1041. (switch-to-buffer (other-buffer))
  1042. (bury-buffer "*scratch*")))
  1043. (defun delete-backward-sentence ()
  1044. "LO: Delete to the beginning of the sentence/line."
  1045. (interactive)
  1046. (delete-region (point) (progn (backward-sentence) (point))))
  1047. (defun delete-backward-to-boundary (arg)
  1048. "LO: Delete backward to the previous word boundary. With ARG, do this many times."
  1049. (interactive "p")
  1050. (let ((a (point))
  1051. (b (progn
  1052. (backward-word arg)
  1053. (forward-word)
  1054. (point))))
  1055. (if (< a b)
  1056. (delete-region a (progn (backward-word arg) (point)))
  1057. (if (= a b)
  1058. (delete-region a (progn (backward-word arg) (point)))
  1059. (delete-region a b)))))
  1060. (defun comment-or-uncomment-region-or-line ()
  1061. "Comments or uncomments the region or the current line if there's no active region."
  1062. (interactive)
  1063. (let (beg end)
  1064. (if (region-active-p)
  1065. (setq beg (region-beginning) end (region-end))
  1066. (setq beg (line-beginning-position) end (line-end-position)))
  1067. (comment-or-uncomment-region beg end)))
  1068. (defun fold-toggle (column)
  1069. "Code folding by COLUMN."
  1070. (interactive "P")
  1071. (set-selective-display
  1072. (or column
  1073. (unless selective-display
  1074. (1+ (current-column))))))
  1075. (defun new-line-below ()
  1076. "LO: Create a new line below current line."
  1077. (interactive)
  1078. (move-end-of-line 1)
  1079. (newline-and-indent))
  1080. (defun new-line-above ()
  1081. "LO: Create a new line above current line."
  1082. (interactive)
  1083. (move-beginning-of-line 1)
  1084. (newline)
  1085. (forward-line -1))
  1086. (defun duplicate-thing (comment)
  1087. "LO: Duplicates the current line, or the region if active. If an argument (COMMENT) is given, the duplicated region will be commented out."
  1088. (interactive "P")
  1089. (save-excursion
  1090. (let ((start (if (region-active-p) (region-beginning) (point-at-bol)))
  1091. (end (if (region-active-p) (region-end) (point-at-eol))))
  1092. (goto-char end)
  1093. (unless (region-active-p)
  1094. (newline))
  1095. (insert (buffer-substring start end))
  1096. (when comment (comment-region start end)))))
  1097. (defun tidy ()
  1098. "LO: Ident, untabify and unwhitespacify current buffer, or region if active."
  1099. (interactive)
  1100. (let ((beg (if (region-active-p) (region-beginning) (point-min)))
  1101. (end (if (region-active-p) (region-end) (point-max))))
  1102. (let ((inhibit-message t))
  1103. (indent-region beg end))
  1104. (whitespace-cleanup)
  1105. (untabify beg (if (< end (point-max)) end (point-max)))
  1106. (if (region-active-p) (message "Indenting Region...Done") (message "Indenting File...Done"))))
  1107. (defun phil-columns ()
  1108. "LO: Good 'ol Phil-Columns."
  1109. (interactive)
  1110. (message "Good 'ol fill-columns")
  1111. (with-output-to-temp-buffer "*PHIL-COLUMN*"
  1112. (shell-command "mpv --no-video 'https://www.youtube.com/watch?v=YkADj0TPrJA&t=3m16s' > /dev/null 2>&1 & sleep 8; pkill mpv"))
  1113. (other-window 1)
  1114. (delete-window))
  1115. (declare-function first "Goto FIRST shell.")
  1116. (declare-function goto-non-shell-buffer "Goto something other than a shell buffer.")
  1117. (declare-function switch-shell "Switch shell.")
  1118. (let ((last-shell ""))
  1119. (defun toggle-shell ()
  1120. (interactive)
  1121. (cond ((string-match-p "^\\*shell<[1-9][0-9]*>\\*$" (buffer-name))
  1122. (goto-non-shell-buffer))
  1123. ((get-buffer last-shell) (switch-to-buffer last-shell))
  1124. (t (shell (setq last-shell "*shell<1>*")))))
  1125. (defun switch-shell (n)
  1126. (let ((buffer-name (format "*shell<%d>*" n)))
  1127. (setq last-shell buffer-name)
  1128. (cond ((get-buffer buffer-name)
  1129. (switch-to-buffer buffer-name))
  1130. (t (shell buffer-name)
  1131. (rename-buffer buffer-name)))))
  1132. (defun goto-non-shell-buffer ()
  1133. (let* ((r "^\\*shell<[1-9][0-9]*>\\*$")
  1134. (shell-buffer-p (lambda (b) (string-match-p r (buffer-name b))))
  1135. (non-shells (cl-remove-if shell-buffer-p (buffer-list))))
  1136. (when non-shells
  1137. (switch-to-buffer (first non-shells))))))
  1138. (defadvice shell (after kill-with-no-query nil activate)
  1139. "."
  1140. (set-process-query-on-exit-flag (get-buffer-process ad-return-value) nil))
  1141. (declare-function comint-truncate-buffer ".")
  1142. (defun clear-comint ()
  1143. "Run `comint-truncate-buffer' with the `comint-buffer-maximum-size' set to zero."
  1144. (interactive)
  1145. (let ((comint-buffer-maximum-size 0))
  1146. (comint-truncate-buffer)))
  1147. (defun c-setup ()
  1148. "Compile."
  1149. (local-set-key (kbd "C-c C-c") 'compile))
  1150. #+END_SRC
  1151. ** Bindings
  1152. #+begin_src emacs-lisp :results silent
  1153. (require 'company)
  1154. (add-hook 'comint-mode-hook (lambda () (local-set-key (kbd "c-l") 'clear-comint)))
  1155. (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
  1156. (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
  1157. (add-hook 'c-mode-common-hook 'c-setup)
  1158. (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
  1159. (defvar company-active-map (make-keymap)
  1160. "company mode keymap.")
  1161. (defvar custom-bindings (make-keymap)
  1162. "a keymap of custom bindings.")
  1163. (define-key custom-bindings (kbd "M-p") 'jump-to-previous-like-this)
  1164. (define-key custom-bindings (kbd "M-n") 'jump-to-next-like-this)
  1165. (define-key custom-bindings (kbd "M-<tab>") 'switch-to-next-buffer)
  1166. (define-key custom-bindings (kbd "M-<backspace>")'delete-backward-to-boundary)
  1167. (define-key custom-bindings (kbd "C-<backspace>")'delete-backward-to-boundary)
  1168. (define-key custom-bindings (kbd "C-}") 'mc/mark-next-like-this)
  1169. (define-key custom-bindings (kbd "C-)") 'mc/unmark-next-like-this)
  1170. (define-key custom-bindings (kbd "C-{") 'mc/mark-previous-like-this)
  1171. (define-key custom-bindings (kbd "C-(") 'mc/unmark-previous-like-this)
  1172. (define-key custom-bindings (kbd "C-'") 'mc-hide-unmatched-lines-mode)
  1173. (define-key custom-bindings (kbd "C-c 1") 'mc/insert-numbers)
  1174. (define-key custom-bindings (kbd "C-c s") 'mc/sort-regions)
  1175. (define-key custom-bindings "%" 'match-paren)
  1176. (define-key custom-bindings (kbd "C-x .") 'dash-at-point)
  1177. (define-key custom-bindings (kbd "C-x ,") 'dash-at-point-with-docset)
  1178. (define-key custom-bindings (kbd "C-s") 'leo-swiper)
  1179. (define-key custom-bindings (kbd "C-x C-l m") 'mu4e)
  1180. (define-key custom-bindings (kbd "C-x C-o t") 'find-todo-file)
  1181. (define-key custom-bindings (kbd "C-x C-l j") 'jabber)
  1182. (define-key custom-bindings (kbd "C-x C-l f") 'elfeed)
  1183. (define-key custom-bindings (kbd "C-x C-l a") 'org-agenda)
  1184. (define-key custom-bindings (kbd "C-x C-l c") 'calendar)
  1185. (define-key custom-bindings (kbd "M-SPC") #'hyperspace)
  1186. ;; (dolist (n (number-sequence 1 9))
  1187. ;; (global-set-key (kbd (concat "M-" (int-to-string n)))
  1188. ;; (lambda () (interactive) (switch-shell n))))
  1189. (define-key company-active-map (kbd "C-d") 'company-show-doc-buffer)
  1190. (define-key company-active-map (kbd "C-n") 'company-select-next)
  1191. (define-key company-active-map (kbd "C-p") 'company-select-previous)
  1192. (define-key company-active-map (kbd "<tab>") 'company-complete)
  1193. (define-key custom-bindings (kbd "C-c p") 'counsel-projectile-switch-project)
  1194. (define-key custom-bindings (kbd "C-c f") 'counsel-projectile-find-file)
  1195. (define-key custom-bindings (kbd "C-c c") 'ivy-resume)
  1196. (define-key custom-bindings (kbd "C-c m") 'magit-status)
  1197. (define-key custom-bindings (kbd "C-c D") 'define-word-at-point)
  1198. (define-key custom-bindings (kbd "C-@") 'er/expand-region)
  1199. (define-key custom-bindings (kbd "C-#") 'er/contract-region)
  1200. (define-key custom-bindings (kbd "C-S-c C-S-c") 'mc/edit-lines)
  1201. (define-key custom-bindings (kbd "C-c b") 'ivy-switch-buffer)
  1202. (define-key custom-bindings (kbd "C-c l") 'org-store-link)
  1203. (define-key custom-bindings (kbd "C-c t") 'org-set-tags)
  1204. (define-key custom-bindings (kbd "M-u") 'upcase-dwim)
  1205. (define-key custom-bindings (kbd "M-c") 'capitalize-dwim)
  1206. (define-key custom-bindings (kbd "M-l") 'downcase-dwim)
  1207. (define-key custom-bindings (kbd "M-o") 'other-window)
  1208. (define-key custom-bindings (kbd "C-c s") 'ispell-word)
  1209. (define-key custom-bindings (kbd "C-c C-d") 'org-capture)
  1210. (define-key custom-bindings (kbd "C-c <up>") 'windmove-up)
  1211. (define-key custom-bindings (kbd "C-c <down>") 'windmove-down)
  1212. (define-key custom-bindings (kbd "C-c <left>") 'windmove-left)
  1213. (define-key custom-bindings (kbd "C-c <right>") 'windmove-right)
  1214. (define-key custom-bindings (kbd "C-c a") (lambda () (interactive) (org-agenda nil "n")))
  1215. (define-key custom-bindings (kbd "C-c e") 'find-user-init-file)
  1216. (define-key custom-bindings (kbd "C-x f") 'phil-columns)
  1217. (define-key custom-bindings (kbd "C-x k") 'kill-this-buffer-unless-scratch)
  1218. (define-key custom-bindings (kbd "C-c d") 'duplicate-thing)
  1219. (define-key custom-bindings (kbd "C-;") 'comment-or-uncomment-region-or-line)
  1220. (define-key custom-bindings (kbd "C-o") 'new-line-below)
  1221. (define-key custom-bindings (kbd "C-S-o") 'new-line-above)
  1222. (define-key custom-bindings (kbd "<C-tab>") 'tidy)
  1223. (define-key custom-bindings (kbd "M-q") 'kill-this-buffer)
  1224. ;; (define-key custom-bindings (kbd "M-RET") '(lambda () (interactive) (term (getenv "SHELL"))))
  1225. (define-minor-mode custom-bindings-mode
  1226. "A mode that activates custom-bindings."
  1227. t nil custom-bindings)
  1228. #+END_SRC
  1229. ** Development Specific
  1230. *** General
  1231. #+BEGIN_SRC emacs-lisp :results silent
  1232. (require 'rainbow-delimiters)
  1233. (global-flycheck-mode)
  1234. (add-hook 'before-save-hook 'delete-trailing-whitespace)
  1235. (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
  1236. (setq-default indent-tabs-mode nil
  1237. tab-width 4)
  1238. (defvaralias 'c-basic-offset 'tab-width)
  1239. (defvaralias 'cperl-indent-level 'tab-width)
  1240. (electric-pair-mode 1)
  1241. (show-paren-mode 1)
  1242. (require 'dockerfile-mode)
  1243. (add-to-list 'auto-mode-alist '("Dockerfile*\\'" . dockerfile-mode))
  1244. (require 'gitignore-mode)
  1245. (add-to-list 'auto-mode-alist '("gitignore\\'" . gitignore-mode))
  1246. ;; Workaround to get Projectile to work again
  1247. (setq projectile-git-submodule-command nil)
  1248. (require 'json-mode)
  1249. (add-to-list 'auto-mode-alist '("\\.json\\'" . json-mode))
  1250. (require 'web-mode)
  1251. (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
  1252. #+END_SRC
  1253. *** Python
  1254. #+BEGIN_SRC emacs-lisp :results silent
  1255. (elpy-enable)
  1256. (setq python-shell-interpreter "jupyter"
  1257. python-shell-interpreter-args "console --simple-prompt")
  1258. (when (require 'flycheck nil t)
  1259. (setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
  1260. (add-hook 'elpy-mode-hook 'flycheck-mode))
  1261. (require 'py-autopep8)
  1262. (setq py-autopep8-options '("--ignore=E501"))
  1263. (add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)
  1264. #+END_SRC
  1265. *** Go
  1266. #+BEGIN_SRC emacs-lisp :results silent
  1267. (require 'go-mode)
  1268. (require 'go-playground)
  1269. (require 'gorepl-mode)
  1270. (require 'company-go)
  1271. (add-to-list 'auto-mode-alist '("\\.go\\'" . go-mode))
  1272. (add-hook 'go-mode-hook (lambda ()
  1273. (add-hook 'before-save-hook 'gofmt-before-save)
  1274. (local-set-key (kbd "M-.") 'godef-jump)
  1275. (local-set-key (kbd "M-,") 'pop-tag-mark)
  1276. (local-set-key (kbd "C-c C-c") (lambda ()
  1277. (interactive)
  1278. (ansi-term)
  1279. (comint-send-string "*ansi-term*" "make\n")))
  1280. (set (make-local-variable 'company-backends) '(company-go))
  1281. (setq company-tooltip-limit 20
  1282. company-echo-delay 0
  1283. company-begin-commands '(self-insert-command))
  1284. (gorepl-mode)))
  1285. (defun set-exec-path-from-shell-PATH ()
  1286. (let ((path-from-shell (replace-regexp-in-string
  1287. "[ \t\n]*$"
  1288. ""
  1289. (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'"))))
  1290. (setenv "PATH" path-from-shell)
  1291. (setq eshell-path-env path-from-shell)
  1292. (setq exec-path (split-string path-from-shell path-separator))))
  1293. (when window-system (set-exec-path-from-shell-PATH))
  1294. (setenv "GOPATH" "/home/locust/go")
  1295. (add-to-list 'exec-path "/home/locust/go/bin")
  1296. #+END_SRC
  1297. *** JS
  1298. **** Indium
  1299. #+BEGIN_SRC emacs-lisp :results silent
  1300. (add-to-list 'exec-path "/usr/local/bin")
  1301. #+END_SRC
  1302. *** TypeScript
  1303. #+BEGIN_SRC emacs-lisp :results silent
  1304. (defun setup-tide-mode ()
  1305. "Tide setup function."
  1306. (interactive)
  1307. (tide-setup)
  1308. (flycheck-mode +1)
  1309. (setq flycheck-check-syntax-automatically '(save mode-enabled))
  1310. (eldoc-mode +1)
  1311. (tide-hl-identifier-mode +1)
  1312. (company-mode +1))
  1313. ;; aligns annotation to the right hand side
  1314. (setq company-tooltip-align-annotations t)
  1315. ;; formats the buffer before saving
  1316. (add-hook 'before-save-hook 'tide-format-before-save)
  1317. (add-hook 'typescript-mode-hook #'setup-tide-mode)
  1318. (require 'typescript-mode)
  1319. (require 'tide)
  1320. (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))
  1321. (add-hook 'typescript-mode-hook
  1322. '(lambda ()
  1323. (set (make-local-variable 'company-backends) '(company-tide))
  1324. (setq company-tooltip-limit 20
  1325. company-echo-delay 0
  1326. company-begin-commands '(self-insert-command)
  1327. tide-format-options '(:insertSpaceAfterFunctionKeywordForAnonymousFunctions t :placeOpenBraceOnNewLineForFunctions nil))
  1328. (tide-setup)))
  1329. #+END_SRC
  1330. **** TSX
  1331. #+BEGIN_SRC emacs-lisp :results silent
  1332. (require 'web-mode)
  1333. (add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode))
  1334. (add-hook 'web-mode-hook
  1335. (lambda ()
  1336. (when (string-equal "tsx" (file-name-extension buffer-file-name))
  1337. (setup-tide-mode))))
  1338. ;; enable typescript-tslint checker
  1339. (flycheck-add-mode 'typescript-tslint 'web-mode)
  1340. #+END_SRC
  1341. **** JSX
  1342. #+BEGIN_SRC emacs-lisp :results silent
  1343. (require 'web-mode)
  1344. (add-to-list 'auto-mode-alist '("\\.jsx\\'" . web-mode))
  1345. (add-hook 'web-mode-hook
  1346. (lambda ()
  1347. (when (string-equal "jsx" (file-name-extension buffer-file-name))
  1348. (setup-tide-mode))))
  1349. ;; configure jsx-tide checker to run after your default jsx checker
  1350. (flycheck-add-mode 'javascript-eslint 'web-mode)
  1351. (flycheck-add-next-checker 'javascript-eslint 'jsx-tide 'append)
  1352. #+END_SRC
  1353. *** Org
  1354. #+BEGIN_SRC emacs-lisp :results silent
  1355. (org-babel-do-load-languages
  1356. 'org-babel-load-languages
  1357. '((js . t)
  1358. (shell . t)
  1359. (emacs-lisp . t)))
  1360. (setq org-todo-keywords
  1361. '((sequence "TODO(t)" "|" "DONE(d)")
  1362. (sequence "BUG(b)" "|" "INPROGRESS(i)" "FIXED(f)")
  1363. (sequence "TEST(T)" "NOTEST(N)" "|" "COMPLETE(C)")
  1364. (sequence "|" "CANCELED(c)")
  1365. (sequence "|" "NEEDCLARIFICATION(n)")
  1366. (sequence "|" "PROVIDEUPDATE(p)")
  1367. (sequence "|" "WAITING(w)")
  1368. ))
  1369. (setq org-agenda-files
  1370. '("~/Dropbox/Org/todo.org"
  1371. "~/Dropbox/Org/archive.org"))
  1372. (setq org-refile-targets
  1373. '((nil :maxlevel . 1)
  1374. (org-agenda-files :maxlevel . 1)))
  1375. ;; (add-hook 'focus-in-hook
  1376. ;; (lambda () (progn
  1377. ;; (setq org-tags-column (- 5 (frame-width)))) (org-align-all-tags)))
  1378. ;; (add-hook 'focus-out-hook
  1379. ;; (lambda () (progn
  1380. ;; (setq org-tags-column (- 5 (frame-width)))) (org-align-all-tags)))
  1381. (defvar org-src-tab-acts-natively)
  1382. (setq org-src-tab-acts-natively t)
  1383. (defvar org-confirm-babel-evaluate)
  1384. (defun my-org-confirm-babel-evaluate (lang _body)
  1385. "Execute certain languages without confirming.
  1386. Takes LANG to allow and BODY to execute."
  1387. (not (or (string= lang "js")
  1388. (string= lang "restclient")
  1389. (string= lang "emacs-lisp")
  1390. (string= lang "shell"))))
  1391. (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
  1392. (add-to-list 'org-structure-template-alist
  1393. (list "e" (concat "#+BEGIN_SRC emacs-lisp :results silent\n"
  1394. "\n"
  1395. "#+END_SRC")))
  1396. (add-to-list 'org-structure-template-alist
  1397. (list "j" (concat "#+BEGIN_SRC js :cmd \"/usr/local/bin/babel-node\" :results output code\n"
  1398. "\n"
  1399. "#+END_SRC")))
  1400. (add-to-list 'org-structure-template-alist
  1401. (list "r" (concat "#+BEGIN_SRC restclient :results raw\n"
  1402. "\n"
  1403. "#+END_SRC")))
  1404. (defun my-org-config ()
  1405. "Activate org and yas in 'org-mode' buffers."
  1406. (yas-minor-mode)
  1407. (lambda ()
  1408. (local-set-key (kbd "M-RET") 'org-insert-todo-heading)
  1409. (global-set-key (kbd "C-c c") nil)
  1410. (local-set-key (kbd "C-c c i") 'org-clock-in)
  1411. (local-set-key (kbd "C-c c o") 'org-clock-out)
  1412. )
  1413. )
  1414. (add-hook 'org-mode-hook #'my-org-config)
  1415. #+END_SRC
  1416. **** Presentations - Reveal
  1417. #+BEGIN_SRC emacs-lisp :results silent
  1418. (require 'ox-reveal)
  1419. (setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js"
  1420. org-reveal-klipsify-src t)
  1421. #+END_SRC
  1422. **** Mu4e
  1423. #+BEGIN_SRC emacs-lisp :results silent
  1424. ;;store org-mode links to messages
  1425. (require 'org-mu4e)
  1426. ;;store link to message if in header view, not to header query
  1427. (setq org-mu4e-link-query-in-headers-mode nil)
  1428. (setq org-capture-templates
  1429. '(("t" "todo" entry (file+headline "~/Dropbox/Org/todo.org" "Tasks")
  1430. "* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n")))
  1431. #+END_SRC
  1432. **** ElFeed
  1433. #+BEGIN_SRC emacs-lisp :results silent
  1434. (elfeed-org)
  1435. (setq rmh-elfeed-org-files (list "~/Dropbox/Org/elfeed.org"))
  1436. (defun leo/elfeed-search (arg)
  1437. "Search for ARG in feed."
  1438. (interactive)
  1439. (elfeed-search-set-filter arg))
  1440. (define-key elfeed-search-mode-map "a" (lambda () (interactive) (leo/elfeed-search "")))
  1441. (define-key elfeed-search-mode-map "e" (lambda () (interactive) (leo/elfeed-search "+emacs")))
  1442. (define-key elfeed-search-mode-map "d" (lambda () (interactive) (leo/elfeed-search "+daily")))
  1443. (define-key elfeed-search-mode-map "x" (lambda () (interactive) (leo/elfeed-search "xkcd")))
  1444. #+End_SRC
  1445. ** UI
  1446. #+BEGIN_SRC emacs-lisp :results silent
  1447. (cond ((member "PragmataPro Mono Liga" (font-family-list))
  1448. (set-face-attribute 'default nil :font "PragmataPro Mono Liga-13")))
  1449. #+END_SRC
  1450. *** Org Headings
  1451. #+BEGIN_SRC emacs-lisp :results silent
  1452. (set-face-attribute 'org-level-1 nil :height 1.5)
  1453. (set-face-attribute 'org-level-2 nil :height 1.2)
  1454. (set-face-attribute 'org-level-3 nil :height 1.1)
  1455. (set-face-attribute 'org-level-4 nil :height 1.1)
  1456. (set-face-attribute 'org-scheduled-today nil :height 1.0)
  1457. (set-face-attribute 'org-agenda-date-today nil :height 1.1)
  1458. ;; (set-face-attribute 'org-table nil :foreground "#008787")
  1459. #+END_SRC
  1460. *** Rainbow Mode (highlight hex colors)
  1461. #+BEGIN_SRC emacs-lisp :results silent
  1462. ;;; rainbow-mode.el --- Colorize color names in buffers
  1463. ;; Copyright (C) 2010-2018 Free Software Foundation, Inc
  1464. ;; Author: Julien Danjou <julien@danjou.info>
  1465. ;; Keywords: faces
  1466. ;; Version: 1.0.1
  1467. ;; This file is part of GNU Emacs.
  1468. ;; GNU Emacs is free software: you can redistribute it and/or modify
  1469. ;; it under the terms of the GNU General Public License as published by
  1470. ;; the Free Software Foundation, either version 3 of the License, or
  1471. ;; (at your option) any later version.
  1472. ;; GNU Emacs is distributed in the hope that it will be useful,
  1473. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  1474. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  1475. ;; GNU General Public License for more details.
  1476. ;; You should have received a copy of the GNU General Public License
  1477. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  1478. ;;; Commentary:
  1479. ;;
  1480. ;; This minor mode sets background color to strings that match color
  1481. ;; names, e.g. #0000ff is displayed in white with a blue background.
  1482. ;;
  1483. ;;; Code:
  1484. (eval-when-compile
  1485. (require 'cl))
  1486. (require 'regexp-opt)
  1487. (require 'faces)
  1488. (require 'color)
  1489. (unless (require 'xterm-color nil t)
  1490. (require 'ansi-color))
  1491. (defgroup rainbow nil
  1492. "Show color strings with a background color."
  1493. :tag "Rainbow"
  1494. :group 'help)
  1495. ;;; Hexadecimal colors
  1496. (defvar rainbow-hexadecimal-colors-font-lock-keywords
  1497. '(("[^&]\\(#\\(?:[0-9a-fA-F]\\{3\\}\\)+\\{1,4\\}\\)"
  1498. (1 (rainbow-colorize-itself 1)))
  1499. ("^\\(#\\(?:[0-9a-fA-F]\\{3\\}\\)+\\{1,4\\}\\)"
  1500. (0 (rainbow-colorize-itself)))
  1501. ("[Rr][Gg][Bb]:[0-9a-fA-F]\\{1,4\\}/[0-9a-fA-F]\\{1,4\\}/[0-9a-fA-F]\\{1,4\\}"
  1502. (0 (rainbow-colorize-itself)))
  1503. ("[Rr][Gg][Bb][Ii]:[0-9.]+/[0-9.]+/[0-9.]+"
  1504. (0 (rainbow-colorize-itself)))
  1505. ("\\(?:[Cc][Ii][Ee]\\(?:[Xx][Yy][Zz]\\|[Uu][Vv][Yy]\\|[Xx][Yy][Yy]\\|[Ll][Aa][Bb]\\|[Ll][Uu][Vv]\\)\\|[Tt][Ee][Kk][Hh][Vv][Cc]\\):[+-]?[0-9.]+\\(?:[Ee][+-]?[0-9]+\\)?/[+-]?[0-9.]+\\(?:[Ee][+-]?[0-9]+\\)?/[+-]?[0-9.]+\\(?:[Ee][+-]?[0-9]+\\)?"
  1506. (0 (rainbow-colorize-itself))))
  1507. "Font-lock keywords to add for hexadecimal colors.")
  1508. ;;; rgb() colors
  1509. (defvar rainbow-html-rgb-colors-font-lock-keywords
  1510. '(("rgb(\s*\\([0-9]\\{1,3\\}\\(?:\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*)"
  1511. (0 (rainbow-colorize-rgb)))
  1512. ("rgba(\s*\\([0-9]\\{1,3\\}\\(?:\\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\\.[0-9]\\)?\\(?:\s*%\\)?\\)\s*,\s*[0-9]*\.?[0-9]+\s*%?\s*)"
  1513. (0 (rainbow-colorize-rgb)))
  1514. ("hsl(\s*\\([0-9]\\{1,3\\}\\)\s*,\s*\\([0-9]\\{1,3\\}\\)\s*%\s*,\s*\\([0-9]\\{1,3\\}\\)\s*%\s*)"
  1515. (0 (rainbow-colorize-hsl)))
  1516. ("hsla(\s*\\([0-9]\\{1,3\\}\\)\s*,\s*\\([0-9]\\{1,3\\}\\)\s*%\s*,\s*\\([0-9]\\{1,3\\}\\)\s*%\s*,\s*[0-9]*\.?[0-9]+\s*%?\s*)"
  1517. (0 (rainbow-colorize-hsl))))
  1518. "Font-lock keywords to add for RGB colors.")
  1519. ;;; HTML colors
  1520. (defvar rainbow-html-colors-font-lock-keywords nil
  1521. "Font-lock keywords to add for HTML colors.")
  1522. (make-variable-buffer-local 'rainbow-html-colors-font-lock-keywords)
  1523. (defcustom rainbow-html-colors-alist
  1524. '(("AliceBlue" . "#F0F8FF")
  1525. ("AntiqueWhite" . "#FAEBD7")
  1526. ("Aqua" . "#00FFFF")
  1527. ("Aquamarine" . "#7FFFD4")
  1528. ("Azure" . "#F0FFFF")
  1529. ("Beige" . "#F5F5DC")
  1530. ("Bisque" . "#FFE4C4")
  1531. ("Black" . "#000000")
  1532. ("BlanchedAlmond" . "#FFEBCD")
  1533. ("Blue" . "#0000FF")
  1534. ("BlueViolet" . "#8A2BE2")
  1535. ("Brown" . "#A52A2A")
  1536. ("BurlyWood" . "#DEB887")
  1537. ("CadetBlue" . "#5F9EA0")
  1538. ("Chartreuse" . "#7FFF00")
  1539. ("Chocolate" . "#D2691E")
  1540. ("Coral" . "#FF7F50")
  1541. ("CornflowerBlue" . "#6495ED")
  1542. ("Cornsilk" . "#FFF8DC")
  1543. ("Crimson" . "#DC143C")
  1544. ("Cyan" . "#00FFFF")
  1545. ("DarkBlue" . "#00008B")
  1546. ("DarkCyan" . "#008B8B")
  1547. ("DarkGoldenRod" . "#B8860B")
  1548. ("DarkGray" . "#A9A9A9")
  1549. ("DarkGrey" . "#A9A9A9")
  1550. ("DarkGreen" . "#006400")
  1551. ("DarkKhaki" . "#BDB76B")
  1552. ("DarkMagenta" . "#8B008B")
  1553. ("DarkOliveGreen" . "#556B2F")
  1554. ("Darkorange" . "#FF8C00")
  1555. ("DarkOrchid" . "#9932CC")
  1556. ("DarkRed" . "#8B0000")
  1557. ("DarkSalmon" . "#E9967A")
  1558. ("DarkSeaGreen" . "#8FBC8F")
  1559. ("DarkSlateBlue" . "#483D8B")
  1560. ("DarkSlateGray" . "#2F4F4F")
  1561. ("DarkSlateGrey" . "#2F4F4F")
  1562. ("DarkTurquoise" . "#00CED1")
  1563. ("DarkViolet" . "#9400D3")
  1564. ("DeepPink" . "#FF1493")
  1565. ("DeepSkyBlue" . "#00BFFF")
  1566. ("DimGray" . "#696969")
  1567. ("DimGrey" . "#696969")
  1568. ("DodgerBlue" . "#1E90FF")
  1569. ("FireBrick" . "#B22222")
  1570. ("FloralWhite" . "#FFFAF0")
  1571. ("ForestGreen" . "#228B22")
  1572. ("Fuchsia" . "#FF00FF")
  1573. ("Gainsboro" . "#DCDCDC")
  1574. ("GhostWhite" . "#F8F8FF")
  1575. ("Gold" . "#FFD700")
  1576. ("GoldenRod" . "#DAA520")
  1577. ("Gray" . "#808080")
  1578. ("Grey" . "#808080")
  1579. ("Green" . "#008000")
  1580. ("GreenYellow" . "#ADFF2F")
  1581. ("HoneyDew" . "#F0FFF0")
  1582. ("HotPink" . "#FF69B4")
  1583. ("IndianRed" . "#CD5C5C")
  1584. ("Indigo" . "#4B0082")
  1585. ("Ivory" . "#FFFFF0")
  1586. ("Khaki" . "#F0E68C")
  1587. ("Lavender" . "#E6E6FA")
  1588. ("LavenderBlush" . "#FFF0F5")
  1589. ("LawnGreen" . "#7CFC00")
  1590. ("LemonChiffon" . "#FFFACD")
  1591. ("LightBlue" . "#ADD8E6")
  1592. ("LightCoral" . "#F08080")
  1593. ("LightCyan" . "#E0FFFF")
  1594. ("LightGoldenRodYellow" . "#FAFAD2")
  1595. ("LightGray" . "#D3D3D3")
  1596. ("LightGrey" . "#D3D3D3")
  1597. ("LightGreen" . "#90EE90")
  1598. ("LightPink" . "#FFB6C1")
  1599. ("LightSalmon" . "#FFA07A")
  1600. ("LightSeaGreen" . "#20B2AA")
  1601. ("LightSkyBlue" . "#87CEFA")
  1602. ("LightSlateGray" . "#778899")
  1603. ("LightSlateGrey" . "#778899")
  1604. ("LightSteelBlue" . "#B0C4DE")
  1605. ("LightYellow" . "#FFFFE0")
  1606. ("Lime" . "#00FF00")
  1607. ("LimeGreen" . "#32CD32")
  1608. ("Linen" . "#FAF0E6")
  1609. ("Magenta" . "#FF00FF")
  1610. ("Maroon" . "#800000")
  1611. ("MediumAquaMarine" . "#66CDAA")
  1612. ("MediumBlue" . "#0000CD")
  1613. ("MediumOrchid" . "#BA55D3")
  1614. ("MediumPurple" . "#9370D8")
  1615. ("MediumSeaGreen" . "#3CB371")
  1616. ("MediumSlateBlue" . "#7B68EE")
  1617. ("MediumSpringGreen" . "#00FA9A")
  1618. ("MediumTurquoise" . "#48D1CC")
  1619. ("MediumVioletRed" . "#C71585")
  1620. ("MidnightBlue" . "#191970")
  1621. ("MintCream" . "#F5FFFA")
  1622. ("MistyRose" . "#FFE4E1")
  1623. ("Moccasin" . "#FFE4B5")
  1624. ("NavajoWhite" . "#FFDEAD")
  1625. ("Navy" . "#000080")
  1626. ("OldLace" . "#FDF5E6")
  1627. ("Olive" . "#808000")
  1628. ("OliveDrab" . "#6B8E23")
  1629. ("Orange" . "#FFA500")
  1630. ("OrangeRed" . "#FF4500")
  1631. ("Orchid" . "#DA70D6")
  1632. ("PaleGoldenRod" . "#EEE8AA")
  1633. ("PaleGreen" . "#98FB98")
  1634. ("PaleTurquoise" . "#AFEEEE")
  1635. ("PaleVioletRed" . "#D87093")
  1636. ("PapayaWhip" . "#FFEFD5")
  1637. ("PeachPuff" . "#FFDAB9")
  1638. ("Peru" . "#CD853F")
  1639. ("Pink" . "#FFC0CB")
  1640. ("Plum" . "#DDA0DD")
  1641. ("PowderBlue" . "#B0E0E6")
  1642. ("Purple" . "#800080")
  1643. ("Red" . "#FF0000")
  1644. ("RosyBrown" . "#BC8F8F")
  1645. ("RoyalBlue" . "#4169E1")
  1646. ("SaddleBrown" . "#8B4513")
  1647. ("Salmon" . "#FA8072")
  1648. ("SandyBrown" . "#F4A460")
  1649. ("SeaGreen" . "#2E8B57")
  1650. ("SeaShell" . "#FFF5EE")
  1651. ("Sienna" . "#A0522D")
  1652. ("Silver" . "#C0C0C0")
  1653. ("SkyBlue" . "#87CEEB")
  1654. ("SlateBlue" . "#6A5ACD")
  1655. ("SlateGray" . "#708090")
  1656. ("SlateGrey" . "#708090")
  1657. ("Snow" . "#FFFAFA")
  1658. ("SpringGreen" . "#00FF7F")
  1659. ("SteelBlue" . "#4682B4")
  1660. ("Tan" . "#D2B48C")
  1661. ("Teal" . "#008080")
  1662. ("Thistle" . "#D8BFD8")
  1663. ("Tomato" . "#FF6347")
  1664. ("Turquoise" . "#40E0D0")
  1665. ("Violet" . "#EE82EE")
  1666. ("Wheat" . "#F5DEB3")
  1667. ("White" . "#FFFFFF")
  1668. ("WhiteSmoke" . "#F5F5F5")
  1669. ("Yellow" . "#FFFF00")
  1670. ("YellowGreen" . "#9ACD32"))
  1671. "Alist of HTML colors.
  1672. Each entry should have the form (COLOR-NAME . HEXADECIMAL-COLOR)."
  1673. :type 'alist
  1674. :group 'rainbow)
  1675. (defcustom rainbow-html-colors-major-mode-list
  1676. '(html-mode css-mode php-mode nxml-mode xml-mode)
  1677. "List of major mode where HTML colors are enabled when
  1678. `rainbow-html-colors' is set to auto."
  1679. :type '(repeat (symbol :tag "Major-Mode"))
  1680. :group 'rainbow)
  1681. (defcustom rainbow-html-colors 'auto
  1682. "When to enable HTML colors.
  1683. If set to t, the HTML colors will be enabled. If set to nil, the
  1684. HTML colors will not be enabled. If set to auto, the HTML colors
  1685. will be enabled if a major mode has been detected from the
  1686. `rainbow-html-colors-major-mode-list'."
  1687. :type '(choice (symbol :tag "enable in certain modes" auto)
  1688. (symbol :tag "enable globally" t)
  1689. (symbol :tag "disable" nil))
  1690. :group 'rainbow)
  1691. ;;; X colors
  1692. (defvar rainbow-x-colors-font-lock-keywords
  1693. `((,(regexp-opt (x-defined-colors) 'words)
  1694. (0 (rainbow-colorize-itself))))
  1695. "Font-lock keywords to add for X colors.")
  1696. (defcustom rainbow-x-colors-major-mode-list
  1697. '(emacs-lisp-mode lisp-interaction-mode c-mode c++-mode java-mode)
  1698. "List of major mode where X colors are enabled when
  1699. `rainbow-x-colors' is set to auto."
  1700. :type '(repeat (symbol :tag "Major-Mode"))
  1701. :group 'rainbow)
  1702. (defcustom rainbow-x-colors 'auto
  1703. "When to enable X colors.
  1704. If set to t, the X colors will be enabled. If set to nil, the
  1705. X colors will not be enabled. If set to auto, the X colors
  1706. will be enabled if a major mode has been detected from the
  1707. `rainbow-x-colors-major-mode-list'."
  1708. :type '(choice (symbol :tag "enable in certain modes" auto)
  1709. (symbol :tag "enable globally" t)
  1710. (symbol :tag "disable" nil))
  1711. :group 'rainbow)
  1712. ;;; LaTeX colors
  1713. (defvar rainbow-latex-rgb-colors-font-lock-keywords
  1714. '(("{rgb}{\\([0-9.]+\\),\s*\\([0-9.]+\\),\s*\\([0-9.]+\\)}"
  1715. (0 (rainbow-colorize-rgb-float)))
  1716. ("{RGB}{\\([0-9]\\{1,3\\}\\),\s*\\([0-9]\\{1,3\\}\\),\s*\\([0-9]\\{1,3\\}\\)}"
  1717. (0 (rainbow-colorize-rgb)))
  1718. ("{HTML}{\\([0-9A-Fa-f]\\{6\\}\\)}"
  1719. (0 (rainbow-colorize-hexadecimal-without-sharp))))
  1720. "Font-lock keywords to add for LaTeX colors.")
  1721. (defcustom rainbow-latex-colors-major-mode-list
  1722. '(latex-mode)
  1723. "List of major mode where LaTeX colors are enabled when
  1724. `rainbow-x-colors' is set to auto."
  1725. :type '(repeat (symbol :tag "Major-Mode"))
  1726. :group 'rainbow)
  1727. (defcustom rainbow-latex-colors 'auto
  1728. "When to enable LaTeX colors.
  1729. If set to t, the LaTeX colors will be enabled. If set to nil, the
  1730. LaTeX colors will not be enabled. If set to auto, the LaTeX colors
  1731. will be enabled if a major mode has been detected from the
  1732. `rainbow-latex-colors-major-mode-list'."
  1733. :type '(choice (symbol :tag "enable in certain modes" auto)
  1734. (symbol :tag "enable globally" t)
  1735. (symbol :tag "disable" nil))
  1736. :group 'rainbow)
  1737. ;;; Shell colors
  1738. (defvar rainbow-ansi-colors-font-lock-keywords
  1739. '(("\\(\\\\[eE]\\|\\\\033\\|\\\\x1[bB]\\|\033\\)\\[\\([0-9;]*m\\)"
  1740. (0 (rainbow-colorize-ansi))))
  1741. "Font-lock keywords to add for ANSI colors.")
  1742. (defcustom rainbow-ansi-colors-major-mode-list
  1743. '(sh-mode c-mode c++-mode)
  1744. "List of major mode where ANSI colors are enabled when
  1745. `rainbow-ansi-colors' is set to auto."
  1746. :type '(repeat (symbol :tag "Major-Mode"))
  1747. :group 'rainbow)
  1748. (defcustom rainbow-ansi-colors 'auto
  1749. "When to enable ANSI colors.
  1750. If set to t, the ANSI colors will be enabled. If set to nil, the
  1751. ANSI colors will not be enabled. If set to auto, the ANSI colors
  1752. will be enabled if a major mode has been detected from the
  1753. `rainbow-ansi-colors-major-mode-list'."
  1754. :type '(choice (symbol :tag "enable in certain modes" auto)
  1755. (symbol :tag "enable globally" t)
  1756. (symbol :tag "disable" nil))
  1757. :group 'rainbow)
  1758. ;;; R colors
  1759. (defvar rainbow-r-colors-font-lock-keywords nil
  1760. "Font-lock keywords to add for R colors.")
  1761. (make-variable-buffer-local 'rainbow-r-colors-font-lock-keywords)
  1762. ;; use the following code to generate the list in R
  1763. ;; output_colors <- function(colors) {for(color in colors) {col <- col2rgb(color); cat(sprintf("(\"%s\" . \"#%02X%02X%02X\")\n",color,col[1],col[2],col[3]));}}
  1764. ;; output_colors(colors())
  1765. (defcustom rainbow-r-colors-alist
  1766. '(("white" . "#FFFFFF")
  1767. ("aliceblue" . "#F0F8FF")
  1768. ("antiquewhite" . "#FAEBD7")
  1769. ("antiquewhite1" . "#FFEFDB")
  1770. ("antiquewhite2" . "#EEDFCC")
  1771. ("antiquewhite3" . "#CDC0B0")
  1772. ("antiquewhite4" . "#8B8378")
  1773. ("aquamarine" . "#7FFFD4")
  1774. ("aquamarine1" . "#7FFFD4")
  1775. ("aquamarine2" . "#76EEC6")
  1776. ("aquamarine3" . "#66CDAA")
  1777. ("aquamarine4" . "#458B74")
  1778. ("azure" . "#F0FFFF")
  1779. ("azure1" . "#F0FFFF")
  1780. ("azure2" . "#E0EEEE")
  1781. ("azure3" . "#C1CDCD")
  1782. ("azure4" . "#838B8B")
  1783. ("beige" . "#F5F5DC")
  1784. ("bisque" . "#FFE4C4")
  1785. ("bisque1" . "#FFE4C4")
  1786. ("bisque2" . "#EED5B7")
  1787. ("bisque3" . "#CDB79E")
  1788. ("bisque4" . "#8B7D6B")
  1789. ("black" . "#000000")
  1790. ("blanchedalmond" . "#FFEBCD")
  1791. ("blue" . "#0000FF")
  1792. ("blue1" . "#0000FF")
  1793. ("blue2" . "#0000EE")
  1794. ("blue3" . "#0000CD")
  1795. ("blue4" . "#00008B")
  1796. ("blueviolet" . "#8A2BE2")
  1797. ("brown" . "#A52A2A")
  1798. ("brown1" . "#FF4040")
  1799. ("brown2" . "#EE3B3B")
  1800. ("brown3" . "#CD3333")
  1801. ("brown4" . "#8B2323")
  1802. ("burlywood" . "#DEB887")
  1803. ("burlywood1" . "#FFD39B")
  1804. ("burlywood2" . "#EEC591")
  1805. ("burlywood3" . "#CDAA7D")
  1806. ("burlywood4" . "#8B7355")
  1807. ("cadetblue" . "#5F9EA0")
  1808. ("cadetblue1" . "#98F5FF")
  1809. ("cadetblue2" . "#8EE5EE")
  1810. ("cadetblue3" . "#7AC5CD")
  1811. ("cadetblue4" . "#53868B")
  1812. ("chartreuse" . "#7FFF00")
  1813. ("chartreuse1" . "#7FFF00")
  1814. ("chartreuse2" . "#76EE00")
  1815. ("chartreuse3" . "#66CD00")
  1816. ("chartreuse4" . "#458B00")
  1817. ("chocolate" . "#D2691E")
  1818. ("chocolate1" . "#FF7F24")
  1819. ("chocolate2" . "#EE7621")
  1820. ("chocolate3" . "#CD661D")
  1821. ("chocolate4" . "#8B4513")
  1822. ("coral" . "#FF7F50")
  1823. ("coral1" . "#FF7256")
  1824. ("coral2" . "#EE6A50")
  1825. ("coral3" . "#CD5B45")
  1826. ("coral4" . "#8B3E2F")
  1827. ("cornflowerblue" . "#6495ED")
  1828. ("cornsilk" . "#FFF8DC")
  1829. ("cornsilk1" . "#FFF8DC")
  1830. ("cornsilk2" . "#EEE8CD")
  1831. ("cornsilk3" . "#CDC8B1")
  1832. ("cornsilk4" . "#8B8878")
  1833. ("cyan" . "#00FFFF")
  1834. ("cyan1" . "#00FFFF")
  1835. ("cyan2" . "#00EEEE")
  1836. ("cyan3" . "#00CDCD")
  1837. ("cyan4" . "#008B8B")
  1838. ("darkblue" . "#00008B")
  1839. ("darkcyan" . "#008B8B")
  1840. ("darkgoldenrod" . "#B8860B")
  1841. ("darkgoldenrod1" . "#FFB90F")
  1842. ("darkgoldenrod2" . "#EEAD0E")
  1843. ("darkgoldenrod3" . "#CD950C")
  1844. ("darkgoldenrod4" . "#8B6508")
  1845. ("darkgray" . "#A9A9A9")
  1846. ("darkgreen" . "#006400")
  1847. ("darkgrey" . "#A9A9A9")
  1848. ("darkkhaki" . "#BDB76B")
  1849. ("darkmagenta" . "#8B008B")
  1850. ("darkolivegreen" . "#556B2F")
  1851. ("darkolivegreen1" . "#CAFF70")
  1852. ("darkolivegreen2" . "#BCEE68")
  1853. ("darkolivegreen3" . "#A2CD5A")
  1854. ("darkolivegreen4" . "#6E8B3D")
  1855. ("darkorange" . "#FF8C00")
  1856. ("darkorange1" . "#FF7F00")
  1857. ("darkorange2" . "#EE7600")
  1858. ("darkorange3" . "#CD6600")
  1859. ("darkorange4" . "#8B4500")
  1860. ("darkorchid" . "#9932CC")
  1861. ("darkorchid1" . "#BF3EFF")
  1862. ("darkorchid2" . "#B23AEE")
  1863. ("darkorchid3" . "#9A32CD")
  1864. ("darkorchid4" . "#68228B")
  1865. ("darkred" . "#8B0000")
  1866. ("darksalmon" . "#E9967A")
  1867. ("darkseagreen" . "#8FBC8F")
  1868. ("darkseagreen1" . "#C1FFC1")
  1869. ("darkseagreen2" . "#B4EEB4")
  1870. ("darkseagreen3" . "#9BCD9B")
  1871. ("darkseagreen4" . "#698B69")
  1872. ("darkslateblue" . "#483D8B")
  1873. ("darkslategray" . "#2F4F4F")
  1874. ("darkslategray1" . "#97FFFF")
  1875. ("darkslategray2" . "#8DEEEE")
  1876. ("darkslategray3" . "#79CDCD")
  1877. ("darkslategray4" . "#528B8B")
  1878. ("darkslategrey" . "#2F4F4F")
  1879. ("darkturquoise" . "#00CED1")
  1880. ("darkviolet" . "#9400D3")
  1881. ("deeppink" . "#FF1493")
  1882. ("deeppink1" . "#FF1493")
  1883. ("deeppink2" . "#EE1289")
  1884. ("deeppink3" . "#CD1076")
  1885. ("deeppink4" . "#8B0A50")
  1886. ("deepskyblue" . "#00BFFF")
  1887. ("deepskyblue1" . "#00BFFF")
  1888. ("deepskyblue2" . "#00B2EE")
  1889. ("deepskyblue3" . "#009ACD")
  1890. ("deepskyblue4" . "#00688B")
  1891. ("dimgray" . "#696969")
  1892. ("dimgrey" . "#696969")
  1893. ("dodgerblue" . "#1E90FF")
  1894. ("dodgerblue1" . "#1E90FF")
  1895. ("dodgerblue2" . "#1C86EE")
  1896. ("dodgerblue3" . "#1874CD")
  1897. ("dodgerblue4" . "#104E8B")
  1898. ("firebrick" . "#B22222")
  1899. ("firebrick1" . "#FF3030")
  1900. ("firebrick2" . "#EE2C2C")
  1901. ("firebrick3" . "#CD2626")
  1902. ("firebrick4" . "#8B1A1A")
  1903. ("floralwhite" . "#FFFAF0")
  1904. ("forestgreen" . "#228B22")
  1905. ("gainsboro" . "#DCDCDC")
  1906. ("ghostwhite" . "#F8F8FF")
  1907. ("gold" . "#FFD700")
  1908. ("gold1" . "#FFD700")
  1909. ("gold2" . "#EEC900")
  1910. ("gold3" . "#CDAD00")
  1911. ("gold4" . "#8B7500")
  1912. ("goldenrod" . "#DAA520")
  1913. ("goldenrod1" . "#FFC125")
  1914. ("goldenrod2" . "#EEB422")
  1915. ("goldenrod3" . "#CD9B1D")
  1916. ("goldenrod4" . "#8B6914")
  1917. ("gray" . "#BEBEBE")
  1918. ("gray0" . "#000000")
  1919. ("gray1" . "#030303")
  1920. ("gray2" . "#050505")
  1921. ("gray3" . "#080808")
  1922. ("gray4" . "#0A0A0A")
  1923. ("gray5" . "#0D0D0D")
  1924. ("gray6" . "#0F0F0F")
  1925. ("gray7" . "#121212")
  1926. ("gray8" . "#141414")
  1927. ("gray9" . "#171717")
  1928. ("gray10" . "#1A1A1A")
  1929. ("gray11" . "#1C1C1C")
  1930. ("gray12" . "#1F1F1F")
  1931. ("gray13" . "#212121")
  1932. ("gray14" . "#242424")
  1933. ("gray15" . "#262626")
  1934. ("gray16" . "#292929")
  1935. ("gray17" . "#2B2B2B")
  1936. ("gray18" . "#2E2E2E")
  1937. ("gray19" . "#303030")
  1938. ("gray20" . "#333333")
  1939. ("gray21" . "#363636")
  1940. ("gray22" . "#383838")
  1941. ("gray23" . "#3B3B3B")
  1942. ("gray24" . "#3D3D3D")
  1943. ("gray25" . "#404040")
  1944. ("gray26" . "#424242")
  1945. ("gray27" . "#454545")
  1946. ("gray28" . "#474747")
  1947. ("gray29" . "#4A4A4A")
  1948. ("gray30" . "#4D4D4D")
  1949. ("gray31" . "#4F4F4F")
  1950. ("gray32" . "#525252")
  1951. ("gray33" . "#545454")
  1952. ("gray34" . "#575757")
  1953. ("gray35" . "#595959")
  1954. ("gray36" . "#5C5C5C")
  1955. ("gray37" . "#5E5E5E")
  1956. ("gray38" . "#616161")
  1957. ("gray39" . "#636363")
  1958. ("gray40" . "#666666")
  1959. ("gray41" . "#696969")
  1960. ("gray42" . "#6B6B6B")
  1961. ("gray43" . "#6E6E6E")
  1962. ("gray44" . "#707070")
  1963. ("gray45" . "#737373")
  1964. ("gray46" . "#757575")
  1965. ("gray47" . "#787878")
  1966. ("gray48" . "#7A7A7A")
  1967. ("gray49" . "#7D7D7D")
  1968. ("gray50" . "#7F7F7F")
  1969. ("gray51" . "#828282")
  1970. ("gray52" . "#858585")
  1971. ("gray53" . "#878787")
  1972. ("gray54" . "#8A8A8A")
  1973. ("gray55" . "#8C8C8C")
  1974. ("gray56" . "#8F8F8F")
  1975. ("gray57" . "#919191")
  1976. ("gray58" . "#949494")
  1977. ("gray59" . "#969696")
  1978. ("gray60" . "#999999")
  1979. ("gray61" . "#9C9C9C")
  1980. ("gray62" . "#9E9E9E")
  1981. ("gray63" . "#A1A1A1")
  1982. ("gray64" . "#A3A3A3")
  1983. ("gray65" . "#A6A6A6")
  1984. ("gray66" . "#A8A8A8")
  1985. ("gray67" . "#ABABAB")
  1986. ("gray68" . "#ADADAD")
  1987. ("gray69" . "#B0B0B0")
  1988. ("gray70" . "#B3B3B3")
  1989. ("gray71" . "#B5B5B5")
  1990. ("gray72" . "#B8B8B8")
  1991. ("gray73" . "#BABABA")
  1992. ("gray74" . "#BDBDBD")
  1993. ("gray75" . "#BFBFBF")
  1994. ("gray76" . "#C2C2C2")
  1995. ("gray77" . "#C4C4C4")
  1996. ("gray78" . "#C7C7C7")
  1997. ("gray79" . "#C9C9C9")
  1998. ("gray80" . "#CCCCCC")
  1999. ("gray81" . "#CFCFCF")
  2000. ("gray82" . "#D1D1D1")
  2001. ("gray83" . "#D4D4D4")
  2002. ("gray84" . "#D6D6D6")
  2003. ("gray85" . "#D9D9D9")
  2004. ("gray86" . "#DBDBDB")
  2005. ("gray87" . "#DEDEDE")
  2006. ("gray88" . "#E0E0E0")
  2007. ("gray89" . "#E3E3E3")
  2008. ("gray90" . "#E5E5E5")
  2009. ("gray91" . "#E8E8E8")
  2010. ("gray92" . "#EBEBEB")
  2011. ("gray93" . "#EDEDED")
  2012. ("gray94" . "#F0F0F0")
  2013. ("gray95" . "#F2F2F2")
  2014. ("gray96" . "#F5F5F5")
  2015. ("gray97" . "#F7F7F7")
  2016. ("gray98" . "#FAFAFA")
  2017. ("gray99" . "#FCFCFC")
  2018. ("gray100" . "#FFFFFF")
  2019. ("green" . "#00FF00")
  2020. ("green1" . "#00FF00")
  2021. ("green2" . "#00EE00")
  2022. ("green3" . "#00CD00")
  2023. ("green4" . "#008B00")
  2024. ("greenyellow" . "#ADFF2F")
  2025. ("grey" . "#BEBEBE")
  2026. ("grey0" . "#000000")
  2027. ("grey1" . "#030303")
  2028. ("grey2" . "#050505")
  2029. ("grey3" . "#080808")
  2030. ("grey4" . "#0A0A0A")
  2031. ("grey5" . "#0D0D0D")
  2032. ("grey6" . "#0F0F0F")
  2033. ("grey7" . "#121212")
  2034. ("grey8" . "#141414")
  2035. ("grey9" . "#171717")
  2036. ("grey10" . "#1A1A1A")
  2037. ("grey11" . "#1C1C1C")
  2038. ("grey12" . "#1F1F1F")
  2039. ("grey13" . "#212121")
  2040. ("grey14" . "#242424")
  2041. ("grey15" . "#262626")
  2042. ("grey16" . "#292929")
  2043. ("grey17" . "#2B2B2B")
  2044. ("grey18" . "#2E2E2E")
  2045. ("grey19" . "#303030")
  2046. ("grey20" . "#333333")
  2047. ("grey21" . "#363636")
  2048. ("grey22" . "#383838")
  2049. ("grey23" . "#3B3B3B")
  2050. ("grey24" . "#3D3D3D")
  2051. ("grey25" . "#404040")
  2052. ("grey26" . "#424242")
  2053. ("grey27" . "#454545")
  2054. ("grey28" . "#474747")
  2055. ("grey29" . "#4A4A4A")
  2056. ("grey30" . "#4D4D4D")
  2057. ("grey31" . "#4F4F4F")
  2058. ("grey32" . "#525252")
  2059. ("grey33" . "#545454")
  2060. ("grey34" . "#575757")
  2061. ("grey35" . "#595959")
  2062. ("grey36" . "#5C5C5C")
  2063. ("grey37" . "#5E5E5E")
  2064. ("grey38" . "#616161")
  2065. ("grey39" . "#636363")
  2066. ("grey40" . "#666666")
  2067. ("grey41" . "#696969")
  2068. ("grey42" . "#6B6B6B")
  2069. ("grey43" . "#6E6E6E")
  2070. ("grey44" . "#707070")
  2071. ("grey45" . "#737373")
  2072. ("grey46" . "#757575")
  2073. ("grey47" . "#787878")
  2074. ("grey48" . "#7A7A7A")
  2075. ("grey49" . "#7D7D7D")
  2076. ("grey50" . "#7F7F7F")
  2077. ("grey51" . "#828282")
  2078. ("grey52" . "#858585")
  2079. ("grey53" . "#878787")
  2080. ("grey54" . "#8A8A8A")
  2081. ("grey55" . "#8C8C8C")
  2082. ("grey56" . "#8F8F8F")
  2083. ("grey57" . "#919191")
  2084. ("grey58" . "#949494")
  2085. ("grey59" . "#969696")
  2086. ("grey60" . "#999999")
  2087. ("grey61" . "#9C9C9C")
  2088. ("grey62" . "#9E9E9E")
  2089. ("grey63" . "#A1A1A1")
  2090. ("grey64" . "#A3A3A3")
  2091. ("grey65" . "#A6A6A6")
  2092. ("grey66" . "#A8A8A8")
  2093. ("grey67" . "#ABABAB")
  2094. ("grey68" . "#ADADAD")
  2095. ("grey69" . "#B0B0B0")
  2096. ("grey70" . "#B3B3B3")
  2097. ("grey71" . "#B5B5B5")
  2098. ("grey72" . "#B8B8B8")
  2099. ("grey73" . "#BABABA")
  2100. ("grey74" . "#BDBDBD")
  2101. ("grey75" . "#BFBFBF")
  2102. ("grey76" . "#C2C2C2")
  2103. ("grey77" . "#C4C4C4")
  2104. ("grey78" . "#C7C7C7")
  2105. ("grey79" . "#C9C9C9")
  2106. ("grey80" . "#CCCCCC")
  2107. ("grey81" . "#CFCFCF")
  2108. ("grey82" . "#D1D1D1")
  2109. ("grey83" . "#D4D4D4")
  2110. ("grey84" . "#D6D6D6")
  2111. ("grey85" . "#D9D9D9")
  2112. ("grey86" . "#DBDBDB")
  2113. ("grey87" . "#DEDEDE")
  2114. ("grey88" . "#E0E0E0")
  2115. ("grey89" . "#E3E3E3")
  2116. ("grey90" . "#E5E5E5")
  2117. ("grey91" . "#E8E8E8")
  2118. ("grey92" . "#EBEBEB")
  2119. ("grey93" . "#EDEDED")
  2120. ("grey94" . "#F0F0F0")
  2121. ("grey95" . "#F2F2F2")
  2122. ("grey96" . "#F5F5F5")
  2123. ("grey97" . "#F7F7F7")
  2124. ("grey98" . "#FAFAFA")
  2125. ("grey99" . "#FCFCFC")
  2126. ("grey100" . "#FFFFFF")
  2127. ("honeydew" . "#F0FFF0")
  2128. ("honeydew1" . "#F0FFF0")
  2129. ("honeydew2" . "#E0EEE0")
  2130. ("honeydew3" . "#C1CDC1")
  2131. ("honeydew4" . "#838B83")
  2132. ("hotpink" . "#FF69B4")
  2133. ("hotpink1" . "#FF6EB4")
  2134. ("hotpink2" . "#EE6AA7")
  2135. ("hotpink3" . "#CD6090")
  2136. ("hotpink4" . "#8B3A62")
  2137. ("indianred" . "#CD5C5C")
  2138. ("indianred1" . "#FF6A6A")
  2139. ("indianred2" . "#EE6363")
  2140. ("indianred3" . "#CD5555")
  2141. ("indianred4" . "#8B3A3A")
  2142. ("ivory" . "#FFFFF0")
  2143. ("ivory1" . "#FFFFF0")
  2144. ("ivory2" . "#EEEEE0")
  2145. ("ivory3" . "#CDCDC1")
  2146. ("ivory4" . "#8B8B83")
  2147. ("khaki" . "#F0E68C")
  2148. ("khaki1" . "#FFF68F")
  2149. ("khaki2" . "#EEE685")
  2150. ("khaki3" . "#CDC673")
  2151. ("khaki4" . "#8B864E")
  2152. ("lavender" . "#E6E6FA")
  2153. ("lavenderblush" . "#FFF0F5")
  2154. ("lavenderblush1" . "#FFF0F5")
  2155. ("lavenderblush2" . "#EEE0E5")
  2156. ("lavenderblush3" . "#CDC1C5")
  2157. ("lavenderblush4" . "#8B8386")
  2158. ("lawngreen" . "#7CFC00")
  2159. ("lemonchiffon" . "#FFFACD")
  2160. ("lemonchiffon1" . "#FFFACD")
  2161. ("lemonchiffon2" . "#EEE9BF")
  2162. ("lemonchiffon3" . "#CDC9A5")
  2163. ("lemonchiffon4" . "#8B8970")
  2164. ("lightblue" . "#ADD8E6")
  2165. ("lightblue1" . "#BFEFFF")
  2166. ("lightblue2" . "#B2DFEE")
  2167. ("lightblue3" . "#9AC0CD")
  2168. ("lightblue4" . "#68838B")
  2169. ("lightcoral" . "#F08080")
  2170. ("lightcyan" . "#E0FFFF")
  2171. ("lightcyan1" . "#E0FFFF")
  2172. ("lightcyan2" . "#D1EEEE")
  2173. ("lightcyan3" . "#B4CDCD")
  2174. ("lightcyan4" . "#7A8B8B")
  2175. ("lightgoldenrod" . "#EEDD82")
  2176. ("lightgoldenrod1" . "#FFEC8B")
  2177. ("lightgoldenrod2" . "#EEDC82")
  2178. ("lightgoldenrod3" . "#CDBE70")
  2179. ("lightgoldenrod4" . "#8B814C")
  2180. ("lightgoldenrodyellow" . "#FAFAD2")
  2181. ("lightgray" . "#D3D3D3")
  2182. ("lightgreen" . "#90EE90")
  2183. ("lightgrey" . "#D3D3D3")
  2184. ("lightpink" . "#FFB6C1")
  2185. ("lightpink1" . "#FFAEB9")
  2186. ("lightpink2" . "#EEA2AD")
  2187. ("lightpink3" . "#CD8C95")
  2188. ("lightpink4" . "#8B5F65")
  2189. ("lightsalmon" . "#FFA07A")
  2190. ("lightsalmon1" . "#FFA07A")
  2191. ("lightsalmon2" . "#EE9572")
  2192. ("lightsalmon3" . "#CD8162")
  2193. ("lightsalmon4" . "#8B5742")
  2194. ("lightseagreen" . "#20B2AA")
  2195. ("lightskyblue" . "#87CEFA")
  2196. ("lightskyblue1" . "#B0E2FF")
  2197. ("lightskyblue2" . "#A4D3EE")
  2198. ("lightskyblue3" . "#8DB6CD")
  2199. ("lightskyblue4" . "#607B8B")
  2200. ("lightslateblue" . "#8470FF")
  2201. ("lightslategray" . "#778899")
  2202. ("lightslategrey" . "#778899")
  2203. ("lightsteelblue" . "#B0C4DE")
  2204. ("lightsteelblue1" . "#CAE1FF")
  2205. ("lightsteelblue2" . "#BCD2EE")
  2206. ("lightsteelblue3" . "#A2B5CD")
  2207. ("lightsteelblue4" . "#6E7B8B")
  2208. ("lightyellow" . "#FFFFE0")
  2209. ("lightyellow1" . "#FFFFE0")
  2210. ("lightyellow2" . "#EEEED1")
  2211. ("lightyellow3" . "#CDCDB4")
  2212. ("lightyellow4" . "#8B8B7A")
  2213. ("limegreen" . "#32CD32")
  2214. ("linen" . "#FAF0E6")
  2215. ("magenta" . "#FF00FF")
  2216. ("magenta1" . "#FF00FF")
  2217. ("magenta2" . "#EE00EE")
  2218. ("magenta3" . "#CD00CD")
  2219. ("magenta4" . "#8B008B")
  2220. ("maroon" . "#B03060")
  2221. ("maroon1" . "#FF34B3")
  2222. ("maroon2" . "#EE30A7")
  2223. ("maroon3" . "#CD2990")
  2224. ("maroon4" . "#8B1C62")
  2225. ("mediumaquamarine" . "#66CDAA")
  2226. ("mediumblue" . "#0000CD")
  2227. ("mediumorchid" . "#BA55D3")
  2228. ("mediumorchid1" . "#E066FF")
  2229. ("mediumorchid2" . "#D15FEE")
  2230. ("mediumorchid3" . "#B452CD")
  2231. ("mediumorchid4" . "#7A378B")
  2232. ("mediumpurple" . "#9370DB")
  2233. ("mediumpurple1" . "#AB82FF")
  2234. ("mediumpurple2" . "#9F79EE")
  2235. ("mediumpurple3" . "#8968CD")
  2236. ("mediumpurple4" . "#5D478B")
  2237. ("mediumseagreen" . "#3CB371")
  2238. ("mediumslateblue" . "#7B68EE")
  2239. ("mediumspringgreen" . "#00FA9A")
  2240. ("mediumturquoise" . "#48D1CC")
  2241. ("mediumvioletred" . "#C71585")
  2242. ("midnightblue" . "#191970")
  2243. ("mintcream" . "#F5FFFA")
  2244. ("mistyrose" . "#FFE4E1")
  2245. ("mistyrose1" . "#FFE4E1")
  2246. ("mistyrose2" . "#EED5D2")
  2247. ("mistyrose3" . "#CDB7B5")
  2248. ("mistyrose4" . "#8B7D7B")
  2249. ("moccasin" . "#FFE4B5")
  2250. ("navajowhite" . "#FFDEAD")
  2251. ("navajowhite1" . "#FFDEAD")
  2252. ("navajowhite2" . "#EECFA1")
  2253. ("navajowhite3" . "#CDB38B")
  2254. ("navajowhite4" . "#8B795E")
  2255. ("navy" . "#000080")
  2256. ("navyblue" . "#000080")
  2257. ("oldlace" . "#FDF5E6")
  2258. ("olivedrab" . "#6B8E23")
  2259. ("olivedrab1" . "#C0FF3E")
  2260. ("olivedrab2" . "#B3EE3A")
  2261. ("olivedrab3" . "#9ACD32")
  2262. ("olivedrab4" . "#698B22")
  2263. ("orange" . "#FFA500")
  2264. ("orange1" . "#FFA500")
  2265. ("orange2" . "#EE9A00")
  2266. ("orange3" . "#CD8500")
  2267. ("orange4" . "#8B5A00")
  2268. ("orangered" . "#FF4500")
  2269. ("orangered1" . "#FF4500")
  2270. ("orangered2" . "#EE4000")
  2271. ("orangered3" . "#CD3700")
  2272. ("orangered4" . "#8B2500")
  2273. ("orchid" . "#DA70D6")
  2274. ("orchid1" . "#FF83FA")
  2275. ("orchid2" . "#EE7AE9")
  2276. ("orchid3" . "#CD69C9")
  2277. ("orchid4" . "#8B4789")
  2278. ("palegoldenrod" . "#EEE8AA")
  2279. ("palegreen" . "#98FB98")
  2280. ("palegreen1" . "#9AFF9A")
  2281. ("palegreen2" . "#90EE90")
  2282. ("palegreen3" . "#7CCD7C")
  2283. ("palegreen4" . "#548B54")
  2284. ("paleturquoise" . "#AFEEEE")
  2285. ("paleturquoise1" . "#BBFFFF")
  2286. ("paleturquoise2" . "#AEEEEE")
  2287. ("paleturquoise3" . "#96CDCD")
  2288. ("paleturquoise4" . "#668B8B")
  2289. ("palevioletred" . "#DB7093")
  2290. ("palevioletred1" . "#FF82AB")
  2291. ("palevioletred2" . "#EE799F")
  2292. ("palevioletred3" . "#CD6889")
  2293. ("palevioletred4" . "#8B475D")
  2294. ("papayawhip" . "#FFEFD5")
  2295. ("peachpuff" . "#FFDAB9")
  2296. ("peachpuff1" . "#FFDAB9")
  2297. ("peachpuff2" . "#EECBAD")
  2298. ("peachpuff3" . "#CDAF95")
  2299. ("peachpuff4" . "#8B7765")
  2300. ("peru" . "#CD853F")
  2301. ("pink" . "#FFC0CB")
  2302. ("pink1" . "#FFB5C5")
  2303. ("pink2" . "#EEA9B8")
  2304. ("pink3" . "#CD919E")
  2305. ("pink4" . "#8B636C")
  2306. ("plum" . "#DDA0DD")
  2307. ("plum1" . "#FFBBFF")
  2308. ("plum2" . "#EEAEEE")
  2309. ("plum3" . "#CD96CD")
  2310. ("plum4" . "#8B668B")
  2311. ("powderblue" . "#B0E0E6")
  2312. ("purple" . "#A020F0")
  2313. ("purple1" . "#9B30FF")
  2314. ("purple2" . "#912CEE")
  2315. ("purple3" . "#7D26CD")
  2316. ("purple4" . "#551A8B")
  2317. ("red" . "#FF0000")
  2318. ("red1" . "#FF0000")
  2319. ("red2" . "#EE0000")
  2320. ("red3" . "#CD0000")
  2321. ("red4" . "#8B0000")
  2322. ("rosybrown" . "#BC8F8F")
  2323. ("rosybrown1" . "#FFC1C1")
  2324. ("rosybrown2" . "#EEB4B4")
  2325. ("rosybrown3" . "#CD9B9B")
  2326. ("rosybrown4" . "#8B6969")
  2327. ("royalblue" . "#4169E1")
  2328. ("royalblue1" . "#4876FF")
  2329. ("royalblue2" . "#436EEE")
  2330. ("royalblue3" . "#3A5FCD")
  2331. ("royalblue4" . "#27408B")
  2332. ("saddlebrown" . "#8B4513")
  2333. ("salmon" . "#FA8072")
  2334. ("salmon1" . "#FF8C69")
  2335. ("salmon2" . "#EE8262")
  2336. ("salmon3" . "#CD7054")
  2337. ("salmon4" . "#8B4C39")
  2338. ("sandybrown" . "#F4A460")
  2339. ("seagreen" . "#2E8B57")
  2340. ("seagreen1" . "#54FF9F")
  2341. ("seagreen2" . "#4EEE94")
  2342. ("seagreen3" . "#43CD80")
  2343. ("seagreen4" . "#2E8B57")
  2344. ("seashell" . "#FFF5EE")
  2345. ("seashell1" . "#FFF5EE")
  2346. ("seashell2" . "#EEE5DE")
  2347. ("seashell3" . "#CDC5BF")
  2348. ("seashell4" . "#8B8682")
  2349. ("sienna" . "#A0522D")
  2350. ("sienna1" . "#FF8247")
  2351. ("sienna2" . "#EE7942")
  2352. ("sienna3" . "#CD6839")
  2353. ("sienna4" . "#8B4726")
  2354. ("skyblue" . "#87CEEB")
  2355. ("skyblue1" . "#87CEFF")
  2356. ("skyblue2" . "#7EC0EE")
  2357. ("skyblue3" . "#6CA6CD")
  2358. ("skyblue4" . "#4A708B")
  2359. ("slateblue" . "#6A5ACD")
  2360. ("slateblue1" . "#836FFF")
  2361. ("slateblue2" . "#7A67EE")
  2362. ("slateblue3" . "#6959CD")
  2363. ("slateblue4" . "#473C8B")
  2364. ("slategray" . "#708090")
  2365. ("slategray1" . "#C6E2FF")
  2366. ("slategray2" . "#B9D3EE")
  2367. ("slategray3" . "#9FB6CD")
  2368. ("slategray4" . "#6C7B8B")
  2369. ("slategrey" . "#708090")
  2370. ("snow" . "#FFFAFA")
  2371. ("snow1" . "#FFFAFA")
  2372. ("snow2" . "#EEE9E9")
  2373. ("snow3" . "#CDC9C9")
  2374. ("snow4" . "#8B8989")
  2375. ("springgreen" . "#00FF7F")
  2376. ("springgreen1" . "#00FF7F")
  2377. ("springgreen2" . "#00EE76")
  2378. ("springgreen3" . "#00CD66")
  2379. ("springgreen4" . "#008B45")
  2380. ("steelblue" . "#4682B4")
  2381. ("steelblue1" . "#63B8FF")
  2382. ("steelblue2" . "#5CACEE")
  2383. ("steelblue3" . "#4F94CD")
  2384. ("steelblue4" . "#36648B")
  2385. ("tan" . "#D2B48C")
  2386. ("tan1" . "#FFA54F")
  2387. ("tan2" . "#EE9A49")
  2388. ("tan3" . "#CD853F")
  2389. ("tan4" . "#8B5A2B")
  2390. ("thistle" . "#D8BFD8")
  2391. ("thistle1" . "#FFE1FF")
  2392. ("thistle2" . "#EED2EE")
  2393. ("thistle3" . "#CDB5CD")
  2394. ("thistle4" . "#8B7B8B")
  2395. ("tomato" . "#FF6347")
  2396. ("tomato1" . "#FF6347")
  2397. ("tomato2" . "#EE5C42")
  2398. ("tomato3" . "#CD4F39")
  2399. ("tomato4" . "#8B3626")
  2400. ("turquoise" . "#40E0D0")
  2401. ("turquoise1" . "#00F5FF")
  2402. ("turquoise2" . "#00E5EE")
  2403. ("turquoise3" . "#00C5CD")
  2404. ("turquoise4" . "#00868B")
  2405. ("violet" . "#EE82EE")
  2406. ("violetred" . "#D02090")
  2407. ("violetred1" . "#FF3E96")
  2408. ("violetred2" . "#EE3A8C")
  2409. ("violetred3" . "#CD3278")
  2410. ("violetred4" . "#8B2252")
  2411. ("wheat" . "#F5DEB3")
  2412. ("wheat1" . "#FFE7BA")
  2413. ("wheat2" . "#EED8AE")
  2414. ("wheat3" . "#CDBA96")
  2415. ("wheat4" . "#8B7E66")
  2416. ("whitesmoke" . "#F5F5F5")
  2417. ("yellow" . "#FFFF00")
  2418. ("yellow1" . "#FFFF00")
  2419. ("yellow2" . "#EEEE00")
  2420. ("yellow3" . "#CDCD00")
  2421. ("yellow4" . "#8B8B00")
  2422. ("yellowgreen" . "#9ACD32"))
  2423. "Alist of R colors.
  2424. Each entry should have the form (COLOR-NAME . HEXADECIMAL-COLOR)."
  2425. :type 'alist
  2426. :group 'rainbow)
  2427. (defcustom rainbow-r-colors-major-mode-list
  2428. '(ess-mode)
  2429. "List of major mode where R colors are enabled when
  2430. `rainbow-r-colors' is set to auto."
  2431. :type '(repeat (symbol :tag "Major-Mode"))
  2432. :group 'rainbow)
  2433. (defcustom rainbow-r-colors 'auto
  2434. "When to enable R colors.
  2435. If set to t, the R colors will be enabled. If set to nil, the
  2436. R colors will not be enabled. If set to auto, the R colors
  2437. will be enabled if a major mode has been detected from the
  2438. `rainbow-r-colors-major-mode-list'."
  2439. :type '(choice (symbol :tag "enable in certain modes" auto)
  2440. (symbol :tag "enable globally" t)
  2441. (symbol :tag "disable" nil))
  2442. :group 'rainbow)
  2443. ;;; Functions
  2444. (defun rainbow-colorize-match (color &optional match)
  2445. "Return a matched string propertized with a face whose
  2446. background is COLOR. The foreground is computed using
  2447. `rainbow-color-luminance', and is either white or black."
  2448. (let ((match (or match 0)))
  2449. (put-text-property
  2450. (match-beginning match) (match-end match)
  2451. 'face `((:foreground ,(if (> 0.5 (rainbow-x-color-luminance color))
  2452. "white" "black"))
  2453. (:background ,color)))))
  2454. (defun rainbow-colorize-itself (&optional match)
  2455. "Colorize a match with itself."
  2456. (rainbow-colorize-match (match-string-no-properties (or match 0)) match))
  2457. (defun rainbow-colorize-hexadecimal-without-sharp ()
  2458. "Colorize an hexadecimal colors and prepend # to it."
  2459. (rainbow-colorize-match (concat "#" (match-string-no-properties 1))))
  2460. (defun rainbow-colorize-by-assoc (assoc-list)
  2461. "Colorize a match with its association from ASSOC-LIST."
  2462. (rainbow-colorize-match (cdr (assoc-string (match-string-no-properties 0)
  2463. assoc-list t))))
  2464. (defun rainbow-rgb-relative-to-absolute (number)
  2465. "Convert a relative NUMBER to absolute. If NUMBER is absolute, return NUMBER.
  2466. This will convert \"80 %\" to 204, \"100 %\" to 255 but \"123\" to \"123\".
  2467. If the percentage value is above 100, it's converted to 100."
  2468. (let ((string-length (- (length number) 1)))
  2469. ;; Is this a number with %?
  2470. (if (eq (elt number string-length) ?%)
  2471. (/ (* (min (string-to-number (substring number 0 string-length)) 100) 255) 100)
  2472. (string-to-number number))))
  2473. (defun rainbow-colorize-hsl ()
  2474. "Colorize a match with itself."
  2475. (let ((h (/ (string-to-number (match-string-no-properties 1)) 360.0))
  2476. (s (/ (string-to-number (match-string-no-properties 2)) 100.0))
  2477. (l (/ (string-to-number (match-string-no-properties 3)) 100.0)))
  2478. (rainbow-colorize-match
  2479. (multiple-value-bind (r g b)
  2480. (color-hsl-to-rgb h s l)
  2481. (format "#%02X%02X%02X" (* r 255) (* g 255) (* b 255))))))
  2482. (defun rainbow-colorize-rgb ()
  2483. "Colorize a match with itself."
  2484. (let ((r (rainbow-rgb-relative-to-absolute (match-string-no-properties 1)))
  2485. (g (rainbow-rgb-relative-to-absolute (match-string-no-properties 2)))
  2486. (b (rainbow-rgb-relative-to-absolute (match-string-no-properties 3))))
  2487. (rainbow-colorize-match (format "#%02X%02X%02X" r g b))))
  2488. (defun rainbow-colorize-rgb-float ()
  2489. "Colorize a match with itself, with relative value."
  2490. (let ((r (* (string-to-number (match-string-no-properties 1)) 255.0))
  2491. (g (* (string-to-number (match-string-no-properties 2)) 255.0))
  2492. (b (* (string-to-number (match-string-no-properties 3)) 255.0)))
  2493. (rainbow-colorize-match (format "#%02X%02X%02X" r g b))))
  2494. (defvar ansi-color-context)
  2495. (defvar xterm-color-current)
  2496. (defun rainbow-colorize-ansi ()
  2497. "Return a matched string propertized with ansi color face."
  2498. (let ((xterm-color? (featurep 'xterm-color))
  2499. (string (match-string-no-properties 0))
  2500. color)
  2501. (save-match-data
  2502. (let* ((replaced (concat
  2503. (replace-regexp-in-string
  2504. "^\\(\\\\[eE]\\|\\\\033\\|\\\\x1[bB]\\)"
  2505. "\033" string) "x"))
  2506. xterm-color-current
  2507. ansi-color-context
  2508. (applied (funcall (if xterm-color?
  2509. 'xterm-color-filter
  2510. 'ansi-color-apply)
  2511. replaced))
  2512. (face-property (get-text-property
  2513. 0
  2514. (if xterm-color? 'face 'font-lock-face)
  2515. applied)))
  2516. (unless (listp (or (car-safe face-property) face-property))
  2517. (setq face-property (list face-property)))
  2518. (setq color (funcall (if xterm-color? 'cadr 'cdr)
  2519. (or (assq (if xterm-color?
  2520. :foreground
  2521. 'foreground-color)
  2522. face-property)
  2523. (assq (if xterm-color?
  2524. :background
  2525. 'background-color)
  2526. face-property))))))
  2527. (when color
  2528. (rainbow-colorize-match color))))
  2529. (defun rainbow-color-luminance (red green blue)
  2530. "Calculate the luminance of color composed of RED, GREEN and BLUE.
  2531. Return a value between 0 and 1."
  2532. (/ (+ (* .2126 red) (* .7152 green) (* .0722 blue)) 256))
  2533. (defun rainbow-x-color-luminance (color)
  2534. "Calculate the luminance of a color string (e.g. \"#ffaa00\", \"blue\").
  2535. Return a value between 0 and 1."
  2536. (let* ((values (x-color-values color))
  2537. (r (/ (car values) 256.0))
  2538. (g (/ (cadr values) 256.0))
  2539. (b (/ (caddr values) 256.0)))
  2540. (rainbow-color-luminance r g b)))
  2541. ;;; Mode
  2542. (defun rainbow-turn-on ()
  2543. "Turn on raibow-mode."
  2544. (font-lock-add-keywords nil
  2545. rainbow-hexadecimal-colors-font-lock-keywords
  2546. t)
  2547. ;; Activate X colors?
  2548. (when (or (eq rainbow-x-colors t)
  2549. (and (eq rainbow-x-colors 'auto)
  2550. (memq major-mode rainbow-x-colors-major-mode-list)))
  2551. (font-lock-add-keywords nil
  2552. rainbow-x-colors-font-lock-keywords
  2553. t))
  2554. ;; Activate LaTeX colors?
  2555. (when (or (eq rainbow-latex-colors t)
  2556. (and (eq rainbow-latex-colors 'auto)
  2557. (memq major-mode rainbow-latex-colors-major-mode-list)))
  2558. (font-lock-add-keywords nil
  2559. rainbow-latex-rgb-colors-font-lock-keywords
  2560. t))
  2561. ;; Activate ANSI colors?
  2562. (when (or (eq rainbow-ansi-colors t)
  2563. (and (eq rainbow-ansi-colors 'auto)
  2564. (memq major-mode rainbow-ansi-colors-major-mode-list)))
  2565. (font-lock-add-keywords nil
  2566. rainbow-ansi-colors-font-lock-keywords
  2567. t))
  2568. ;; Activate HTML colors?
  2569. (when (or (eq rainbow-html-colors t)
  2570. (and (eq rainbow-html-colors 'auto)
  2571. (memq major-mode rainbow-html-colors-major-mode-list)))
  2572. (setq rainbow-html-colors-font-lock-keywords
  2573. `((,(regexp-opt (mapcar 'car rainbow-html-colors-alist) 'words)
  2574. (0 (rainbow-colorize-by-assoc rainbow-html-colors-alist)))))
  2575. (font-lock-add-keywords nil
  2576. `(,@rainbow-html-colors-font-lock-keywords
  2577. ,@rainbow-html-rgb-colors-font-lock-keywords)
  2578. t))
  2579. ;; Activate R colors?
  2580. (when (or (eq rainbow-r-colors t)
  2581. (and (eq rainbow-r-colors 'auto)
  2582. (memq major-mode rainbow-r-colors-major-mode-list)))
  2583. (setq rainbow-r-colors-font-lock-keywords
  2584. `((,(regexp-opt (mapcar 'car rainbow-r-colors-alist) 'words)
  2585. (0 (rainbow-colorize-by-assoc rainbow-r-colors-alist)))))
  2586. (font-lock-add-keywords nil
  2587. rainbow-r-colors-font-lock-keywords
  2588. t)))
  2589. (defun rainbow-turn-off ()
  2590. "Turn off rainbow-mode."
  2591. (font-lock-remove-keywords
  2592. nil
  2593. `(,@rainbow-hexadecimal-colors-font-lock-keywords
  2594. ,@rainbow-x-colors-font-lock-keywords
  2595. ,@rainbow-latex-rgb-colors-font-lock-keywords
  2596. ,@rainbow-r-colors-font-lock-keywords
  2597. ,@rainbow-html-colors-font-lock-keywords
  2598. ,@rainbow-html-rgb-colors-font-lock-keywords)))
  2599. ;;;###autoload
  2600. (define-minor-mode rainbow-mode
  2601. "Colorize strings that represent colors.
  2602. This will fontify with colors the string like \"#aabbcc\" or \"blue\"."
  2603. :lighter " Rbow"
  2604. (progn
  2605. (if rainbow-mode
  2606. (rainbow-turn-on)
  2607. (rainbow-turn-off))
  2608. ;; Call font-lock-mode to refresh the buffer when used e.g. interactively
  2609. (font-lock-mode 1)))
  2610. ;;;; ChangeLog:
  2611. ;; 2018-05-21 Julien Danjou <julien@danjou.info>
  2612. ;;
  2613. ;; * rainbow-mode/rainbow-mode.el: do not fail if face-property is a symbol
  2614. ;;
  2615. ;; It turns out there are cases when `face-property' can be just a symbol
  2616. ;; and we need to protect our selves from that, i.e. `car' should not fail.
  2617. ;; Hence,
  2618. ;; `car-safe' is there and if it's `nil', then fall back to `face-property'
  2619. ;; as is.
  2620. ;;
  2621. ;; See https://github.com/tarsius/hl-todo/issues/17
  2622. ;;
  2623. ;; 2018-03-26 Julien Danjou <julien@danjou.info>
  2624. ;;
  2625. ;; rainbow-mode: release 1.0
  2626. ;;
  2627. ;; 2018-03-26 Jonas Bernoulli <jonas@bernoul.li>
  2628. ;;
  2629. ;; Allow outline-minor-mode to find section headings
  2630. ;;
  2631. ;; 2018-03-26 Jonas Bernoulli <jonas@bernoul.li>
  2632. ;;
  2633. ;; Set type of customizable options
  2634. ;;
  2635. ;; 2018-03-26 Jonas Bernoulli <jonas@bernoul.li>
  2636. ;;
  2637. ;; Enforce use of spaces for indentation
  2638. ;;
  2639. ;; Also untabify some code added by a contributor who, unlike you, has not
  2640. ;; globally set `indent-tabs-mode' to nil.
  2641. ;;
  2642. ;; 2017-05-29 Julien Danjou <julien@danjou.info>
  2643. ;;
  2644. ;; Fix `rainbow-color-luminance' docstring
  2645. ;;
  2646. ;; 2015-10-12 Julien Danjou <julien@danjou.info>
  2647. ;;
  2648. ;; rainbow: add font-lock at the end
  2649. ;;
  2650. ;; See https://github.com/fxbois/web-mode/issues/612
  2651. ;;
  2652. ;; 2015-03-06 Julien Danjou <julien@danjou.info>
  2653. ;;
  2654. ;; rainbow: fix font-lock-mode refresh
  2655. ;;
  2656. ;; 2014-10-15 Stefan Monnier <monnier@iro.umontreal.ca>
  2657. ;;
  2658. ;; * packages/rainbow-mode/rainbow-mode.el (ansi-color-context)
  2659. ;; (xterm-color-current): Declare.
  2660. ;;
  2661. ;; 2014-09-07 Julien Danjou <julien@danjou.info>
  2662. ;;
  2663. ;; rainbow-mode: support float in CSS and limit to 100%
  2664. ;;
  2665. ;; 2013-08-05 Julien Danjou <julien@danjou.info>
  2666. ;;
  2667. ;; rainbow-mode: 0.9, allow spaces in LaTeX colors
  2668. ;;
  2669. ;; 2013-05-03 Julien Danjou <julien@danjou.info>
  2670. ;;
  2671. ;; rainbow-mode: add support for R, bump version to 0.8
  2672. ;;
  2673. ;; Signed-off-by: Julien Danjou <julien@danjou.info>
  2674. ;;
  2675. ;; 2013-02-26 Julien Danjou <julien@danjou.info>
  2676. ;;
  2677. ;; rainbow-mode: version 0.7
  2678. ;;
  2679. ;; * rainbow-mode.el: don't activate font-lock-mode
  2680. ;;
  2681. ;; 2012-12-11 Julien Danjou <julien@danjou.info>
  2682. ;;
  2683. ;; * rainbow-mode: update to 0.6, add support for ANSI coloring
  2684. ;;
  2685. ;; 2012-11-26 Julien Danjou <julien@danjou.info>
  2686. ;;
  2687. ;; rainbow-mode: fix some LaTex docstrings
  2688. ;;
  2689. ;; 2012-11-14 Julien Danjou <julien@danjou.info>
  2690. ;;
  2691. ;; rainbow-mode: version 0.5
  2692. ;;
  2693. ;; * rainbow-mode.el: fix syntax error on
  2694. ;; `rainbow-hexadecimal-colors-font-lock-keywords'.
  2695. ;;
  2696. ;; 2012-11-09 Julien Danjou <julien@danjou.info>
  2697. ;;
  2698. ;; rainbow-mode: version 0.4
  2699. ;;
  2700. ;; * rainbow-mode.el: Use functions from color package to colorize HSL
  2701. ;; rather
  2702. ;; than our own copy.
  2703. ;;
  2704. ;; 2012-11-09 Julien Danjou <julien@danjou.info>
  2705. ;;
  2706. ;; rainbow-mode 0.3
  2707. ;;
  2708. ;; * rainbow-mode.el: avoid colorizing HTML entities
  2709. ;;
  2710. ;; 2011-09-23 Julien Danjou <julien@danjou.info>
  2711. ;;
  2712. ;; Update rainbow-mode to version 0.2
  2713. ;;
  2714. ;; 2011-07-01 Chong Yidong <cyd@stupidchicken.com>
  2715. ;;
  2716. ;; Give every package its own directory in packages/ including single-file
  2717. ;; packages.
  2718. ;;
  2719. (provide 'rainbow-mode)
  2720. ;; Local Variables:
  2721. ;; indent-tabs-mode: nil
  2722. ;; End:
  2723. ;;; rainbow-mode.el ends here
  2724. #+END_SRC
  2725. *** Doom Modeline
  2726. #+BEGIN_SRC emacs-lisp :results silent
  2727. (require 'doom-modeline)
  2728. (doom-modeline-mode 1)
  2729. ;; How tall the mode-line should be (only respected in GUI Emacs).
  2730. (setq doom-modeline-height 30)
  2731. ;; How wide the mode-line bar should be (only respected in GUI Emacs).
  2732. (setq doom-modeline-bar-width 4)
  2733. ;; Determines the style used by `doom-modeline-buffer-file-name'.
  2734. ;;
  2735. ;; Given ~/Projects/FOSS/emacs/lisp/comint.el
  2736. ;; truncate-upto-project => ~/P/F/emacs/lisp/comint.el
  2737. ;; truncate-from-project => ~/Projects/FOSS/emacs/l/comint.el
  2738. ;; truncate-with-project => emacs/l/comint.el
  2739. ;; truncate-except-project => ~/P/F/emacs/l/comint.el
  2740. ;; truncate-upto-root => ~/P/F/e/lisp/comint.el
  2741. ;; truncate-all => ~/P/F/e/l/comint.el
  2742. ;; relative-from-project => emacs/lisp/comint.el
  2743. ;; relative-to-project => lisp/comint.el
  2744. ;; file-name => comint.el
  2745. ;; buffer-name => comint.el<2> (uniquify buffer name)
  2746. ;;
  2747. ;; If you are expereicing the laggy issue, especially while editing remote files
  2748. ;; with tramp, please try `file-name' style.
  2749. ;; Please refer to https://github.com/bbatsov/projectile/issues/657.
  2750. (setq doom-modeline-buffer-file-name-style 'truncate-upto-project)
  2751. ;; What executable of Python will be used (if nil nothing will be showed).
  2752. (setq doom-modeline-python-executable "python")
  2753. ;; Whether show `all-the-icons' or not (if nil nothing will be showed).
  2754. (setq doom-modeline-icon t)
  2755. ;; Whether show the icon for major mode. It respects `doom-modeline-icon'.
  2756. (setq doom-modeline-major-mode-icon t)
  2757. ;; Display color icons for `major-mode'. It respects `all-the-icons-color-icons'.
  2758. (setq doom-modeline-major-mode-color-icon nil)
  2759. ;; Whether display minor modes or not. Non-nil to display in mode-line.
  2760. (setq doom-modeline-minor-modes nil)
  2761. ;; If non-nil, a word count will be added to the selection-info modeline segment.
  2762. (setq doom-modeline-enable-word-count nil)
  2763. ;; If non-nil, only display one number for checker information if applicable.
  2764. (setq doom-modeline-checker-simple-format t)
  2765. ;; Whether display perspective name or not. Non-nil to display in mode-line.
  2766. (setq doom-modeline-persp-name t)
  2767. ;; Whether display `lsp' state or not. Non-nil to display in mode-line.
  2768. (setq doom-modeline-lsp t)
  2769. ;; Whether display github notifications or not. Requires `ghub` package.
  2770. (setq doom-modeline-github nil)
  2771. ;; The interval of checking github.
  2772. (setq doom-modeline-github-interval (* 30 60))
  2773. ;; Whether display environment version or not.
  2774. (setq doom-modeline-env-version t)
  2775. ;; Whether display mu4e notifications or not. Requires `mu4e-alert' package.
  2776. (setq doom-modeline-mu4e t)
  2777. #+END_SRC