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.

1624 lines
68 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
  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. (defvar my-packages
  41. '(all-the-icons
  42. anzu
  43. base16-theme
  44. bbdb
  45. better-defaults
  46. company
  47. company-go
  48. counsel
  49. counsel-projectile
  50. dash-at-point
  51. diminish
  52. dockerfile-mode
  53. doom-modeline
  54. doom-themes
  55. ein
  56. eldoc-eval
  57. elfeed
  58. elfeed-org
  59. elpy
  60. expand-region
  61. fic-mode
  62. flycheck
  63. gitignore-mode
  64. go-mode
  65. go-playground
  66. gorepl-mode
  67. iedit
  68. ivy
  69. ivy-hydra
  70. jabber
  71. json-mode
  72. magit
  73. material-theme
  74. multiple-cursors
  75. projectile
  76. rainbow-delimiters
  77. shrink-path
  78. tide
  79. typescript-mode
  80. ;; use-package
  81. web-mode
  82. which-key))
  83. (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
  84. (add-to-list 'package-archives '("melpa-stable" . "http://stable.melpa.org/packages/"))
  85. (when (not package-archive-contents)
  86. (package-refresh-contents))
  87. (package-initialize)
  88. (dolist (p my-packages)
  89. (when (not (package-installed-p p))
  90. (package-install p)))
  91. #+END_SRC
  92. ** Server
  93. #+BEGIN_SRC emacs-lisp :results silent
  94. (require 'edit-server)
  95. (edit-server-start)
  96. #+END_SRC
  97. ** Better Defaults
  98. #+BEGIN_SRC emacs-lisp :results silent
  99. (require 'better-defaults)
  100. ;; Instead of the annoying giant warning icon, just flash the modeline.
  101. ;; (this happens when you do something like C-g)
  102. (setq ring-bell-function
  103. (lambda ()
  104. (let ((orig-fg (face-foreground 'mode-line)))
  105. (set-face-foreground 'mode-line "#F2804F")
  106. (run-with-idle-timer 0.1 nil
  107. (lambda (fg) (set-face-foreground 'mode-line fg))
  108. orig-fg))))
  109. (defun set-frame-size-according-to-resolution ()
  110. "Set the Emacs window size on startup."
  111. (interactive)
  112. (if window-system
  113. (progn
  114. ;; WIDTH
  115. (if (> (x-display-pixel-width) 1280)
  116. ;; Large Screen (only show 120 cols)
  117. (add-to-list 'default-frame-alist (cons 'width 240))
  118. ;; Small Screen (fill window)
  119. (add-to-list 'default-frame-alist (cons 'width (/ (x-display-pixel-width) (frame-char-width)))))
  120. ;; HEIGHT
  121. (if (> (x-display-pixel-height) 1080)
  122. ;; Large Screen (only fill half screen)
  123. (add-to-list 'default-frame-alist (cons 'height (/ (/ (x-display-pixel-height) 2)
  124. (frame-char-height))))
  125. ;; Small Screen (fill window)
  126. (add-to-list 'default-frame-alist (cons 'height (/ (x-display-pixel-height) (frame-char-height)))))
  127. )))
  128. (set-frame-size-according-to-resolution)
  129. (defun window-px-width ()
  130. "Get the width of the Emacs window in pixels."
  131. (interactive)
  132. (* (* (window-total-width) 2.874) (frame-char-width)))
  133. (defun window-px-left-pos ()
  134. "Calculate the left position of the Emacs window."
  135. (interactive)
  136. (/ (- (x-display-pixel-width) (window-px-width)) 2))
  137. (add-to-list 'default-frame-alist (cons 'top 0))
  138. (add-to-list 'default-frame-alist (cons 'left 1000))
  139. #+END_SRC
  140. ** Enable Disabled Commands
  141. #+BEGIN_SRC emacs-lisp :results silent
  142. (put 'narrow-to-region 'disabled nil)
  143. (put 'upcase-region 'disabled nil)
  144. (put 'downcase-region 'disabled nil)
  145. #+END_SRC
  146. ** Splash Screen
  147. #+BEGIN_SRC emacs-lisp :results silent
  148. (setq inhibit-splash-screen t
  149. fancy-splash-image "~/.emacs.d/public/emacs-logo.png"
  150. fancy-splash-image-file "~/.emacs.d/public/emacs-logo.png")
  151. #+END_SRC
  152. ** Basic Customization
  153. #+BEGIN_SRC emacs-lisp :results silent
  154. (defvar backup-dir (expand-file-name "~/.emacs.d/backup/"))
  155. (defvar autosave-dir (expand-file-name "~/.emacs.d/autosave/"))
  156. (setq initial-scratch-message nil
  157. backup-directory-alist (list (cons ".*" backup-dir))
  158. auto-save-list-file-prefix autosave-dir
  159. auto-save-file-name-transforms `((".*" ,autosave-dir t)))
  160. (menu-bar-mode 0)
  161. (scroll-bar-mode 0)
  162. (tool-bar-mode 0)
  163. (setq auth-sources '("~/.authinfo.gpg"))
  164. (set-default 'truncate-lines t)
  165. ;; (load-theme 'doom-city-lights t)
  166. ;; (load-theme 'doom-dracula t)
  167. ;; (load-theme 'doom-nord t)
  168. (load-theme 'doom-one t)
  169. ;; (load-theme 'doom-spacegrey t)
  170. ;; (load-theme 'base16-ocean t)
  171. (load-theme 'base16-onedark t)
  172. (global-linum-mode t)
  173. (global-auto-revert-mode t)
  174. (defalias 'yes-or-no-p 'y-or-n-p)
  175. #+END_SRC
  176. *** Diary
  177. #+BEGIN_SRC emacs-lisp :results silent
  178. (defvar diary-file (expand-file-name "~/.emacs.d/diary/main"))
  179. (add-hook 'diary-list-entries-hook 'diary-sort-entries t)
  180. (add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)
  181. (add-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files)
  182. (add-hook 'calendar-today-visible-hook 'calendar-mark-today)
  183. (setq calendar-latitude 44
  184. calendar-longitude -97
  185. calendar-location-name "Hayti, SD")
  186. #+END_SRC
  187. ** Custom Modes
  188. #+BEGIN_SRC emacs-lisp :results silent
  189. (require 'font-lock)
  190. (defvar openhab-mode-hook nil)
  191. (defvar openhab-mode-map
  192. (let ((map (make-keymap)))
  193. (define-key map "\C-j" 'newline-and-indent)
  194. map)
  195. "Keymap for OPENHAB major mode.")
  196. (add-to-list 'auto-mode-alist '("\\.sitemap\\'" . openhab-mode))
  197. (add-to-list 'auto-mode-alist '("\\.items\\'" . openhab-mode))
  198. (add-to-list 'auto-mode-alist '("\\.rules\\'" . openhab-mode))
  199. (add-to-list 'auto-mode-alist '("\\.things\\'" . openhab-mode))
  200. (defconst openhab-font-lock-keywords
  201. `(
  202. ("\<.*\>" . font-lock-constant-face)
  203. (,(regexp-opt
  204. '(
  205. ;; KEYWORDS
  206. "Selection" "Slider" "List" "Setpoint" "Video" "Chart" "Webview" "Colorpicker"
  207. "Timer" "Number" "String"
  208. "Switch" "Rollershutter" "Number" "String" "Dimmer" "Contact" "DateTime" "Color"
  209. "Text" "Group" "Image" "Frame"
  210. "Thing" "Bridge"
  211. "Time" "System"
  212. "sitemap"
  213. "rule" "when" "then" "end"
  214. "if" "val"
  215. "import" "var" "say" "postUpdate" "switch" "println" "case" "or" "sendCommand"
  216. )
  217. 'words)
  218. (1 font-lock-keyword-face))
  219. (,(regexp-opt
  220. '(
  221. "ON" "OFF" "on" "off"
  222. "AND" "OR" "NAND" "NOR" "AVG" "SUM" "MAX" "MIN"
  223. "true" "false"
  224. )
  225. 'words)
  226. (1 font-lock-constant-face))
  227. (,(regexp-opt
  228. '(
  229. "name" "label" "item" "period" "refresh" "icon" "mappings" "minValue" "maxValue" "step" "switchsupport" "url" "height" "refresh" "visibility" "valuecolor"
  230. )
  231. 'words)
  232. (1 font-lock-type-face))
  233. ("\(.*\)" . font-lock-variable-name-face)
  234. ("[^a-zA-Z0-9_:]\\([0-9]*\\)[^a-zA-Z0-9_:]" . (1 font-lock-variable-name-face))
  235. ("\s@\s" . font-lock-variable-name-face)
  236. ("\s\\([a-zA-Z0-9_:]*\\)\\(\s\\|$\\)" . (1 font-lock-type-face))
  237. ("=\\([a-zA-Z_]*\\)" . (1 font-lock-string-face))
  238. ("\\([a-zA-Z]*\\)=" . (1 font-lock-type-face))
  239. )
  240. "The regexps to highlight in openHAB mode.")
  241. (defvar openhab-mode-syntax-table
  242. (let ((st (make-syntax-table)))
  243. (modify-syntax-entry ?/ ". 12b" st) ;; C-style comments // ...
  244. (modify-syntax-entry ?\n "> b" st) ;; \n ends comment
  245. ;; Block comments /*...*/
  246. (modify-syntax-entry ?\/ ". 14" st)
  247. (modify-syntax-entry ?* ". 23" st)
  248. st)
  249. "Syntax table for openhab-mode.")
  250. (defun openhab-mode ()
  251. "Major mode for editing OPENHAB config files."
  252. (interactive)
  253. (kill-all-local-variables)
  254. (set-syntax-table openhab-mode-syntax-table)
  255. (use-local-map openhab-mode-map)
  256. (set (make-local-variable 'font-lock-defaults) '(openhab-font-lock-keywords nil t))
  257. (electric-pair-mode -1)
  258. (flycheck-mode -1)
  259. (setq major-mode 'openhab-mode)
  260. (setq mode-name "OpenHAB")
  261. (run-hooks 'openhab-mode-hook))
  262. (provide 'openhab-mode)
  263. #+END_SRC
  264. ** Custom Packages
  265. *** Hyperspace
  266. #+BEGIN_SRC emacs-lisp :results silent
  267. ;;; hyperspace.el --- Get there from here -*- lexical-binding: t; -*-
  268. ;; Copyright (C) 2017-2019 Ian Eure
  269. ;; Author: Ian Eure <ian@retrospec.tv>
  270. ;; URL: https://github.com/ieure/hyperspace-el
  271. ;; Version: 0.8.4
  272. ;; Package-Requires: ((emacs "25") (s "1.12.0"))
  273. ;; Keywords: tools, convenience
  274. ;; This program is free software; you can redistribute it and/or modify
  275. ;; it under the terms of the GNU General Public License as published by
  276. ;; the Free Software Foundation, either version 3 of the License, or
  277. ;; (at your option) any later version.
  278. ;; This program is distributed in the hope that it will be useful,
  279. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  280. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  281. ;; GNU General Public License for more details.
  282. ;; You should have received a copy of the GNU General Public License
  283. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  284. ;;; Commentary:
  285. ;; Hyperspace is a way to get nearly anywhere from wherever you are,
  286. ;; whether that's within Emacs or on the web. It's somewhere in
  287. ;; between Quicksilver and keyword URLs, giving you a single,
  288. ;; consistent interface to get directly where you want to go. It’s
  289. ;; for things that you use often, but not often enough to justify a
  290. ;; dedicated binding.
  291. ;;
  292. ;; When you enter Hyperspace, it prompts you where to go:
  293. ;;
  294. ;; HS:
  295. ;;
  296. ;; This prompt expects a keyword and a query. The keyword picks where
  297. ;; you want to go, and the remainder of the input is an optional
  298. ;; argument which can be used to further search or direct you within
  299. ;; that space.
  300. ;;
  301. ;; Some concrete examples:
  302. ;;
  303. ;; | *If you enter* | *then Hyperspace* |
  304. ;; |------------------+----------------------------------------------------------|
  305. ;; | "el" | opens info node "(elisp)Top" |
  306. ;; | "el eval-region" | searches for "eval-region" in the elisp Info index |
  307. ;; | "bb" | shows all BBDB entries |
  308. ;; | "bb kenneth" | shows all BBDB entries with a name matching "kenneth" |
  309. ;; | "ddg foo" | searches DuckDuckGo for "foo" using browse-url |
  310. ;; | "wp foo" | searches Wikipedia for "foo" using browse-url |
  311. ;;
  312. ;;; Code:
  313. (require 'subr-x)
  314. (require 's)
  315. ;; Action helpers
  316. (defun hyperspace-action->browse-url-pattern (pattern query)
  317. "Browse a URL former from PATTERN and QUERY."
  318. (browse-url (format pattern query)))
  319. (defun hyperspace-action->info (node &optional query)
  320. "Open an Info buffer for NODE.
  321. If QUERY is present, look it up in the index."
  322. (info node)
  323. (when query
  324. (Info-index query)))
  325. ;; Package definitions
  326. (defvar hyperspace-history nil
  327. "History of Hyperspace actions.")
  328. (defgroup hyperspace nil
  329. "Getting there from here"
  330. :prefix "hyperspace-"
  331. :group 'applications)
  332. (defcustom hyperspace-actions
  333. '(("ddg" . "https://duckduckgo.com/?q=%s")
  334. ("dis" . "https://duckduckgo.com/?q=%s&iax=images&ia=images")
  335. ("wp" . "https://en.wikipedia.org/wiki/%s")
  336. ("g" . "https://www.google.com/search?q=%s")
  337. ("gi" . "https://www.google.com/search?tbm=isch&q=%s")
  338. ("gm" . "https://www.google.com/maps/search/%s")
  339. ("yt" . "https://www.youtube.com/results?search_query=%s")
  340. ("clp" . "https://portland.craigslist.org/search/sss?query=%s")
  341. ("eb" . "https://www.ebay.com/sch/i.html?_nkw=%s")
  342. ("nf" . "https://www.netflix.com/search?q=%s")
  343. ("sh" . (lambda (query) (interactive) (shell-command query)))
  344. ("imdb" . "https://www.imdb.com/find?q=peter+jackson&s=all")
  345. ("bb" . bbdb-search-name)
  346. ("el" . (apply-partially #'hyperspace-action->info "(elisp)Top"))
  347. ("av" . apropos-variable)
  348. ("ac" . apropos-command)
  349. ("af" . (lambda (query) (apropos-command query t))))
  350. "Where Hyperspace should send you.
  351. Hyperspace actions are a cons of (KEYWORD . DISPATCHER). When
  352. Hyperspace is invoked, the keyword is extracted from the user
  353. input and looked up in this alist. The remainder of the
  354. string is passed to the dispatcher as its QUERY argument.
  355. DISPATCHER can be a function which performs the action.
  356. DISPATCHER can also be an expression which returns a function
  357. to perform the action.
  358. Finally, DISPATCHER can be a string with a URL pattern containing
  359. '%s'. The '%s' will be replaced with the query, and the URL browsed."
  360. :group 'hyperspace
  361. :type '(alist :key-type (string :tag "Keyword")
  362. :value-type (choice
  363. (function :tag "Function")
  364. (string :tag "URL Pattern")
  365. (sexp :tag "Expression"))))
  366. (defcustom hyperspace-default-action
  367. (caar hyperspace-actions)
  368. "A place to go if you don't specify one."
  369. :group 'hyperspace
  370. :type `(radio
  371. ,@(mapcar (lambda (action) (list 'const (car action))) hyperspace-actions)))
  372. (defcustom hyperspace-max-region-size 256
  373. "Maximum size of a region to consider for a Hyperspace query.
  374. If the region is active when Hyperspace is invoked, it's used
  375. as the default query, unless it's more than this number of
  376. characters."
  377. :group 'hyperspace
  378. :type 'integer)
  379. (defun hyperspace--cleanup (text)
  380. "Clean TEXT so it can be used for a Hyperspace query."
  381. (save-match-data
  382. (string-trim
  383. (replace-regexp-in-string (rx (1+ (or blank "\n"))) " " text))))
  384. (defun hyperspace--initial-text ()
  385. "Return the initial text.
  386. This is whatever's in the active region, but cleaned up."
  387. (when (use-region-p)
  388. (let* ((start (region-beginning))
  389. (end (region-end))
  390. (size (- end start)))
  391. (when (<= size hyperspace-max-region-size)
  392. (hyperspace--cleanup
  393. (buffer-substring-no-properties start end))))))
  394. (defun hyperspace--initial (initial-text)
  395. "Turn INITIAL-TEXT into INITIAL-CONTENTS for reading."
  396. (when initial-text (cons (concat " " initial-text) 1)))
  397. (defun hyperspace--process-input (text)
  398. "Process TEXT into an actionable keyword and query."
  399. (let ((kw-text (s-split-up-to "\\s-+" text 1)))
  400. (if (assoc (car kw-text) hyperspace-actions)
  401. kw-text
  402. (list hyperspace-default-action text))))
  403. (defun hyperspace--query ()
  404. "Ask the user for the Hyperspace action and query.
  405. Returns (KEYWORD . QUERY).
  406. If the region isn't active, the user is prompted for the
  407. action and query.
  408. If the region is active, its text is used as the initial value
  409. for the query, and the user enters the action.
  410. If a prefix argument is specified and the region is active,
  411. `HYPERSPACE-DEFAULT-ACTION' is chosen without prompting."
  412. (let ((initial (hyperspace--initial-text)))
  413. (if (and initial current-prefix-arg)
  414. (list hyperspace-default-action initial)
  415. (hyperspace--process-input
  416. (read-from-minibuffer "HS: " (hyperspace--initial initial) nil nil
  417. 'hyperspace-history)))))
  418. (defun hyperspace--evalable-p (form)
  419. "Can FORM be evaluated?"
  420. (and (listp form)
  421. (or (functionp (car form))
  422. (subrp (car form)))))
  423. (defun hyperspace--dispatch (action &optional query)
  424. "Execute ACTION, with optional QUERY argument."
  425. (pcase action
  426. ((pred functionp) (funcall action query))
  427. ((pred hyperspace--evalable-p) (funcall (eval action) query))
  428. ((pred stringp) (hyperspace-action->browse-url-pattern action query))
  429. (_ (error "Unknown action"))))
  430. ;;;###autoload
  431. (defun hyperspace (keyword &optional query)
  432. "Execute action for keyword KEYWORD, with optional QUERY."
  433. (interactive (hyperspace--query))
  434. (let ((action (cdr (assoc keyword hyperspace-actions))))
  435. (hyperspace--dispatch (or action hyperspace-default-action) query)))
  436. ;;;###autoload
  437. (defun hyperspace-enter (&optional query)
  438. "Enter Hyperspace, sending QUERY to the default action.
  439. If the region is active, use that as the query for
  440. ‘hyperspace-default-action’. Otherwise, prompt the user."
  441. (interactive (list (hyperspace--initial-text)))
  442. (hyperspace
  443. hyperspace-default-action
  444. (or query
  445. (read-from-minibuffer
  446. (format "HS: %s " hyperspace-default-action) nil nil
  447. 'hyperspace-history))))
  448. ;; Minor mode
  449. (defvar hyperspace-minor-mode-map
  450. (let ((kmap (make-sparse-keymap)))
  451. (define-key kmap (kbd "H-SPC") #'hyperspace)
  452. (define-key kmap (kbd "<H-return>") #'hyperspace-enter)
  453. kmap))
  454. ;;;###autoload
  455. (define-minor-mode hyperspace-minor-mode
  456. "Global (universal) minor mode to jump from here to there."
  457. nil nil hyperspace-minor-mode-map
  458. :group 'hyperspace
  459. :global t)
  460. (provide 'hyperspace)
  461. ;;; hyperspace.el ends here
  462. #+END_SRC
  463. ** Tools
  464. *** General
  465. #+BEGIN_SRC emacs-lisp :results silent
  466. (require 'which-key)
  467. (which-key-setup-minibuffer)
  468. (which-key-mode)
  469. (require 'fic-mode)
  470. (add-hook 'js-mode-hook 'fic-mode)
  471. #+END_SRC
  472. *** Company
  473. #+BEGIN_SRC emacs-lisp :results silent
  474. (require 'company)
  475. (add-hook 'after-init-hook 'global-company-mode)
  476. (setq company-dabbrev-downcase nil)
  477. (setq company-idle-delay 0.1)
  478. #+END_SRC
  479. *** Diminish
  480. #+BEGIN_SRC emacs-lisp :results silent
  481. (require 'diminish)
  482. (diminish 'auto-revert-mode)
  483. (eval-after-load "company" '(diminish 'company-mode))
  484. (eval-after-load "counsel" '(diminish 'counsel-mode))
  485. (eval-after-load "elpy" '(diminish 'elpy-mode))
  486. (eval-after-load "go-mode" '(diminish 'go-mode))
  487. (eval-after-load "go-playground" '(diminish 'go-playground-mode))
  488. (eval-after-load "gorepl-mode" '(diminish 'gorepl-mode))
  489. (eval-after-load "flycheck" '(diminish 'flycheck-mode))
  490. (eval-after-load "ivy" '(diminish 'ivy-mode))
  491. (eval-after-load "projectile" '(diminish 'projectile-mode))
  492. (eval-after-load "which-key" '(diminish 'which-key-mode))
  493. #+END_SRC
  494. *** Dired
  495. #+BEGIN_SRC emacs-lisp :results silent
  496. (defun dired-mode-setup ()
  497. "Will run as hook for `dired-mode'."
  498. (dired-hide-details-mode nil))
  499. (add-hook 'dired-mode-hook 'dired-mode-setup)
  500. #+END_SRC
  501. *** Ivy
  502. #+BEGIN_SRC emacs-lisp :results silent
  503. (require 'ivy-hydra)
  504. (require 'ivy)
  505. (require 'swiper)
  506. (ivy-mode 1)
  507. (counsel-mode)
  508. (setq ivy-use-virtual-buffers t
  509. enable-recursive-minibuffers t
  510. ivy-height 25
  511. ivy-initial-inputs-alist nil
  512. ivy-extra-directories nil)
  513. (global-set-key (kbd "C-s") 'swiper)
  514. (global-set-key (kbd "C-c C-r") 'ivy-resume)
  515. (global-set-key (kbd "M-x") 'counsel-M-x)
  516. (global-set-key (kbd "C-x C-f") 'counsel-find-file)
  517. (global-set-key (kbd "C-c g") 'counsel-git)
  518. (global-set-key (kbd "C-c j") 'counsel-git-grep)
  519. (global-set-key (kbd "C-c k") 'counsel-ag)
  520. (define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
  521. (defun ivy-open-current-typed-path ()
  522. (interactive)
  523. (when ivy--directory
  524. (let* ((dir ivy--directory)
  525. (text-typed ivy-text)
  526. (path (concat dir text-typed)))
  527. (delete-minibuffer-contents)
  528. (ivy--done path))))
  529. (define-key ivy-minibuffer-map (kbd "<return>") 'ivy-alt-done)
  530. (define-key ivy-minibuffer-map (kbd "C-f") 'ivy-open-current-typed-path)
  531. #+END_SRC
  532. *** Magit
  533. #+BEGIN_SRC emacs-lisp :results silent
  534. (require 'magit)
  535. (global-set-key (kbd "C-x g") 'magit-status)
  536. (global-set-key (kbd "C-c g") 'magit-status)
  537. (setq magit-completing-read-function 'ivy-completing-read)
  538. #+END_SRC
  539. *** Mu4e
  540. #+BEGIN_SRC emacs-lisp :results silent
  541. (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu/mu4e")
  542. (require 'mu4e)
  543. ;; default
  544. (setq mu4e-maildir "~/Mail"
  545. mu4e-mu-binary "/usr/local/bin/mu"
  546. mu4e-change-filenames-when-moving t ;; Rename files when moving (required by mbsync)
  547. mu4e-compose-in-new-frame t ;; New compose gets new frame
  548. mu4e-context-policy 'pick-first
  549. mu4e-get-mail-command "mbsync -a" ;; MBSYNC is the mail cmd
  550. mu4e-html2text-command "/usr/local/bin/w3m -T text/html" ;; HTML to text command
  551. mu4e-headers-include-related nil ;; Stop threading in INBOX
  552. mu4e-sent-messages-behavior 'delete ;; Delete sent messages
  553. mu4e-update-interval 300 ;; 5 mins
  554. mu4e-use-fancy-chars t ;; use 'fancy' chars
  555. mu4e-user-mail-address-list '("lolson@eaglecrk.com"
  556. "lolson@vlocity.com"
  557. "olson.levi@gmail.com")
  558. mu4e-view-show-images t ;; attempt to show images
  559. mu4e-view-image-max-width 400 ;; max image size
  560. message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n" ;; customize the reply-quote-string
  561. message-citation-line-function 'message-insert-formatted-citation-line ;; choose to use the formatted string
  562. message-kill-buffer-on-exit t ;; don't keep messages around
  563. send-mail-function 'smtpmail-send-it ;; Default email send function
  564. smtpmail-default-smtp-server "smtp.gmail.com"
  565. smtpmail-smtp-service 587
  566. )
  567. (defun leo/convert-message-set-point ()
  568. "Set the point to the start of the message body."
  569. (interactive)
  570. (beginning-of-buffer)
  571. (search-forward "--text follows this line--")
  572. (forward-char)
  573. )
  574. (defun leo/convert-message-from-markdown ()
  575. "Convert a markdown flavored mail buffer to html w/mime support."
  576. (interactive)
  577. (if (y-or-n-p "Convert to HTML? ")
  578. ((leo/convert-message-set-point)
  579. (save-excursion
  580. (message-goto-body)
  581. (shell-command-on-region (point) (point-max) "~/.emacs.d/scripts/expand-mime.sh" nil t)))
  582. (message "Aborting."))
  583. )
  584. (setq mu4e-contexts
  585. `(
  586. ;; ,(make-mu4e-context
  587. ;; :name "Vlocity"
  588. ;; :enter-func (lambda () (mu4e-message "Entering Vlocity"))
  589. ;; :leave-func (lambda () (mu4e-message "Leaving Vlocity"))
  590. ;; ;; we match based on the contact-fields of the message
  591. ;; :match-func (lambda (msg)
  592. ;; (when msg
  593. ;; (string= (mu4e-message-field msg :maildir) "/Vlocity")))
  594. ;; :vars '( ( user-mail-address . "lolson@vlocity.com" )
  595. ;; ( smtpmail-mail-address . "lolson@vlocity.com" )
  596. ;; ( smtpmail-smtp-user . "lolson@vlocity.com" )
  597. ;; ( smtpmail-smtp-server . "smtp.gmail.com" )
  598. ;; ( user-full-name . "Levi Olson" )
  599. ;; ( mu4e-compose-signature .
  600. ;; (concat
  601. ;; "Levi Olson\n"
  602. ;; "Senior UI Developer"))
  603. ;; ( mu4e-sent-folder . "/Vlocity/[Gmail].Sent Mail" )
  604. ;; ( mu4e-drafts-folder . "/Vlocity/[Gmail].Drafts" )
  605. ;; ( mu4e-trash-folder . "/Vlocity/[Gmail].Trash" )
  606. ;; ( mu4e-maildir-shortcuts . (("/Vlocity/INBOX" . ?i)
  607. ;; ("/Vlocity/[Gmail].Sent Mail" . ?s)
  608. ;; ("/Vlocity/[Gmail].Trash" . ?t)
  609. ;; ("/Vlocity/[Gmail].All Mail" . ?a)))))
  610. ,(make-mu4e-context
  611. :name "EagleCreek"
  612. :enter-func (lambda () (mu4e-message "Entering EagleCreek"))
  613. :leave-func (lambda () (mu4e-message "Leaving EagleCreek"))
  614. ;; we match based on the contact-fields of the message
  615. :match-func (lambda (msg)
  616. (when msg
  617. (string= (mu4e-message-field msg :maildir) "/eaglecrk")))
  618. :vars '( ( user-mail-address . "lolson@eaglecrk.com" )
  619. ( smtpmail-mail-address . "lolson@eaglecrk.com" )
  620. ( smtpmail-smtp-user . "lolson@eaglecrk.com" )
  621. ( smtpmail-smtp-server . "smtp.office365.com" )
  622. ( user-full-name . "Levi Olson" )
  623. ;; ( mu4e-compose-signature .
  624. ;; (concat
  625. ;; "Levi Olson\n"
  626. ;; "Eagle Creek Software Services\n"
  627. ;; "Senior Application Developer Consultant\n"))
  628. ( mu4e-sent-folder . "/eaglecrk/Sent Items" )
  629. ( mu4e-drafts-folder . "/eaglecrk/Drafts" )
  630. ( mu4e-trash-folder . "/eaglecrk/Deleted Items" )
  631. ( mu4e-maildir-shortcuts . (("/eaglecrk/Inbox" . ?i)
  632. ("/eaglecrk/Sent Items" . ?s)
  633. ("/eaglecrk/Deleted Items" . ?t)
  634. ("/eaglecrk/Archive" . ?a)))))
  635. ;; ,(make-mu4e-context
  636. ;; :name "Gmail"
  637. ;; :enter-func (lambda () (mu4e-message "Entering Gmail"))
  638. ;; :leave-func (lambda () (mu4e-message "Leaving Gmail"))
  639. ;; ;; this matches maildir /Arkham and its sub-directories
  640. ;; :match-func (lambda (msg)
  641. ;; (when msg
  642. ;; (string= (mu4e-message-field msg :maildir) "/Gmail")))
  643. ;; :vars '( ( user-mail-address . "olson.levi@gmail.com" )
  644. ;; ( smtpmail-mail-address . "olson.levi@gmail.com" )
  645. ;; ( smtpmail-smtp-user . "olson.levi@gmail.com" )
  646. ;; ( smtpmail-smtp-server . "smtp.gmail.com" )
  647. ;; ( user-full-name . "Levi Olson" )
  648. ;; ( mu4e-compose-signature .
  649. ;; (concat
  650. ;; "Levi\n"))
  651. ;; ( mu4e-sent-folder . "/Gmail/[Gmail].Sent Mail" )
  652. ;; ( mu4e-drafts-folder . "/Gmail/[Gmail].Drafts" )
  653. ;; ( mu4e-trash-folder . "/Gmail/[Gmail].Trash" )
  654. ;; ( mu4e-maildir-shortcuts . (("/Gmail/INBOX" . ?i)
  655. ;; ("/Gmail/[Gmail].Sent Mail" . ?s)
  656. ;; ("/Gmail/[Gmail].Trash" . ?t)
  657. ;; ("/Gmail/[Gmail].All Mail" . ?a))
  658. ;; )))
  659. ))
  660. ;; Add option to view HTML in browser
  661. (add-to-list 'mu4e-headers-actions
  662. '("in browser" . mu4e-action-view-in-browser) t)
  663. (add-to-list 'mu4e-view-actions
  664. '("in browser" . mu4e-action-view-in-browser) t)
  665. (defun my-message-current-line-cited-p ()
  666. "Indicate whether the line at point is a cited line."
  667. (save-match-data
  668. (string-match (concat "^" message-cite-prefix-regexp)
  669. (buffer-substring (line-beginning-position) (line-end-position)))))
  670. (defun my-message-says-attachment-p ()
  671. "Return t if the message suggests there can be an attachment."
  672. (save-excursion
  673. (goto-char (point-min))
  674. (save-match-data
  675. (let (search-result)
  676. (while
  677. (and (setq search-result (re-search-forward "\\(attach\\|pdf\\|file\\)" nil t))
  678. (my-message-current-line-cited-p)))
  679. search-result))))
  680. (defun my-message-has-attachment-p ()
  681. "Return t if the message has an attachment."
  682. (save-excursion
  683. (goto-char (point-min))
  684. (save-match-data
  685. (re-search-forward "<#part" nil t))))
  686. (defun my-message-pre-send-check-attachment ()
  687. (when (and (my-message-says-attachment-p)
  688. (not (my-message-has-attachment-p)))
  689. (unless
  690. (y-or-n-p "No attachment. Send anyway?")
  691. (error "It seems that an attachment is needed, but none was found. Aborting sending."))))
  692. (add-hook 'message-send-hook 'my-message-pre-send-check-attachment)
  693. #+END_SRC
  694. *** Projectile
  695. #+BEGIN_SRC emacs-lisp :results silent
  696. (require 'projectile)
  697. (require 'counsel-projectile)
  698. (projectile-mode)
  699. (setq projectile-mode-line '(:eval (format " %s" (projectile-project-name)))
  700. projectile-remember-window-configs t
  701. projectile-completion-system 'ivy)
  702. (counsel-projectile-mode)
  703. #+END_SRC
  704. *** Notify
  705. #+BEGIN_SRC emacs-lisp :results silent
  706. ;;; notify.el --- notification front-end
  707. ;; Copyright (C) 2008 Mark A. Hershberger
  708. ;; Original Author: Mark A. Hershberger <mhersberger@intrahealth.org>
  709. ;; Modified by Andrey Kotlarski <m00naticus@gmail.com>
  710. ;; Modified by Andrew Gwozdziewycz <git@apgwoz.com>
  711. ;; Modified by Aidan Gauland <aidalgol@no8wireless.co.nz> October 2011
  712. ;; Modified by Olivier Sirven <the.slaa@gmail.com> November 2013
  713. ;; Keywords: extensions, convenience, lisp
  714. ;; This file is free software; you can redistribute it and/or modify
  715. ;; it under the terms of the GNU General Public License as published by
  716. ;; the Free Software Foundation; either version 2, or (at your option)
  717. ;; any later version.
  718. ;; This file is distributed in the hope that it will be useful,
  719. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  720. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  721. ;; GNU General Public License for more details.
  722. ;; You should have received a copy of the GNU General Public License
  723. ;; along with GNU Emacs; see the file COPYING. If not, write to
  724. ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  725. ;; Boston, MA 02111-1307, USA.
  726. ;;; Commentary:
  727. ;; This provides a single function, `notify', that will produce a notify
  728. ;; pop-up via D-Bus, libnotify, simple message or growl.
  729. ;; To use, just put (autoload 'notify "notify" "Notify TITLE, BODY.")
  730. ;; in your init file. You may override default chosen notification
  731. ;; method by assigning `notify-method' to one of 'notify-via-dbus
  732. ;; 'notify-via-libnotify or 'notify-via-message
  733. ;;; Code:
  734. (defvar notify-defaults (list :app "Emacs" :icon "emacs" :timeout 5000
  735. :urgency "low"
  736. :category "emacs.message")
  737. "Notification settings' defaults.
  738. May be overridden with key-value additional arguments to `notify'.")
  739. (defvar notify-delay '(0 5 0)
  740. "Minimum time allowed between notifications in time format.")
  741. (defvar notify-last-notification '(0 0 0) "Time of last notification.")
  742. (defvar notify-method 'notify-via-growl "Notification method among
  743. 'notify-via-dbus, 'notify-via-libnotify, 'notify-via-message or
  744. 'notify-via-growl")
  745. ;; determine notification method unless already set
  746. ;; prefer growl > D-Bus > libnotify > message
  747. (cond
  748. ((null notify-method)
  749. (setq notify-method
  750. (cond
  751. ((executable-find "growlnotify") 'notify-via-growl)
  752. ((and (require 'dbus nil t)
  753. (dbus-ping :session "org.freedesktop.Notifications"))
  754. (defvar notify-id 0 "Current D-Bus notification id.")
  755. 'notify-via-dbus)
  756. ((executable-find "notify-send") 'notify-via-libnotify)
  757. (t 'notify-via-message))))
  758. ((eq notify-method 'notify-via-dbus) ;housekeeping for pre-chosen DBus
  759. (if (and (require 'dbus nil t)
  760. (dbus-ping :session "org.freedesktop.Notifications"))
  761. (defvar notify-id 0 "Current D-Bus notification id.")
  762. (setq notify-method (if (executable-find "notify-send")
  763. 'notify-via-libnotify
  764. 'notify-via-message))))
  765. ((and (eq notify-method 'notify-via-libnotify)
  766. (not (executable-find "notify-send"))) ;housekeeping for pre-chosen libnotify
  767. (setq notify-method
  768. (if (and (require 'dbus nil t)
  769. (dbus-ping :session "org.freedesktop.Notifications"))
  770. (progn
  771. (defvar notify-id 0 "Current D-Bus notification id.")
  772. 'notify-via-dbus)
  773. 'notify-via-message)))
  774. ((and (eq notify-method 'notify-via-growl)
  775. (not (executable-find "growlnotify")))
  776. (setq notify-method 'notify-via-message)))
  777. (defun notify-via-dbus (title body)
  778. "Send notification with TITLE, BODY `D-Bus'."
  779. (dbus-call-method :session "org.freedesktop.Notifications"
  780. "/org/freedesktop/Notifications"
  781. "org.freedesktop.Notifications" "Notify"
  782. (get 'notify-defaults :app)
  783. (setq notify-id (+ notify-id 1))
  784. (get 'notify-defaults :icon) title body '(:array)
  785. '(:array :signature "{sv}") ':int32
  786. (get 'notify-defaults :timeout)))
  787. (defun notify-via-libnotify (title body)
  788. "Notify with TITLE, BODY via `libnotify'."
  789. (call-process "notify-send" nil 0 nil
  790. title body "-t"
  791. (number-to-string (get 'notify-defaults :timeout))
  792. "-i" (get 'notify-defaults :icon)
  793. "-u" (get 'notify-defaults :urgency)
  794. "-c" (get 'notify-defaults :category)))
  795. (defun notify-via-message (title body)
  796. "Notify TITLE, BODY with a simple message."
  797. (message "%s: %s" title body))
  798. (defun notify-via-growl (title body)
  799. "Notify TITLE, BODY with a growl"
  800. (call-process "growlnotify" nil 0 nil
  801. "-a" (get 'notify-defaults :app)
  802. "-n" (get 'notify-defaults :category)
  803. "-t" (notify-via-growl-stringify title)
  804. "-m" (notify-via-growl-stringify body)))
  805. (defun notify-via-growl-stringify (thing)
  806. (cond ((null thing) "")
  807. ((stringp thing) thing)
  808. (t (format "%s" thing))))
  809. (defun keywords-to-properties (symbol args &optional defaults)
  810. "Add to SYMBOL's property list key-values from ARGS and DEFAULTS."
  811. (when (consp defaults)
  812. (keywords-to-properties symbol defaults))
  813. (while args
  814. (put symbol (car args) (cadr args))
  815. (setq args (cddr args))))
  816. ;;;###autoload
  817. (defun notify (title body &rest args)
  818. "Notify TITLE, BODY via `notify-method'.
  819. ARGS may be amongst :timeout, :icon, :urgency, :app and :category."
  820. (when (time-less-p notify-delay
  821. (time-since notify-last-notification))
  822. (or (eq notify-method 'notify-via-message)
  823. (keywords-to-properties 'notify-defaults args
  824. notify-defaults))
  825. (setq notify-last-notification (current-time))
  826. (funcall notify-method title body)))
  827. (provide 'notify)
  828. ;;; notify.el ends here
  829. #+END_SRC
  830. *** Jabber
  831. #+BEGIN_SRC emacs-lisp :results silent
  832. (require 'jabber)
  833. (setq jabber-history-enabled t
  834. jabber-use-global-history nil
  835. jabber-backlog-number 40
  836. jabber-backlog-days 30
  837. jabber-alert-presence-message-function (lambda (_who _oldstatus _newstatus _statustext) nil)
  838. )
  839. (setq jabber-account-list '(
  840. ;; ("olson.levi@gmail.com"
  841. ;; (:network-server . "talk.google.com")
  842. ;; (:connection-type . ssl))
  843. ("lolson@vlocity.com"
  844. (:network-server . "talk.google.com")
  845. (:connection-type . ssl))
  846. ))
  847. (defvar my-chat-prompt "[%t] %n>\n" "Customized chat prompt")
  848. (when (featurep 'jabber)
  849. (setq
  850. jabber-chat-foreign-prompt-format my-chat-prompt
  851. jabber-chat-local-prompt-format my-chat-prompt
  852. jabber-groupchat-prompt-format my-chat-prompt
  853. jabber-muc-private-foreign-prompt-format "[%t] %g/%n>\n"
  854. )
  855. )
  856. (defun notify-jabber-notify (from buf text _proposed-alert)
  857. "(jabber.el hook) Notify of new Jabber chat messages via notify.el"
  858. (when (or jabber-message-alert-same-buffer
  859. (not (memq (selected-window) (get-buffer-window-list buf))))
  860. (if (jabber-muc-sender-p from)
  861. (notify (format "(PM) %s"
  862. (jabber-jid-displayname (jabber-jid-user from)))
  863. (format "%s: %s" (jabber-jid-resource from) text)))
  864. (notify (format "%s" (jabber-jid-displayname from))
  865. text)))
  866. ;; (add-hook 'jabber-alert-message-hooks 'notify-jabber-notify)
  867. ;; (require 'autosmiley)
  868. ;; (add-hook 'jabber-chat-mode-hook 'autosmiley-mode)
  869. (defun jabber ()
  870. (interactive)
  871. (jabber-connect-all)
  872. (switch-to-buffer "*-jabber-roster-*"))
  873. #+END_SRC
  874. *** Terminal-Notifier
  875. #+BEGIN_SRC emacs-lisp :results silent :tangle no
  876. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  877. ;; Terminal notifier
  878. ;; requires 'brew install terminal-notifier'
  879. ;; stolen from erc-notifier
  880. (defvar terminal-notifier-command (executable-find "terminal-notifier") "The path to terminal-notifier.")
  881. ; (terminal-notifier-notify "Emacs notification" "Something amusing happened")
  882. (defun terminal-notifier-notify (title message)
  883. "Show a message with
  884. terminal-notifier-command
  885. ."
  886. (start-process "terminal-notifier"
  887. "terminal-notifier"
  888. terminal-notifier-command
  889. "-title" title
  890. "-message" message
  891. "-activate" "org.gnu.Emacs"))
  892. (defun timed-notification (time msg)
  893. (interactive "sNotification when (e.g: 2 minutes, 60 seconds, 3 days): \nsMessage: ")
  894. (run-at-time time nil (lambda (msg) (terminal-notifier-notify "Emacs" msg)) msg))
  895. #+END_SRC
  896. *** Hyperspace
  897. #+BEGIN_SRC emacs-lisp :results silent
  898. (defun hyperspace-action->mu4e (&optional query)
  899. "Search mu4e with QUERY.
  900. If QUERY is unspecified, use the first bookmark in variable
  901. ‘mu4e-bookmarks’ and update mail and index."
  902. (mu4e-headers-search (or query (caar mu4e-bookmarks)))
  903. (unless query
  904. (mu4e-update-mail-and-index nil)))
  905. (add-to-list 'hyperspace-actions '("m4" . hyperspace-action->mu4e))
  906. (defun hyperspace-action->elfeed (&optional query)
  907. "Load elfeed, optionally searching for QUERY."
  908. (elfeed)
  909. (if query
  910. (elfeed-search-set-filter query)
  911. (elfeed-search-fetch nil)))
  912. (add-to-list 'hyperspace-actions '("lf" . hyperspace-action->elfeed))
  913. #+END_SRC
  914. ** Development Specific
  915. *** General
  916. #+BEGIN_SRC emacs-lisp :results silent
  917. (require 'rainbow-delimiters)
  918. (global-flycheck-mode)
  919. (add-hook 'before-save-hook 'delete-trailing-whitespace)
  920. (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
  921. (setq-default indent-tabs-mode nil
  922. tab-width 4)
  923. (defvaralias 'c-basic-offset 'tab-width)
  924. (defvaralias 'cperl-indent-level 'tab-width)
  925. (electric-pair-mode 1)
  926. (show-paren-mode 1)
  927. (require 'dockerfile-mode)
  928. (add-to-list 'auto-mode-alist '("Dockerfile*\\'" . dockerfile-mode))
  929. (require 'gitignore-mode)
  930. (add-to-list 'auto-mode-alist '("gitignore\\'" . gitignore-mode))
  931. (require 'json-mode)
  932. (add-to-list 'auto-mode-alist '("\\.json\\'" . json-mode))
  933. (require 'web-mode)
  934. (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
  935. #+END_SRC
  936. *** Python
  937. #+BEGIN_SRC emacs-lisp :results silent
  938. (elpy-enable)
  939. (setq python-shell-interpreter "jupyter"
  940. python-shell-interpreter-args "console --simple-prompt")
  941. (when (require 'flycheck nil t)
  942. (setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
  943. (add-hook 'elpy-mode-hook 'flycheck-mode))
  944. (require 'py-autopep8)
  945. (setq py-autopep8-options '("--ignore=E501"))
  946. (add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)
  947. #+END_SRC
  948. *** Go
  949. #+BEGIN_SRC emacs-lisp :results silent
  950. (require 'go-mode)
  951. (require 'go-playground)
  952. (require 'gorepl-mode)
  953. (require 'company-go)
  954. (add-to-list 'auto-mode-alist '("\\.go\\'" . go-mode))
  955. (add-hook 'go-mode-hook (lambda ()
  956. (add-hook 'before-save-hook 'gofmt-before-save)
  957. (local-set-key (kbd "M-.") 'godef-jump)
  958. (local-set-key (kbd "M-,") 'pop-tag-mark)
  959. (local-set-key (kbd "C-c C-c") (lambda ()
  960. (interactive)
  961. (ansi-term)
  962. (comint-send-string "*ansi-term*" "make\n")))
  963. (set (make-local-variable 'company-backends) '(company-go))
  964. (setq company-tooltip-limit 20
  965. company-echo-delay 0
  966. company-begin-commands '(self-insert-command))
  967. (gorepl-mode)))
  968. (defun set-exec-path-from-shell-PATH ()
  969. (let ((path-from-shell (replace-regexp-in-string
  970. "[ \t\n]*$"
  971. ""
  972. (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'"))))
  973. (setenv "PATH" path-from-shell)
  974. (setq eshell-path-env path-from-shell)
  975. (setq exec-path (split-string path-from-shell path-separator))))
  976. (when window-system (set-exec-path-from-shell-PATH))
  977. (setenv "GOPATH" "/Users/leviolson/go")
  978. (add-to-list 'exec-path "/Users/leviolson/go/bin")
  979. #+END_SRC
  980. *** TypeScript
  981. #+BEGIN_SRC emacs-lisp :results silent
  982. (defun setup-tide-mode ()
  983. "Tide setup function."
  984. (interactive)
  985. (tide-setup)
  986. (flycheck-mode +1)
  987. (setq flycheck-check-syntax-automatically '(save mode-enabled))
  988. (eldoc-mode +1)
  989. (tide-hl-identifier-mode +1)
  990. (company-mode +1))
  991. ;; aligns annotation to the right hand side
  992. (setq company-tooltip-align-annotations t)
  993. ;; formats the buffer before saving
  994. (add-hook 'before-save-hook 'tide-format-before-save)
  995. (add-hook 'typescript-mode-hook #'setup-tide-mode)
  996. (require 'typescript-mode)
  997. (require 'tide)
  998. (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))
  999. (add-hook 'typescript-mode-hook
  1000. '(lambda ()
  1001. (set (make-local-variable 'company-backends) '(company-tide))
  1002. (setq company-tooltip-limit 20
  1003. company-echo-delay 0
  1004. company-begin-commands '(self-insert-command)
  1005. tide-format-options '(:insertSpaceAfterFunctionKeywordForAnonymousFunctions t :placeOpenBraceOnNewLineForFunctions nil))
  1006. (tide-setup)))
  1007. #+END_SRC
  1008. **** TSX
  1009. #+BEGIN_SRC emacs-lisp :results silent
  1010. (require 'web-mode)
  1011. (add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode))
  1012. (add-hook 'web-mode-hook
  1013. (lambda ()
  1014. (when (string-equal "tsx" (file-name-extension buffer-file-name))
  1015. (setup-tide-mode))))
  1016. ;; enable typescript-tslint checker
  1017. (flycheck-add-mode 'typescript-tslint 'web-mode)
  1018. #+END_SRC
  1019. **** JSX
  1020. #+BEGIN_SRC emacs-lisp :results silent
  1021. (require 'web-mode)
  1022. (add-to-list 'auto-mode-alist '("\\.jsx\\'" . web-mode))
  1023. (add-hook 'web-mode-hook
  1024. (lambda ()
  1025. (when (string-equal "jsx" (file-name-extension buffer-file-name))
  1026. (setup-tide-mode))))
  1027. ;; configure jsx-tide checker to run after your default jsx checker
  1028. (flycheck-add-mode 'javascript-eslint 'web-mode)
  1029. (flycheck-add-next-checker 'javascript-eslint 'jsx-tide 'append)
  1030. #+END_SRC
  1031. *** Org
  1032. #+BEGIN_SRC emacs-lisp :results silent
  1033. (org-babel-do-load-languages
  1034. 'org-babel-load-languages
  1035. '((js . t)
  1036. (shell . t)
  1037. (emacs-lisp . t)))
  1038. (setq org-todo-keywords
  1039. '((sequence "TODO(t)" "|" "DONE(d)")
  1040. (sequence "BUG(b)" "|" "INPROGRESS(i)" "FIXED(f)")
  1041. (sequence "|" "CANCELED(c)")
  1042. (sequence "|" "NEEDCLARIFICATION(n)")
  1043. (sequence "|" "PROVIDEUPDATE(p)")
  1044. (sequence "|" "WAITING(w)")
  1045. ))
  1046. (setq org-agenda-files
  1047. '("~/Dropbox/Org/todo.org" "~/Dropbox/Org/archive.org"))
  1048. (setq org-refile-targets
  1049. '((nil :maxlevel . 1)
  1050. (org-agenda-files :maxlevel . 1)))
  1051. (add-hook 'focus-in-hook
  1052. (lambda () (progn
  1053. (setq org-tags-column (- 5 (frame-width)))) (org-align-all-tags)))
  1054. (add-hook 'focus-out-hook
  1055. (lambda () (progn
  1056. (setq org-tags-column (- 5 (frame-width)))) (org-align-all-tags)))
  1057. (defvar org-src-tab-acts-natively)
  1058. (setq org-src-tab-acts-natively t)
  1059. ;; (setenv "NODE_PATH"
  1060. ;; (getenv "NODE_PATH"))
  1061. (defvar org-confirm-babel-evaluate)
  1062. (defun my-org-confirm-babel-evaluate (lang _body)
  1063. "Execute certain languages without confirming.
  1064. Takes LANG to allow and BODY to execute."
  1065. (not (or (string= lang "js")
  1066. (string= lang "restclient")
  1067. (string= lang "emacs-lisp")
  1068. (string= lang "shell"))))
  1069. (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
  1070. (add-to-list 'org-structure-template-alist
  1071. (list "e" (concat "#+BEGIN_SRC emacs-lisp :results silent\n"
  1072. "\n"
  1073. "#+END_SRC")))
  1074. (add-to-list 'org-structure-template-alist
  1075. (list "j" (concat "#+BEGIN_SRC js :cmd \"babel-node\"\n"
  1076. "\n"
  1077. "#+END_SRC")))
  1078. (add-to-list 'org-structure-template-alist
  1079. (list "r" (concat "#+BEGIN_SRC restclient :results raw\n"
  1080. "\n"
  1081. "#+END_SRC")))
  1082. #+END_SRC
  1083. **** Mu4e
  1084. #+BEGIN_SRC emacs-lisp :results silent
  1085. ;;store org-mode links to messages
  1086. (require 'org-mu4e)
  1087. ;;store link to message if in header view, not to header query
  1088. (setq org-mu4e-link-query-in-headers-mode nil)
  1089. (setq org-capture-templates
  1090. '(("t" "todo" entry (file+headline "~/todo.org" "Tasks")
  1091. "* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n")))
  1092. #+END_SRC
  1093. **** ElFeed
  1094. #+BEGIN_SRC emacs-lisp :results silent
  1095. (elfeed-org)
  1096. (setq rmh-elfeed-org-files (list "~/Dropbox/Org/elfeed.org"))
  1097. (defun leo/elfeed-search (arg)
  1098. "Search for ARG in feed."
  1099. (interactive)
  1100. (elfeed-search-set-filter arg))
  1101. (define-key elfeed-search-mode-map "a" (lambda () (interactive) (leo/elfeed-search "")))
  1102. (define-key elfeed-search-mode-map "e" (lambda () (interactive) (leo/elfeed-search "+emacs")))
  1103. (define-key elfeed-search-mode-map "d" (lambda () (interactive) (leo/elfeed-search "+daily")))
  1104. (define-key elfeed-search-mode-map "x" (lambda () (interactive) (leo/elfeed-search "xkcd")))
  1105. #+End_SRC
  1106. ** Functions
  1107. #+BEGIN_SRC emacs-lisp :results silent
  1108. (defun find-user-init-file ()
  1109. "Edit the `~/.emacs.d/init.org' file."
  1110. (interactive)
  1111. (find-file "~/.emacs.d/init.org"))
  1112. (defun find-todo-file ()
  1113. "Edit the `~/todo.org' file."
  1114. (interactive)
  1115. (find-file "~/Dropbox/Org/todo.org"))
  1116. (defun load-user-init-file ()
  1117. "LO: Reload the `~/.emacs.d/init.elc' file."
  1118. (interactive)
  1119. (load-file "~/.emacs.d/init.elc"))
  1120. (defun jump-to-symbol-internal (&optional backwardp)
  1121. "Jumps to the next symbol near the point if such a symbol exists. If BACKWARDP is non-nil it jumps backward."
  1122. (let* ((point (point))
  1123. (bounds (find-tag-default-bounds))
  1124. (beg (car bounds)) (end (cdr bounds))
  1125. (str (isearch-symbol-regexp (find-tag-default)))
  1126. (search (if backwardp 'search-backward-regexp
  1127. 'search-forward-regexp)))
  1128. (goto-char (if backwardp beg end))
  1129. (funcall search str nil t)
  1130. (cond ((<= beg (point) end) (goto-char point))
  1131. (backwardp (forward-char (- point beg)))
  1132. (t (backward-char (- end point))))))
  1133. (defun jump-to-previous-like-this ()
  1134. "Jumps to the previous occurrence of the symbol at point."
  1135. (interactive)
  1136. (jump-to-symbol-internal t))
  1137. (defun jump-to-next-like-this ()
  1138. "Jumps to the next occurrence of the symbol at point."
  1139. (interactive)
  1140. (jump-to-symbol-internal))
  1141. (defun match-paren (arg)
  1142. "Go to the matching paren if on a paren; otherwise insert ARG (a literal % sign)."
  1143. (interactive "p")
  1144. (cond ((looking-at "\\s(") (forward-list 1))
  1145. ((looking-back "\\s(" 2) (backward-char 1) (forward-list 1))
  1146. ((looking-at "\\s)") (forward-char 1) (backward-list 1))
  1147. ((looking-back "\\s)" 2) (backward-list 1))
  1148. (t (self-insert-command (or arg 1)))))
  1149. (defun kill-this-buffer-unless-scratch ()
  1150. "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."
  1151. (interactive)
  1152. (if (not (string= (buffer-name) "*scratch*"))
  1153. (kill-this-buffer)
  1154. (delete-region (point-min) (point-max))
  1155. (switch-to-buffer (other-buffer))
  1156. (bury-buffer "*scratch*")))
  1157. (defun delete-backward-sentence ()
  1158. "LO: Delete to the beginning of the sentence/line."
  1159. (interactive)
  1160. (delete-region (point) (progn (backward-sentence) (point))))
  1161. (defun delete-backward-to-boundary (arg)
  1162. "LO: Delete backward to the previous word boundary. With ARG, do this many times."
  1163. (interactive "p")
  1164. (let ((a (point))
  1165. (b (progn
  1166. (backward-word arg)
  1167. (forward-word)
  1168. (point))))
  1169. (if (< a b)
  1170. (delete-region a (progn (backward-word arg) (point)))
  1171. (if (= a b)
  1172. (delete-region a (progn (backward-word arg) (point)))
  1173. (delete-region a b)))))
  1174. (defun comment-or-uncomment-region-or-line ()
  1175. "Comments or uncomments the region or the current line if there's no active region."
  1176. (interactive)
  1177. (let (beg end)
  1178. (if (region-active-p)
  1179. (setq beg (region-beginning) end (region-end))
  1180. (setq beg (line-beginning-position) end (line-end-position)))
  1181. (comment-or-uncomment-region beg end)))
  1182. (defun fold-toggle (column)
  1183. "Code folding by COLUMN."
  1184. (interactive "P")
  1185. (set-selective-display
  1186. (or column
  1187. (unless selective-display
  1188. (1+ (current-column))))))
  1189. (defun new-line-below ()
  1190. "LO: Create a new line below current line."
  1191. (interactive)
  1192. (move-end-of-line 1)
  1193. (newline-and-indent))
  1194. (defun new-line-above ()
  1195. "LO: Create a new line above current line."
  1196. (interactive)
  1197. (move-beginning-of-line 1)
  1198. (newline)
  1199. (forward-line -1))
  1200. (defun duplicate-thing (comment)
  1201. "LO: Duplicates the current line, or the region if active. If an argument (COMMENT) is given, the duplicated region will be commented out."
  1202. (interactive "P")
  1203. (save-excursion
  1204. (let ((start (if (region-active-p) (region-beginning) (point-at-bol)))
  1205. (end (if (region-active-p) (region-end) (point-at-eol))))
  1206. (goto-char end)
  1207. (unless (region-active-p)
  1208. (newline))
  1209. (insert (buffer-substring start end))
  1210. (when comment (comment-region start end)))))
  1211. (defun tidy ()
  1212. "LO: Ident, untabify and unwhitespacify current buffer, or region if active."
  1213. (interactive)
  1214. (let ((beg (if (region-active-p) (region-beginning) (point-min)))
  1215. (end (if (region-active-p) (region-end) (point-max))))
  1216. (let ((inhibit-message t))
  1217. (indent-region beg end))
  1218. (whitespace-cleanup)
  1219. (untabify beg (if (< end (point-max)) end (point-max)))
  1220. (if (region-active-p) (message "Indenting Region...Done") (message "Indenting File...Done"))))
  1221. (defun phil-columns ()
  1222. "LO: Good 'ol Phil-Columns."
  1223. (interactive)
  1224. (message "Good 'ol fill-columns")
  1225. (with-output-to-temp-buffer "*PHIL-COLUMN*"
  1226. (shell-command "mpv --no-video 'https://www.youtube.com/watch?v=YkADj0TPrJA&t=3m16s' > /dev/null 2>&1 & sleep 8; pkill mpv"))
  1227. (other-window 1)
  1228. (delete-window))
  1229. (declare-function first "Goto FIRST shell.")
  1230. (declare-function goto-non-shell-buffer "Goto something other than a shell buffer.")
  1231. (declare-function switch-shell "Switch shell.")
  1232. (let ((last-shell ""))
  1233. (defun toggle-shell ()
  1234. (interactive)
  1235. (cond ((string-match-p "^\\*shell<[1-9][0-9]*>\\*$" (buffer-name))
  1236. (goto-non-shell-buffer))
  1237. ((get-buffer last-shell) (switch-to-buffer last-shell))
  1238. (t (shell (setq last-shell "*shell<1>*")))))
  1239. (defun switch-shell (n)
  1240. (let ((buffer-name (format "*shell<%d>*" n)))
  1241. (setq last-shell buffer-name)
  1242. (cond ((get-buffer buffer-name)
  1243. (switch-to-buffer buffer-name))
  1244. (t (shell buffer-name)
  1245. (rename-buffer buffer-name)))))
  1246. (defun goto-non-shell-buffer ()
  1247. (let* ((r "^\\*shell<[1-9][0-9]*>\\*$")
  1248. (shell-buffer-p (lambda (b) (string-match-p r (buffer-name b))))
  1249. (non-shells (cl-remove-if shell-buffer-p (buffer-list))))
  1250. (when non-shells
  1251. (switch-to-buffer (first non-shells))))))
  1252. (defadvice shell (after kill-with-no-query nil activate)
  1253. "."
  1254. (set-process-query-on-exit-flag (get-buffer-process ad-return-value) nil))
  1255. (declare-function comint-truncate-buffer ".")
  1256. (defun clear-comint ()
  1257. "Run `comint-truncate-buffer' with the `comint-buffer-maximum-size' set to zero."
  1258. (interactive)
  1259. (let ((comint-buffer-maximum-size 0))
  1260. (comint-truncate-buffer)))
  1261. (defun c-setup ()
  1262. "Compile."
  1263. (local-set-key (kbd "C-c C-c") 'compile))
  1264. #+END_SRC
  1265. ** Bindings
  1266. #+begin_src emacs-lisp :results silent
  1267. (require 'company)
  1268. (add-hook 'comint-mode-hook (lambda () (local-set-key (kbd "c-l") 'clear-comint)))
  1269. (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
  1270. (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
  1271. (add-hook 'c-mode-common-hook 'c-setup)
  1272. (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
  1273. (defvar company-active-map (make-keymap)
  1274. "company mode keymap.")
  1275. (defvar custom-bindings (make-keymap)
  1276. "a keymap of custom bindings.")
  1277. (define-key custom-bindings (kbd "M-p") 'jump-to-previous-like-this)
  1278. (define-key custom-bindings (kbd "M-n") 'jump-to-next-like-this)
  1279. (define-key custom-bindings (kbd "M-<tab>") 'switch-to-next-buffer)
  1280. (define-key custom-bindings (kbd "M-<backspace>")'delete-backward-to-boundary)
  1281. (define-key custom-bindings (kbd "C-<backspace>")'delete-backward-to-boundary)
  1282. (define-key custom-bindings (kbd "C-}") 'mc/mark-next-like-this)
  1283. (define-key custom-bindings (kbd "C-)") 'mc/unmark-next-like-this)
  1284. (define-key custom-bindings (kbd "C-{") 'mc/mark-previous-like-this)
  1285. (define-key custom-bindings (kbd "C-(") 'mc/unmark-previous-like-this)
  1286. (define-key custom-bindings (kbd "C-'") 'mc-hide-unmatched-lines-mode)
  1287. (define-key custom-bindings (kbd "C-c 1") 'mc/insert-numbers)
  1288. (define-key custom-bindings (kbd "C-c s") 'mc/sort-regions)
  1289. (define-key custom-bindings "%" 'match-paren)
  1290. (define-key custom-bindings (kbd "C-x .") 'dash-at-point)
  1291. (define-key custom-bindings (kbd "C-x ,") 'dash-at-point-with-docset)
  1292. (define-key custom-bindings (kbd "C-s") (lambda () (interactive) (swiper (format "%s" (thing-at-point 'symbol)))))
  1293. (define-key custom-bindings (kbd "C-x C-l m") 'mu4e)
  1294. (define-key custom-bindings (kbd "C-x C-o t") 'find-todo-file)
  1295. (define-key custom-bindings (kbd "C-x C-l j") 'jabber)
  1296. (define-key custom-bindings (kbd "C-x C-l f") 'elfeed)
  1297. (define-key custom-bindings (kbd "C-x C-l a") 'org-agenda)
  1298. (define-key custom-bindings (kbd "C-x C-l c") 'calendar)
  1299. (define-key custom-bindings (kbd "M-SPC") #'hyperspace)
  1300. ;; (dolist (n (number-sequence 1 9))
  1301. ;; (global-set-key (kbd (concat "M-" (int-to-string n)))
  1302. ;; (lambda () (interactive) (switch-shell n))))
  1303. (define-key company-active-map (kbd "C-d") 'company-show-doc-buffer)
  1304. (define-key company-active-map (kbd "C-n") 'company-select-next)
  1305. (define-key company-active-map (kbd "C-p") 'company-select-previous)
  1306. (define-key company-active-map (kbd "<tab>") 'company-complete)
  1307. (define-key custom-bindings (kbd "C-c p") 'counsel-projectile-switch-project)
  1308. (define-key custom-bindings (kbd "C-c f") 'counsel-projectile-find-file)
  1309. (define-key custom-bindings (kbd "C-c m") 'magit-status)
  1310. (define-key custom-bindings (kbd "C-c D") 'define-word-at-point)
  1311. (define-key custom-bindings (kbd "C-@") 'er/expand-region)
  1312. (define-key custom-bindings (kbd "C-#") 'er/contract-region)
  1313. (define-key custom-bindings (kbd "C-S-c C-S-c") 'mc/edit-lines)
  1314. (define-key custom-bindings (kbd "C-c b") 'ivy-switch-buffer)
  1315. (define-key custom-bindings (kbd "C-c l") 'org-store-link)
  1316. (define-key custom-bindings (kbd "C-c t") 'org-set-tags)
  1317. (define-key custom-bindings (kbd "M-u") 'upcase-dwim)
  1318. (define-key custom-bindings (kbd "M-c") 'capitalize-dwim)
  1319. (define-key custom-bindings (kbd "M-l") 'downcase-dwim)
  1320. (define-key custom-bindings (kbd "M-o") 'other-window)
  1321. (define-key custom-bindings (kbd "C-c s") 'ispell-word)
  1322. (define-key custom-bindings (kbd "C-c C-d") 'org-capture)
  1323. (define-key custom-bindings (kbd "C-c <up>") 'windmove-up)
  1324. (define-key custom-bindings (kbd "C-c <down>") 'windmove-down)
  1325. (define-key custom-bindings (kbd "C-c <left>") 'windmove-left)
  1326. (define-key custom-bindings (kbd "C-c <right>") 'windmove-right)
  1327. (define-key custom-bindings (kbd "C-c a") (lambda () (interactive) (org-agenda nil "n")))
  1328. (define-key custom-bindings (kbd "C-c e") 'find-user-init-file)
  1329. (define-key custom-bindings (kbd "C-x f") 'phil-columns)
  1330. (define-key custom-bindings (kbd "C-x k") 'kill-this-buffer-unless-scratch)
  1331. (define-key custom-bindings (kbd "C-c d") 'duplicate-thing)
  1332. (define-key custom-bindings (kbd "C-c c") 'comment-or-uncomment-region-or-line)
  1333. (define-key custom-bindings (kbd "C-;") 'comment-or-uncomment-region-or-line)
  1334. (define-key custom-bindings (kbd "C-o") 'new-line-below)
  1335. (define-key custom-bindings (kbd "C-S-o") 'new-line-above)
  1336. (define-key custom-bindings (kbd "<C-tab>") 'tidy)
  1337. (define-key custom-bindings (kbd "M-q") 'kill-this-buffer)
  1338. (define-key custom-bindings (kbd "M-RET") '(lambda () (interactive) (term (getenv "SHELL"))))
  1339. (define-minor-mode custom-bindings-mode
  1340. "A mode that activates custom-bindings."
  1341. t nil custom-bindings)
  1342. #+END_SRC
  1343. ** UI
  1344. #+BEGIN_SRC emacs-lisp :results silent
  1345. (cond ((member "PragmataPro" (font-family-list))
  1346. (set-face-attribute 'default nil :font "PragmataPro-14")))
  1347. #+END_SRC
  1348. *** Doom Modeline
  1349. #+BEGIN_SRC emacs-lisp :results silent
  1350. (require 'doom-modeline)
  1351. (doom-modeline-mode 1)
  1352. ;; How tall the mode-line should be (only respected in GUI Emacs).
  1353. (setq doom-modeline-height 30)
  1354. ;; How wide the mode-line bar should be (only respected in GUI Emacs).
  1355. (setq doom-modeline-bar-width 4)
  1356. ;; Determines the style used by `doom-modeline-buffer-file-name'.
  1357. ;;
  1358. ;; Given ~/Projects/FOSS/emacs/lisp/comint.el
  1359. ;; truncate-upto-project => ~/P/F/emacs/lisp/comint.el
  1360. ;; truncate-from-project => ~/Projects/FOSS/emacs/l/comint.el
  1361. ;; truncate-with-project => emacs/l/comint.el
  1362. ;; truncate-except-project => ~/P/F/emacs/l/comint.el
  1363. ;; truncate-upto-root => ~/P/F/e/lisp/comint.el
  1364. ;; truncate-all => ~/P/F/e/l/comint.el
  1365. ;; relative-from-project => emacs/lisp/comint.el
  1366. ;; relative-to-project => lisp/comint.el
  1367. ;; file-name => comint.el
  1368. ;; buffer-name => comint.el<2> (uniquify buffer name)
  1369. ;;
  1370. ;; If you are expereicing the laggy issue, especially while editing remote files
  1371. ;; with tramp, please try `file-name' style.
  1372. ;; Please refer to https://github.com/bbatsov/projectile/issues/657.
  1373. (setq doom-modeline-buffer-file-name-style 'truncate-upto-project)
  1374. ;; What executable of Python will be used (if nil nothing will be showed).
  1375. (setq doom-modeline-python-executable "python")
  1376. ;; Whether show `all-the-icons' or not (if nil nothing will be showed).
  1377. (setq doom-modeline-icon t)
  1378. ;; Whether show the icon for major mode. It respects `doom-modeline-icon'.
  1379. (setq doom-modeline-major-mode-icon t)
  1380. ;; Display color icons for `major-mode'. It respects `all-the-icons-color-icons'.
  1381. (setq doom-modeline-major-mode-color-icon nil)
  1382. ;; Whether display minor modes or not. Non-nil to display in mode-line.
  1383. (setq doom-modeline-minor-modes nil)
  1384. ;; If non-nil, a word count will be added to the selection-info modeline segment.
  1385. (setq doom-modeline-enable-word-count nil)
  1386. ;; If non-nil, only display one number for checker information if applicable.
  1387. (setq doom-modeline-checker-simple-format t)
  1388. ;; Whether display perspective name or not. Non-nil to display in mode-line.
  1389. (setq doom-modeline-persp-name t)
  1390. ;; Whether display `lsp' state or not. Non-nil to display in mode-line.
  1391. (setq doom-modeline-lsp t)
  1392. ;; Whether display github notifications or not. Requires `ghub` package.
  1393. (setq doom-modeline-github nil)
  1394. ;; The interval of checking github.
  1395. (setq doom-modeline-github-interval (* 30 60))
  1396. ;; Whether display environment version or not.
  1397. (setq doom-modeline-env-version t)
  1398. ;; Whether display mu4e notifications or not. Requires `mu4e-alert' package.
  1399. (setq doom-modeline-mu4e t)
  1400. #+END_SRC