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.

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