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.

2232 lines
81 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
  1. #+TITLE: Emacs Configuration
  2. #+AUTHOR: Levi Olson
  3. #+EMAIL: olson.levi@gmail.com
  4. #+DATE: <2019-01-30 Wed>
  5. #+LANGUAGE: en
  6. #+STARTUP: showeverything
  7. #+BABEL: :cache yes
  8. #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="public/style.css" />
  9. #+EXPORT_FILE_NAME: index.html
  10. #+PROPERTY: header-args :tangle yes
  11. #+OPTIONS: num:10 whn:nil toc:10 H:10
  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. org-link-minor-mode
  85. ox-reveal
  86. poporg
  87. projectile
  88. rainbow-delimiters
  89. rainbow-mode
  90. rust-mode
  91. shrink-path
  92. tide
  93. typescript-mode
  94. ;; use-package
  95. web-mode
  96. which-key))
  97. (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
  98. (add-to-list 'package-archives '("melpa-stable" . "https://stable.melpa.org/packages/"))
  99. (when (not package-archive-contents)
  100. (package-refresh-contents))
  101. (package-initialize)
  102. (dolist (p my-packages)
  103. (when (not (package-installed-p p))
  104. (package-install p)))
  105. #+END_SRC
  106. ** Server
  107. #+BEGIN_SRC emacs-lisp :results silent :tangle yes
  108. (server-start)
  109. #+END_SRC
  110. ** Better Defaults
  111. #+BEGIN_SRC emacs-lisp :results silent
  112. (require 'better-defaults)
  113. ;; Instead of the annoying giant warning icon, just flash the modeline.
  114. ;; (this happens when you do something like C-g)
  115. (setq ring-bell-function
  116. (lambda ()
  117. (let ((orig-fg (face-foreground 'mode-line)))
  118. (set-face-foreground 'mode-line "#F2804F")
  119. (run-with-idle-timer 0.1 nil
  120. (lambda (fg) (set-face-foreground 'mode-line fg))
  121. orig-fg))))
  122. (defun set-frame-size-according-to-resolution ()
  123. "Set the Emacs window size on startup."
  124. (interactive)
  125. (if window-system
  126. (progn
  127. ;; WIDTH
  128. (if (> (x-display-pixel-width) 1280)
  129. ;; Large Screen (only show 120 cols)
  130. (add-to-list 'default-frame-alist (cons 'width 240))
  131. ;; Small Screen (fill window)
  132. (add-to-list 'default-frame-alist (cons 'width (/ (x-display-pixel-width) (frame-char-width)))))
  133. ;; HEIGHT
  134. (if (> (x-display-pixel-height) 1080)
  135. ;; Large Screen (only fill half screen)
  136. (add-to-list 'default-frame-alist (cons 'height (/ (/ (x-display-pixel-height) 2)
  137. (frame-char-height))))
  138. ;; Small Screen (fill window)
  139. (add-to-list 'default-frame-alist (cons 'height (/ (x-display-pixel-height) (frame-char-height)))))
  140. )))
  141. ;; (set-frame-size-according-to-resolution)
  142. (defun window-px-width ()
  143. "Get the width of the Emacs window in pixels."
  144. (interactive)
  145. (* (* (window-total-width) 2.874) (frame-char-width)))
  146. (defun window-px-left-pos ()
  147. "Calculate the left position of the Emacs window."
  148. (interactive)
  149. (/ (- (x-display-pixel-width) (window-px-width)) 2))
  150. ;; (add-to-list 'default-frame-alist (cons 'top 0))
  151. ;; (add-to-list 'default-frame-alist (cons 'left 1000))
  152. #+END_SRC
  153. ** Enable Disabled Commands
  154. #+BEGIN_SRC emacs-lisp :results silent
  155. (put 'narrow-to-region 'disabled nil)
  156. (put 'upcase-region 'disabled nil)
  157. (put 'downcase-region 'disabled nil)
  158. #+END_SRC
  159. ** Splash Screen
  160. #+BEGIN_SRC emacs-lisp :results silent
  161. (require 'dashboard)
  162. (dashboard-setup-startup-hook)
  163. ;; Set the title
  164. (setq dashboard-banner-logo-title "Let's begin...")
  165. ;; Set the banner
  166. (setq dashboard-startup-banner "~/.emacs.d/public/emacs-logo-350.png")
  167. ;; Value can be
  168. ;; 'official which displays the official emacs logo
  169. ;; 'logo which displays an alternative emacs logo
  170. ;; 1, 2 or 3 which displays one of the text banners
  171. ;; "path/to/your/image.png" which displays whatever image you would prefer
  172. ;; Content is not centered by default. To center, set
  173. (setq dashboard-center-content t)
  174. ;; To enable shortcut "jump" indicators for each section, set
  175. (setq dashboard-show-shortcuts t)
  176. (setq show-week-agenda-p t)
  177. (setq dashboard-org-agenda-categories '("work" "tasks"))
  178. (setq dashboard-items '((recents . 10)
  179. (bookmarks . 5)
  180. (projects . 5)
  181. ;; (agenda . 5)
  182. ;; (registers . 5)
  183. ))
  184. (add-to-list 'dashboard-items '(agenda) t)
  185. #+END_SRC
  186. ** Basic Customization
  187. #+BEGIN_SRC emacs-lisp :results silent
  188. (defvar backup-dir (expand-file-name "~/.emacs.d/backup/"))
  189. (defvar autosave-dir (expand-file-name "~/.emacs.d/autosave/"))
  190. (setq initial-scratch-message nil
  191. backup-directory-alist (list (cons ".*" backup-dir))
  192. auto-save-list-file-prefix autosave-dir
  193. auto-save-file-name-transforms `((".*" ,autosave-dir t)))
  194. (menu-bar-mode 0)
  195. (scroll-bar-mode 0)
  196. (tool-bar-mode 0)
  197. (setq auth-sources '("~/.authinfo.gpg"))
  198. (set-default 'truncate-lines t)
  199. (setq fill-column 80)
  200. ;; (add-hook 'text-mode-hook
  201. ;; (lambda ()
  202. ;; (when (y-or-n-p "Auto Fill mode? ")
  203. ;; (turn-on-auto-fill))))
  204. (setq whitespace-style '(face empty tabs lines-tail trailing))
  205. (global-whitespace-mode t)
  206. ;; (load-theme 'doom-city-lights t)
  207. ;; (load-theme 'doom-dracula t)
  208. ;; (load-theme 'doom-nord t)
  209. (load-theme 'doom-one t)
  210. ;; (load-theme 'doom-spacegrey t)
  211. ;; (load-theme 'base16-ocean t)
  212. (load-theme 'base16-onedark t)
  213. (global-linum-mode t)
  214. (global-auto-revert-mode t)
  215. (defalias 'yes-or-no-p 'y-or-n-p)
  216. #+END_SRC
  217. *** Diary
  218. #+BEGIN_SRC emacs-lisp :results silent
  219. (defvar diary-file (expand-file-name "~/.emacs.d/diary/main"))
  220. (add-hook 'diary-list-entries-hook 'diary-sort-entries t)
  221. (add-hook 'diary-list-entries-hook 'diary-include-other-diary-files)
  222. (add-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files)
  223. (add-hook 'calendar-today-visible-hook 'calendar-mark-today)
  224. (setq calendar-latitude 44
  225. calendar-longitude -97
  226. calendar-location-name "Hayti, SD")
  227. #+END_SRC
  228. ** Custom Modes
  229. *** OpenHAB Mode
  230. #+BEGIN_SRC emacs-lisp :results silent
  231. (require 'font-lock)
  232. (defvar openhab-mode-hook nil)
  233. (defvar openhab-mode-map
  234. (let ((map (make-keymap)))
  235. (define-key map "\C-j" 'newline-and-indent)
  236. map)
  237. "Keymap for OPENHAB major mode.")
  238. (add-to-list 'auto-mode-alist '("\\.sitemap\\'" . openhab-mode))
  239. (add-to-list 'auto-mode-alist '("\\.items\\'" . openhab-mode))
  240. (add-to-list 'auto-mode-alist '("\\.rules\\'" . openhab-mode))
  241. (add-to-list 'auto-mode-alist '("\\.things\\'" . openhab-mode))
  242. (defconst openhab-font-lock-keywords
  243. `(
  244. ("\<.*\>" . font-lock-constant-face)
  245. (,(regexp-opt
  246. '(
  247. ;; KEYWORDS
  248. "Selection" "Slider" "List" "Setpoint" "Video" "Chart" "Webview" "Colorpicker"
  249. "Timer" "Number" "String"
  250. "Switch" "Rollershutter" "Number" "String" "Dimmer" "Contact" "DateTime" "Color"
  251. "Text" "Group" "Image" "Frame"
  252. "Thing" "Bridge"
  253. "Time" "System"
  254. "sitemap"
  255. "rule" "when" "then" "end"
  256. "if" "val"
  257. "import" "var" "say" "postUpdate" "switch" "println" "case" "or" "sendCommand"
  258. )
  259. 'words)
  260. (1 font-lock-keyword-face))
  261. (,(regexp-opt
  262. '(
  263. "ON" "OFF" "on" "off"
  264. "AND" "OR" "NAND" "NOR" "AVG" "SUM" "MAX" "MIN"
  265. "true" "false"
  266. )
  267. 'words)
  268. (1 font-lock-constant-face))
  269. (,(regexp-opt
  270. '(
  271. "name" "label" "item" "period" "refresh" "icon" "mappings" "minValue" "maxValue" "step" "switchsupport" "url" "height" "refresh" "visibility" "valuecolor"
  272. )
  273. 'words)
  274. (1 font-lock-type-face))
  275. ("\(.*\)" . font-lock-variable-name-face)
  276. ("[^a-zA-Z0-9_:]\\([0-9]*\\)[^a-zA-Z0-9_:]" . (1 font-lock-variable-name-face))
  277. ("\s@\s" . font-lock-variable-name-face)
  278. ("\s\\([a-zA-Z0-9_:]*\\)\\(\s\\|$\\)" . (1 font-lock-type-face))
  279. ("=\\([a-zA-Z_]*\\)" . (1 font-lock-string-face))
  280. ("\\([a-zA-Z]*\\)=" . (1 font-lock-type-face))
  281. )
  282. "The regexps to highlight in openHAB mode.")
  283. (defvar openhab-mode-syntax-table
  284. (let ((st (make-syntax-table)))
  285. (modify-syntax-entry ?/ ". 12b" st) ;; C-style comments // ...
  286. (modify-syntax-entry ?\n "> b" st) ;; \n ends comment
  287. ;; Block comments /*...*/
  288. (modify-syntax-entry ?\/ ". 14" st)
  289. (modify-syntax-entry ?* ". 23" st)
  290. st)
  291. "Syntax table for openhab-mode.")
  292. (defun openhab-mode ()
  293. "Major mode for editing OPENHAB config files."
  294. (interactive)
  295. (kill-all-local-variables)
  296. (set-syntax-table openhab-mode-syntax-table)
  297. (use-local-map openhab-mode-map)
  298. (set (make-local-variable 'font-lock-defaults) '(openhab-font-lock-keywords nil t))
  299. (electric-pair-mode -1)
  300. (flycheck-mode -1)
  301. (setq major-mode 'openhab-mode)
  302. (setq mode-name "OpenHAB")
  303. (run-hooks 'openhab-mode-hook))
  304. (provide 'openhab-mode)
  305. #+END_SRC
  306. ** Custom Packages
  307. *** Hyperspace
  308. #+BEGIN_SRC emacs-lisp :results silent
  309. ;;; hyperspace.el --- Get there from here -*- lexical-binding: t; -*-
  310. ;; Copyright (C) 2017-2019 Ian Eure
  311. ;; Author: Ian Eure <ian@retrospec.tv>
  312. ;; URL: https://github.com/ieure/hyperspace-el
  313. ;; Version: 0.8.4
  314. ;; Package-Requires: ((emacs "25") (s "1.12.0"))
  315. ;; Keywords: tools, convenience
  316. ;; This program is free software; you can redistribute it and/or modify
  317. ;; it under the terms of the GNU General Public License as published by
  318. ;; the Free Software Foundation, either version 3 of the License, or
  319. ;; (at your option) any later version.
  320. ;; This program is distributed in the hope that it will be useful,
  321. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  322. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  323. ;; GNU General Public License for more details.
  324. ;; You should have received a copy of the GNU General Public License
  325. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  326. ;;; Commentary:
  327. ;; Hyperspace is a way to get nearly anywhere from wherever you are,
  328. ;; whether that's within Emacs or on the web. It's somewhere in
  329. ;; between Quicksilver and keyword URLs, giving you a single,
  330. ;; consistent interface to get directly where you want to go. It’s
  331. ;; for things that you use often, but not often enough to justify a
  332. ;; dedicated binding.
  333. ;;
  334. ;; When you enter Hyperspace, it prompts you where to go:
  335. ;;
  336. ;; HS:
  337. ;;
  338. ;; This prompt expects a keyword and a query. The keyword picks where
  339. ;; you want to go, and the remainder of the input is an optional
  340. ;; argument which can be used to further search or direct you within
  341. ;; that space.
  342. ;;
  343. ;; Some concrete examples:
  344. ;;
  345. ;; | *If you enter* | *then Hyperspace* |
  346. ;; |------------------+----------------------------------------------------------|
  347. ;; | "el" | opens info node "(elisp)Top" |
  348. ;; | "el eval-region" | searches for "eval-region" in the elisp Info index |
  349. ;; | "bb" | shows all BBDB entries |
  350. ;; | "bb kenneth" | shows all BBDB entries with a name matching "kenneth" |
  351. ;; | "ddg foo" | searches DuckDuckGo for "foo" using browse-url |
  352. ;; | "wp foo" | searches Wikipedia for "foo" using browse-url |
  353. ;;
  354. ;;; Code:
  355. (require 'subr-x)
  356. (require 's)
  357. ;; Action helpers
  358. (defun hyperspace-action->browse-url-pattern (pattern query)
  359. "Browse a URL former from PATTERN and QUERY."
  360. (browse-url (format pattern query)))
  361. (defun hyperspace-action->info (node &optional query)
  362. "Open an Info buffer for NODE.
  363. If QUERY is present, look it up in the index."
  364. (info node)
  365. (when query
  366. (Info-index query)))
  367. ;; Package definitions
  368. (defvar hyperspace-history nil
  369. "History of Hyperspace actions.")
  370. (defgroup hyperspace nil
  371. "Getting there from here"
  372. :prefix "hyperspace-"
  373. :group 'applications)
  374. (defcustom hyperspace-actions
  375. '(("ddg" . "https://duckduckgo.com/?q=%s")
  376. ("dis" . "https://duckduckgo.com/?q=%s&iax=images&ia=images")
  377. ("wp" . "https://en.wikipedia.org/wiki/%s")
  378. ("g" . "https://www.google.com/search?q=%s")
  379. ("gi" . "https://www.google.com/search?tbm=isch&q=%s")
  380. ("gm" . "https://www.google.com/maps/search/%s")
  381. ("yt" . "https://www.youtube.com/results?search_query=%s")
  382. ("clp" . "https://portland.craigslist.org/search/sss?query=%s")
  383. ("eb" . "https://www.ebay.com/sch/i.html?_nkw=%s")
  384. ("nf" . "https://www.netflix.com/search?q=%s")
  385. ("sh" . (lambda (query) (interactive) (shell-command query)))
  386. ("imdb" . "https://www.imdb.com/find?q=peter+jackson&s=all")
  387. ("bb" . bbdb-search-name)
  388. ("el" . (apply-partially #'hyperspace-action->info "(elisp)Top"))
  389. ("av" . apropos-variable)
  390. ("ac" . apropos-command)
  391. ("af" . (lambda (query) (apropos-command query t))))
  392. "Where Hyperspace should send you.
  393. Hyperspace actions are a cons of (KEYWORD . DISPATCHER). When
  394. Hyperspace is invoked, the keyword is extracted from the user
  395. input and looked up in this alist. The remainder of the
  396. string is passed to the dispatcher as its QUERY argument.
  397. DISPATCHER can be a function which performs the action.
  398. DISPATCHER can also be an expression which returns a function
  399. to perform the action.
  400. Finally, DISPATCHER can be a string with a URL pattern containing
  401. '%s'. The '%s' will be replaced with the query, and the URL browsed."
  402. :group 'hyperspace
  403. :type '(alist :key-type (string :tag "Keyword")
  404. :value-type (choice
  405. (function :tag "Function")
  406. (string :tag "URL Pattern")
  407. (sexp :tag "Expression"))))
  408. (defcustom hyperspace-default-action
  409. (caar hyperspace-actions)
  410. "A place to go if you don't specify one."
  411. :group 'hyperspace
  412. :type `(radio
  413. ,@(mapcar (lambda (action) (list 'const (car action))) hyperspace-actions)))
  414. (defcustom hyperspace-max-region-size 256
  415. "Maximum size of a region to consider for a Hyperspace query.
  416. If the region is active when Hyperspace is invoked, it's used
  417. as the default query, unless it's more than this number of
  418. characters."
  419. :group 'hyperspace
  420. :type 'integer)
  421. (defun hyperspace--cleanup (text)
  422. "Clean TEXT so it can be used for a Hyperspace query."
  423. (save-match-data
  424. (string-trim
  425. (replace-regexp-in-string (rx (1+ (or blank "\n"))) " " text))))
  426. (defun hyperspace--initial-text ()
  427. "Return the initial text.
  428. This is whatever's in the active region, but cleaned up."
  429. (when (use-region-p)
  430. (let* ((start (region-beginning))
  431. (end (region-end))
  432. (size (- end start)))
  433. (when (<= size hyperspace-max-region-size)
  434. (hyperspace--cleanup
  435. (buffer-substring-no-properties start end))))))
  436. (defun hyperspace--initial (initial-text)
  437. "Turn INITIAL-TEXT into INITIAL-CONTENTS for reading."
  438. (when initial-text (cons (concat " " initial-text) 1)))
  439. (defun hyperspace--process-input (text)
  440. "Process TEXT into an actionable keyword and query."
  441. (let ((kw-text (s-split-up-to "\\s-+" text 1)))
  442. (if (assoc (car kw-text) hyperspace-actions)
  443. kw-text
  444. (list hyperspace-default-action text))))
  445. (defun hyperspace--query ()
  446. "Ask the user for the Hyperspace action and query.
  447. Returns (KEYWORD . QUERY).
  448. If the region isn't active, the user is prompted for the
  449. action and query.
  450. If the region is active, its text is used as the initial value
  451. for the query, and the user enters the action.
  452. If a prefix argument is specified and the region is active,
  453. `HYPERSPACE-DEFAULT-ACTION' is chosen without prompting."
  454. (let ((initial (hyperspace--initial-text)))
  455. (if (and initial current-prefix-arg)
  456. (list hyperspace-default-action initial)
  457. (hyperspace--process-input
  458. (read-from-minibuffer "HS: " (hyperspace--initial initial) nil nil
  459. 'hyperspace-history)))))
  460. (defun hyperspace--evalable-p (form)
  461. "Can FORM be evaluated?"
  462. (and (listp form)
  463. (or (functionp (car form))
  464. (subrp (car form)))))
  465. (defun hyperspace--dispatch (action &optional query)
  466. "Execute ACTION, with optional QUERY argument."
  467. (pcase action
  468. ((pred functionp) (funcall action query))
  469. ((pred hyperspace--evalable-p) (funcall (eval action) query))
  470. ((pred stringp) (hyperspace-action->browse-url-pattern action query))
  471. (_ (error "Unknown action"))))
  472. ;;;###autoload
  473. (defun hyperspace (keyword &optional query)
  474. "Execute action for keyword KEYWORD, with optional QUERY."
  475. (interactive (hyperspace--query))
  476. (let ((action (cdr (assoc keyword hyperspace-actions))))
  477. (hyperspace--dispatch (or action hyperspace-default-action) query)))
  478. ;;;###autoload
  479. (defun hyperspace-enter (&optional query)
  480. "Enter Hyperspace, sending QUERY to the default action.
  481. If the region is active, use that as the query for
  482. ‘hyperspace-default-action’. Otherwise, prompt the user."
  483. (interactive (list (hyperspace--initial-text)))
  484. (hyperspace
  485. hyperspace-default-action
  486. (or query
  487. (read-from-minibuffer
  488. (format "HS: %s " hyperspace-default-action) nil nil
  489. 'hyperspace-history))))
  490. ;; Minor mode
  491. (defvar hyperspace-minor-mode-map
  492. (let ((kmap (make-sparse-keymap)))
  493. (define-key kmap (kbd "H-SPC") #'hyperspace)
  494. (define-key kmap (kbd "<H-return>") #'hyperspace-enter)
  495. kmap))
  496. ;;;###autoload
  497. (define-minor-mode hyperspace-minor-mode
  498. "Global (universal) minor mode to jump from here to there."
  499. nil nil hyperspace-minor-mode-map
  500. :group 'hyperspace
  501. :global t)
  502. (provide 'hyperspace)
  503. ;;; hyperspace.el ends here
  504. #+END_SRC
  505. ** Tools
  506. *** General
  507. #+BEGIN_SRC emacs-lisp :results silent
  508. (require 'which-key)
  509. (which-key-setup-minibuffer)
  510. (which-key-mode)
  511. (require 'fic-mode)
  512. (add-hook 'js-mode-hook 'fic-mode)
  513. #+END_SRC
  514. *** Company
  515. #+BEGIN_SRC emacs-lisp :results silent
  516. (require 'company)
  517. (add-hook 'after-init-hook 'global-company-mode)
  518. (setq company-dabbrev-downcase nil)
  519. (setq company-idle-delay 0.1)
  520. #+END_SRC
  521. *** Diminish
  522. #+BEGIN_SRC emacs-lisp :results silent
  523. (require 'diminish)
  524. (diminish 'auto-revert-mode)
  525. (eval-after-load "company" '(diminish 'company-mode))
  526. (eval-after-load "counsel" '(diminish 'counsel-mode))
  527. (eval-after-load "elpy" '(diminish 'elpy-mode))
  528. (eval-after-load "go-mode" '(diminish 'go-mode))
  529. (eval-after-load "go-playground" '(diminish 'go-playground-mode))
  530. (eval-after-load "gorepl-mode" '(diminish 'gorepl-mode))
  531. (eval-after-load "flycheck" '(diminish 'flycheck-mode))
  532. (eval-after-load "ivy" '(diminish 'ivy-mode))
  533. (eval-after-load "projectile" '(diminish 'projectile-mode))
  534. (eval-after-load "which-key" '(diminish 'which-key-mode))
  535. #+END_SRC
  536. *** Dired
  537. #+BEGIN_SRC emacs-lisp :results silent
  538. (defun dired-mode-setup ()
  539. "Will run as hook for `dired-mode'."
  540. (dired-hide-details-mode nil))
  541. (add-hook 'dired-mode-hook 'dired-mode-setup)
  542. #+END_SRC
  543. *** Drawing (uml)
  544. #+BEGIN_SRC emacs-lisp :results silent
  545. (add-hook 'artist-mode-hook
  546. (lambda ()
  547. (setq compilation-read-command nil)
  548. (set
  549. (make-local-variable 'compile-command)
  550. (format "java -jar /home/locust/scripts/java/ditaa0_9.jar -E %s | awk -F': ' '{print $2}' | awk NF | tail -n1 | xargs -I{} feh {}"
  551. (buffer-file-name)))))
  552. (add-to-list 'auto-mode-alist '("\\.uml\\'" . artist-mode))
  553. #+END_SRC
  554. *** Excorporate
  555. #+BEGIN_SRC emacs-lisp :results silent :tangle no
  556. ;;;
  557. ;;; Configuration for our Exchange server
  558. ;;;
  559. (setq-default
  560. excorporate-configuration
  561. '("lolson@eaglecrk.com" . "https://outlook.office365.com/EWS/Exchange.asmx")
  562. org-agenda-include-diary t)
  563. ;;;
  564. ;;; Make sure that Emacs diary knows how to follow `#include "..."'
  565. ;;; directives (needed by excorporate)
  566. ;;;
  567. (add-hook 'diary-mark-entries-hook 'diary-mark-included-diary-files)
  568. ;;;
  569. ;;; Create a hook function to pull down Exchange meetings and
  570. ;;; update my Emacs diary whenever org-agenda merges diary into
  571. ;;; agenda.
  572. ;;;
  573. (defun my/agenda-update-diary ()
  574. "Update exchange diary."
  575. (interactive)
  576. (exco-diary-diary-advice
  577. (calendar-current-date)
  578. (calendar-current-date)
  579. #'message "Diary updated"))
  580. (add-hook 'org-agenda-cleanup-fancy-diary-hook 'my/agenda-update-diary)
  581. ;;;
  582. ;;; Finally, turn on excorporate and enable excorporate-diary
  583. ;;;
  584. (excorporate)
  585. (excorporate-diary-enable)
  586. #+END_SRC
  587. *** Ivy and Amx
  588. #+BEGIN_SRC emacs-lisp :results silent
  589. (require 'ivy-hydra)
  590. (require 'ivy)
  591. (require 'swiper)
  592. (ivy-mode 1)
  593. (counsel-mode)
  594. (setq ivy-use-virtual-buffers t
  595. enable-recursive-minibuffers t
  596. ivy-height 25
  597. ivy-initial-inputs-alist nil
  598. ivy-extra-directories nil)
  599. (global-set-key (kbd "C-s") 'swiper)
  600. (global-set-key (kbd "C-c C-r") 'ivy-resume)
  601. (global-set-key (kbd "M-x") 'counsel-M-x)
  602. (global-set-key (kbd "C-x C-f") 'counsel-find-file)
  603. (global-set-key (kbd "C-c g") 'counsel-git)
  604. (global-set-key (kbd "C-c j") 'counsel-git-grep)
  605. (global-set-key (kbd "C-c k") 'counsel-ag)
  606. (define-key minibuffer-local-map (kbd "C-r") 'counsel-minibuffer-history)
  607. (defun ivy-open-current-typed-path ()
  608. (interactive)
  609. (when ivy--directory
  610. (let* ((dir ivy--directory)
  611. (text-typed ivy-text)
  612. (path (concat dir text-typed)))
  613. (delete-minibuffer-contents)
  614. (ivy--done path))))
  615. (define-key ivy-minibuffer-map (kbd "<return>") 'ivy-alt-done)
  616. (define-key ivy-minibuffer-map (kbd "C-f") 'ivy-open-current-typed-path)
  617. #+END_SRC
  618. *** Ledger
  619. #+BEGIN_SRC emacs-lisp :results silent
  620. (autoload 'ledger-mode "ledger-mode" "A major mode for Ledger" t)
  621. (add-to-list 'load-path
  622. (expand-file-name "/path/to/ledger/source/lisp/"))
  623. (add-to-list 'auto-mode-alist '("\\.ledger$" . ledger-mode))
  624. #+END_SRC
  625. *** Magit
  626. #+BEGIN_SRC emacs-lisp :results silent
  627. (require 'magit)
  628. (global-set-key (kbd "C-x g") 'magit-status)
  629. (global-set-key (kbd "C-c g") 'magit-status)
  630. (setq magit-completing-read-function 'ivy-completing-read)
  631. #+END_SRC
  632. *** Markdown
  633. #+BEGIN_SRC emacs-lisp :results silent
  634. (add-to-list 'exec-path "/home/locust/.local/bin")
  635. #+END_SRC
  636. *** Mu4e
  637. #+BEGIN_SRC emacs-lisp :results silent
  638. ;; (add-to-list 'load-path "/usr/local/share/emacs/site-lisp/mu/mu4e")
  639. (add-to-list 'load-path "/usr/share/emacs/site-lisp/mu4e")
  640. (require 'mu4e)
  641. (setq mu4e-maildir "/home/locust/Mail"
  642. mu4e-mu-binary "/usr/bin/mu"
  643. mu4e-change-filenames-when-moving t ;; Rename files when moving (required by mbsync)
  644. mu4e-compose-in-new-frame t ;; New compose gets new frame
  645. mu4e-context-policy 'pick-first
  646. mu4e-get-mail-command "mbsync -a" ;; MBSYNC is the mail cmd
  647. mu4e-html2text-command "/usr/bin/w3m -T text/html" ;; HTML to text command
  648. mu4e-headers-include-related nil ;; Stop threading in INBOX
  649. mu4e-sent-messages-behavior 'delete ;; Delete sent messages
  650. mu4e-update-interval 300 ;; 5 mins
  651. mu4e-use-fancy-chars t ;; use 'fancy' chars
  652. mu4e-user-mail-address-list '("lolson@eaglecrk.com"
  653. "olson.levi@gmail.com")
  654. mu4e-view-show-images t ;; attempt to show images
  655. mu4e-view-image-max-width 400 ;; max image size
  656. message-citation-line-format "On %a %d %b %Y at %R, %f wrote:\n" ;; customize the reply-quote-string
  657. message-citation-line-function 'message-insert-formatted-citation-line ;; choose to use the formatted string
  658. message-kill-buffer-on-exit t ;; don't keep messages around
  659. send-mail-function 'smtpmail-send-it ;; Default email send function
  660. smtpmail-default-smtp-server "smtp.gmail.com"
  661. smtpmail-smtp-service 587
  662. )
  663. ;; (defun leo/convert-message-set-point ()
  664. ;; "Set the point to the start of the message body."
  665. ;; (interactive)
  666. ;; (beginning-of-buffer)
  667. ;; (search-forward "--text follows this line--")
  668. ;; (forward-char)
  669. ;; )
  670. ;; (defun leo/convert-message-from-markdown ()
  671. ;; "Convert a markdown flavored mail buffer to html w/mime support."
  672. ;; (interactive)
  673. ;; (if (y-or-n-p "Convert to HTML? ")
  674. ;; ((leo/convert-message-set-point)
  675. ;; (save-excursion
  676. ;; (message-goto-body)
  677. ;; (shell-command-on-region (point) (point-max) "~/.emacs.d/scripts/expand-mime.sh" nil t)))
  678. ;; (message "Aborting."))
  679. ;; )
  680. (setq mu4e-contexts
  681. `(
  682. ;; ,(make-mu4e-context
  683. ;; :name "Vlocity"
  684. ;; :enter-func (lambda () (mu4e-message "Entering Vlocity"))
  685. ;; :leave-func (lambda () (mu4e-message "Leaving Vlocity"))
  686. ;; ;; we match based on the contact-fields of the message
  687. ;; :match-func (lambda (msg)
  688. ;; (when msg
  689. ;; (string= (mu4e-message-field msg :maildir) "/Vlocity")))
  690. ;; :vars '( ( user-mail-address . "lolson@vlocity.com" )
  691. ;; ( smtpmail-mail-address . "lolson@vlocity.com" )
  692. ;; ( smtpmail-smtp-user . "lolson@vlocity.com" )
  693. ;; ( smtpmail-smtp-server . "smtp.gmail.com" )
  694. ;; ( user-full-name . "Levi Olson" )
  695. ;; ( mu4e-compose-signature .
  696. ;; (concat
  697. ;; "Levi Olson\n"
  698. ;; "Senior UI Developer"))
  699. ;; ( mu4e-sent-folder . "/Vlocity/[Gmail].Sent Mail" )
  700. ;; ( mu4e-drafts-folder . "/Vlocity/[Gmail].Drafts" )
  701. ;; ( mu4e-trash-folder . "/Vlocity/[Gmail].Trash" )
  702. ;; ( mu4e-maildir-shortcuts . (("/Vlocity/INBOX" . ?i)
  703. ;; ("/Vlocity/[Gmail].Sent Mail" . ?s)
  704. ;; ("/Vlocity/[Gmail].Trash" . ?t)
  705. ;; ("/Vlocity/[Gmail].All Mail" . ?a)))))
  706. ,(make-mu4e-context
  707. :name "EagleCreek"
  708. :enter-func (lambda () (mu4e-message "Entering EagleCreek"))
  709. :leave-func (lambda () (mu4e-message "Leaving EagleCreek"))
  710. ;; we match based on the contact-fields of the message
  711. :match-func (lambda (msg)
  712. (when msg
  713. (string= (mu4e-message-field msg :maildir) "/eaglecrk")))
  714. :vars '( ( user-mail-address . "lolson@eaglecrk.com" )
  715. ( smtpmail-mail-address . "lolson@eaglecrk.com" )
  716. ( smtpmail-smtp-user . "lolson@eaglecrk.com" )
  717. ( smtpmail-smtp-server . "smtp.office365.com" )
  718. ( user-full-name . "Levi Olson" )
  719. ;; ( mu4e-compose-signature .
  720. ;; (concat
  721. ;; "Levi Olson\n"
  722. ;; "Eagle Creek Software Services\n"
  723. ;; "Senior Application Developer Consultant\n"))
  724. ( mu4e-sent-folder . "/eaglecrk/Sent Items" )
  725. ( mu4e-refile-folder . "/eaglecrk/Archive" )
  726. ( mu4e-drafts-folder . "/eaglecrk/Drafts" )
  727. ( mu4e-trash-folder . "/eaglecrk/Deleted Items" )
  728. ( mu4e-maildir-shortcuts . (("/eaglecrk/Inbox" . ?i)
  729. ("/eaglecrk/Sent Items" . ?s)
  730. ("/eaglecrk/Deleted Items" . ?t)
  731. ("/eaglecrk/Archive" . ?a)
  732. ))))
  733. ,(make-mu4e-context
  734. :name "Gmail"
  735. :enter-func (lambda () (mu4e-message "Entering Gmail"))
  736. :leave-func (lambda () (mu4e-message "Leaving Gmail"))
  737. ;; this matches maildir /Arkham and its sub-directories
  738. :match-func (lambda (msg)
  739. (when msg
  740. (string= (mu4e-message-field msg :maildir) "/gmail")))
  741. :vars '( ( user-mail-address . "olson.levi@gmail.com" )
  742. ( smtpmail-mail-address . "olson.levi@gmail.com" )
  743. ( smtpmail-smtp-user . "olson.levi@gmail.com" )
  744. ( smtpmail-smtp-server . "smtp.gmail.com" )
  745. ( user-full-name . "Levi Olson" )
  746. ( mu4e-compose-signature .
  747. (concat
  748. "Levi\n"))
  749. ( mu4e-sent-folder . "/gmail/[Gmail]/Sent Mail" )
  750. ( mu4e-refile-folder . "/gmail/[Gmail]/All Mail" )
  751. ( mu4e-drafts-folder . "/gmail/[Gmail]/Drafts" )
  752. ( mu4e-trash-folder . "/gmail/[Gmail]/Trash" )
  753. ( mu4e-maildir-shortcuts . (("/gmail/Inbox" . ?i)
  754. ("/gmail/[Gmail]/Sent Mail" . ?s)
  755. ("/gmail/[Gmail]/Trash" . ?t)
  756. ("/gmail/[Gmail]/All Mail" . ?a)
  757. ))))
  758. ))
  759. ;; Add option to view HTML in browser
  760. (add-to-list 'mu4e-headers-actions
  761. '("in browser" . mu4e-action-view-in-browser) t)
  762. (add-to-list 'mu4e-view-actions
  763. '("in browser" . mu4e-action-view-in-browser) t)
  764. (defun my-message-current-line-cited-p ()
  765. "Indicate whether the line at point is a cited line."
  766. (save-match-data
  767. (string-match (concat "^" message-cite-prefix-regexp)
  768. (buffer-substring (line-beginning-position) (line-end-position)))))
  769. (defun my-message-says-attachment-p ()
  770. "Return t if the message suggests there can be an attachment."
  771. (save-excursion
  772. (goto-char (point-min))
  773. (save-match-data
  774. (let (search-result)
  775. (while
  776. (and (setq search-result (re-search-forward "\\(attach\\|pdf\\|file\\)" nil t))
  777. (my-message-current-line-cited-p)))
  778. search-result))))
  779. (defun my-message-has-attachment-p ()
  780. "Return t if the message has an attachment."
  781. (save-excursion
  782. (goto-char (point-min))
  783. (save-match-data
  784. (re-search-forward "<#part" nil t))))
  785. (defun my-message-pre-send-check-attachment ()
  786. (when (and (my-message-says-attachment-p)
  787. (not (my-message-has-attachment-p)))
  788. (unless
  789. (y-or-n-p "No attachment. Send anyway?")
  790. (error "It seems that an attachment is needed, but none was found. Aborting sending."))))
  791. (add-hook 'message-send-hook 'my-message-pre-send-check-attachment)
  792. #+END_SRC
  793. *** Projectile
  794. #+BEGIN_SRC emacs-lisp :results silent
  795. (require 'projectile)
  796. (require 'counsel-projectile)
  797. (projectile-mode)
  798. (setq projectile-mode-line '(:eval (format " %s" (projectile-project-name)))
  799. projectile-remember-window-configs t
  800. projectile-completion-system 'ivy)
  801. (counsel-projectile-mode)
  802. #+END_SRC
  803. *** Poporg
  804. Edit comments in a separate window
  805. #+BEGIN_SRC emacs-lisp :results silent
  806. (autoload 'poporg-dwim "poporg" nil t)
  807. (global-set-key (kbd "C-c \"") 'poporg-dwim)
  808. #+END_SRC
  809. *** Notify
  810. #+BEGIN_SRC emacs-lisp :results silent
  811. ;;; notify.el --- notification front-end
  812. ;; Copyright (C) 2008 Mark A. Hershberger
  813. ;; Original Author: Mark A. Hershberger <mhersberger@intrahealth.org>
  814. ;; Modified by Andrey Kotlarski <m00naticus@gmail.com>
  815. ;; Modified by Andrew Gwozdziewycz <git@apgwoz.com>
  816. ;; Modified by Aidan Gauland <aidalgol@no8wireless.co.nz> October 2011
  817. ;; Modified by Olivier Sirven <the.slaa@gmail.com> November 2013
  818. ;; Keywords: extensions, convenience, lisp
  819. ;; This file is free software; you can redistribute it and/or modify
  820. ;; it under the terms of the GNU General Public License as published by
  821. ;; the Free Software Foundation; either version 2, or (at your option)
  822. ;; any later version.
  823. ;; This file is distributed in the hope that it will be useful,
  824. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  825. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  826. ;; GNU General Public License for more details.
  827. ;; You should have received a copy of the GNU General Public License
  828. ;; along with GNU Emacs; see the file COPYING. If not, write to
  829. ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  830. ;; Boston, MA 02111-1307, USA.
  831. ;;; Commentary:
  832. ;; This provides a single function, `notify', that will produce a notify
  833. ;; pop-up via D-Bus, libnotify, simple message or growl.
  834. ;; To use, just put (autoload 'notify "notify" "Notify TITLE, BODY.")
  835. ;; in your init file. You may override default chosen notification
  836. ;; method by assigning `notify-method' to one of 'notify-via-dbus
  837. ;; 'notify-via-libnotify or 'notify-via-message
  838. ;;; Code:
  839. (defvar notify-defaults (list :app "Emacs" :icon "emacs" :timeout 5000
  840. :urgency "low"
  841. :category "emacs.message")
  842. "Notification settings' defaults.
  843. May be overridden with key-value additional arguments to `notify'.")
  844. (defvar notify-delay '(0 5 0)
  845. "Minimum time allowed between notifications in time format.")
  846. (defvar notify-last-notification '(0 0 0) "Time of last notification.")
  847. (defvar notify-method 'notify-via-growl "Notification method among
  848. 'notify-via-dbus, 'notify-via-libnotify, 'notify-via-message or
  849. 'notify-via-growl")
  850. ;; determine notification method unless already set
  851. ;; prefer growl > D-Bus > libnotify > message
  852. (cond
  853. ((null notify-method)
  854. (setq notify-method
  855. (cond
  856. ((executable-find "growlnotify") 'notify-via-growl)
  857. ((and (require 'dbus nil t)
  858. (dbus-ping :session "org.freedesktop.Notifications"))
  859. (defvar notify-id 0 "Current D-Bus notification id.")
  860. 'notify-via-dbus)
  861. ((executable-find "notify-send") 'notify-via-libnotify)
  862. (t 'notify-via-message))))
  863. ((eq notify-method 'notify-via-dbus) ;housekeeping for pre-chosen DBus
  864. (if (and (require 'dbus nil t)
  865. (dbus-ping :session "org.freedesktop.Notifications"))
  866. (defvar notify-id 0 "Current D-Bus notification id.")
  867. (setq notify-method (if (executable-find "notify-send")
  868. 'notify-via-libnotify
  869. 'notify-via-message))))
  870. ((and (eq notify-method 'notify-via-libnotify)
  871. (not (executable-find "notify-send"))) ;housekeeping for pre-chosen libnotify
  872. (setq notify-method
  873. (if (and (require 'dbus nil t)
  874. (dbus-ping :session "org.freedesktop.Notifications"))
  875. (progn
  876. (defvar notify-id 0 "Current D-Bus notification id.")
  877. 'notify-via-dbus)
  878. 'notify-via-message)))
  879. ((and (eq notify-method 'notify-via-growl)
  880. (not (executable-find "growlnotify")))
  881. (setq notify-method 'notify-via-message)))
  882. (defun notify-via-dbus (title body)
  883. "Send notification with TITLE, BODY `D-Bus'."
  884. (dbus-call-method :session "org.freedesktop.Notifications"
  885. "/org/freedesktop/Notifications"
  886. "org.freedesktop.Notifications" "Notify"
  887. (get 'notify-defaults :app)
  888. (setq notify-id (+ notify-id 1))
  889. (get 'notify-defaults :icon) title body '(:array)
  890. '(:array :signature "{sv}") ':int32
  891. (get 'notify-defaults :timeout)))
  892. (defun notify-via-libnotify (title body)
  893. "Notify with TITLE, BODY via `libnotify'."
  894. (call-process "notify-send" nil 0 nil
  895. title body "-t"
  896. (number-to-string (get 'notify-defaults :timeout))
  897. "-i" (get 'notify-defaults :icon)
  898. "-u" (get 'notify-defaults :urgency)
  899. "-c" (get 'notify-defaults :category)))
  900. (defun notify-via-message (title body)
  901. "Notify TITLE, BODY with a simple message."
  902. (message "%s: %s" title body))
  903. (defun notify-via-growl (title body)
  904. "Notify TITLE, BODY with a growl"
  905. (call-process "growlnotify" nil 0 nil
  906. "-a" (get 'notify-defaults :app)
  907. "-n" (get 'notify-defaults :category)
  908. "-t" (notify-via-growl-stringify title)
  909. "-m" (notify-via-growl-stringify body)))
  910. (defun notify-via-growl-stringify (thing)
  911. (cond ((null thing) "")
  912. ((stringp thing) thing)
  913. (t (format "%s" thing))))
  914. (defun keywords-to-properties (symbol args &optional defaults)
  915. "Add to SYMBOL's property list key-values from ARGS and DEFAULTS."
  916. (when (consp defaults)
  917. (keywords-to-properties symbol defaults))
  918. (while args
  919. (put symbol (car args) (cadr args))
  920. (setq args (cddr args))))
  921. ;;;###autoload
  922. (defun notify (title body &rest args)
  923. "Notify TITLE, BODY via `notify-method'.
  924. ARGS may be amongst :timeout, :icon, :urgency, :app and :category."
  925. (when (time-less-p notify-delay
  926. (time-since notify-last-notification))
  927. (or (eq notify-method 'notify-via-message)
  928. (keywords-to-properties 'notify-defaults args
  929. notify-defaults))
  930. (setq notify-last-notification (current-time))
  931. (funcall notify-method title body)))
  932. (provide 'notify)
  933. ;;; notify.el ends here
  934. #+END_SRC
  935. *** Jabber
  936. #+BEGIN_SRC emacs-lisp :results silent
  937. (require 'jabber)
  938. (setq jabber-history-enabled t
  939. jabber-use-global-history nil
  940. jabber-backlog-number 40
  941. jabber-backlog-days 30
  942. jabber-alert-presence-message-function (lambda (_who _oldstatus _newstatus _statustext) nil)
  943. )
  944. (setq jabber-account-list '(
  945. ("olson.levi@gmail.com"
  946. (:network-server . "talk.google.com")
  947. (:connection-type . ssl))
  948. ;; ("lolson@vlocity.com"
  949. ;; (:network-server . "talk.google.com")
  950. ;; (:connection-type . ssl))
  951. ))
  952. (defvar my-chat-prompt "[%t] %n>\n" "Customized chat prompt")
  953. (when (featurep 'jabber)
  954. (setq
  955. jabber-chat-foreign-prompt-format my-chat-prompt
  956. jabber-chat-local-prompt-format my-chat-prompt
  957. jabber-groupchat-prompt-format my-chat-prompt
  958. jabber-muc-private-foreign-prompt-format "[%t] %g/%n>\n"
  959. )
  960. )
  961. (defun notify-jabber-notify (from buf text _proposed-alert)
  962. "(jabber.el hook) Notify of new Jabber chat messages via notify.el"
  963. (when (or jabber-message-alert-same-buffer
  964. (not (memq (selected-window) (get-buffer-window-list buf))))
  965. (if (jabber-muc-sender-p from)
  966. (notify (format "(PM) %s"
  967. (jabber-jid-displayname (jabber-jid-user from)))
  968. (format "%s: %s" (jabber-jid-resource from) text)))
  969. (notify (format "%s" (jabber-jid-displayname from))
  970. text)))
  971. ;; (add-hook 'jabber-alert-message-hooks 'notify-jabber-notify)
  972. ;; (require 'autosmiley)
  973. ;; (add-hook 'jabber-chat-mode-hook 'autosmiley-mode)
  974. (defun jabber ()
  975. (interactive)
  976. (jabber-connect-all)
  977. (switch-to-buffer "*-jabber-roster-*"))
  978. #+END_SRC
  979. *** Terminal-Notifier
  980. #+BEGIN_SRC emacs-lisp :results silent :tangle no
  981. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  982. ;; Terminal notifier
  983. ;; requires 'brew install terminal-notifier'
  984. ;; stolen from erc-notifier
  985. (defvar terminal-notifier-command (executable-find "terminal-notifier") "The path to terminal-notifier.")
  986. ; (terminal-notifier-notify "Emacs notification" "Something amusing happened")
  987. (defun terminal-notifier-notify (title message)
  988. "Show a message with
  989. terminal-notifier-command
  990. ."
  991. (start-process "terminal-notifier"
  992. "terminal-notifier"
  993. terminal-notifier-command
  994. "-title" title
  995. "-message" message
  996. "-activate" "org.gnu.Emacs"))
  997. (defun timed-notification (time msg)
  998. (interactive "sNotification when (e.g: 2 minutes, 60 seconds, 3 days): \nsMessage: ")
  999. (run-at-time time nil (lambda (msg) (terminal-notifier-notify "Emacs" msg)) msg))
  1000. #+END_SRC
  1001. *** Hyperspace
  1002. #+BEGIN_SRC emacs-lisp :results silent
  1003. (defun hyperspace-action->mu4e (&optional query)
  1004. "Search mu4e with QUERY.
  1005. If QUERY is unspecified, use the first bookmark in variable
  1006. ‘mu4e-bookmarks’ and update mail and index."
  1007. (mu4e-headers-search (or query (caar mu4e-bookmarks)))
  1008. (unless query
  1009. (mu4e-update-mail-and-index nil)))
  1010. (add-to-list 'hyperspace-actions '("m4" . hyperspace-action->mu4e))
  1011. (defun hyperspace-action->elfeed (&optional query)
  1012. "Load elfeed, optionally searching for QUERY."
  1013. (elfeed)
  1014. (if query
  1015. (elfeed-search-set-filter query)
  1016. (elfeed-search-fetch nil)))
  1017. (add-to-list 'hyperspace-actions '("lf" . hyperspace-action->elfeed))
  1018. #+END_SRC
  1019. ** Functions
  1020. #+BEGIN_SRC emacs-lisp :results silent
  1021. (defun find-user-init-file ()
  1022. "Edit the `~/.emacs.d/init.org' file."
  1023. (interactive)
  1024. (find-file "~/.emacs.d/init.org"))
  1025. (defun find-todo-file ()
  1026. "Edit the `~/todo.org' file."
  1027. (interactive)
  1028. (find-file "~/Dropbox/Org/todo.org"))
  1029. (defun load-user-init-file ()
  1030. "LO: Reload the `~/.emacs.d/init.elc' file."
  1031. (interactive)
  1032. (load-file "~/.emacs.d/init.elc"))
  1033. (defun leo-swiper ()
  1034. "LO: Custom swiper."
  1035. (interactive)
  1036. (let ((word (thing-at-point 'symbol)))
  1037. (if word (swiper (format "%s" word)))
  1038. (unless word (swiper (format ""))))
  1039. )
  1040. (defun jump-to-symbol-internal (&optional backwardp)
  1041. "Jumps to the next symbol near the point if such a symbol exists. If BACKWARDP is non-nil it jumps backward."
  1042. (let* ((point (point))
  1043. (bounds (find-tag-default-bounds))
  1044. (beg (car bounds)) (end (cdr bounds))
  1045. (str (isearch-symbol-regexp (find-tag-default)))
  1046. (search (if backwardp 'search-backward-regexp
  1047. 'search-forward-regexp)))
  1048. (goto-char (if backwardp beg end))
  1049. (funcall search str nil t)
  1050. (cond ((<= beg (point) end) (goto-char point))
  1051. (backwardp (forward-char (- point beg)))
  1052. (t (backward-char (- end point))))))
  1053. (defun jump-to-previous-like-this ()
  1054. "Jumps to the previous occurrence of the symbol at point."
  1055. (interactive)
  1056. (jump-to-symbol-internal t))
  1057. (defun jump-to-next-like-this ()
  1058. "Jumps to the next occurrence of the symbol at point."
  1059. (interactive)
  1060. (jump-to-symbol-internal))
  1061. (defun match-paren (arg)
  1062. "Go to the matching paren if on a paren; otherwise insert ARG (a literal % sign)."
  1063. (interactive "p")
  1064. (cond ((looking-at "\\s(") (forward-list 1))
  1065. ((looking-back "\\s(" 2) (backward-char 1) (forward-list 1))
  1066. ((looking-at "\\s)") (forward-char 1) (backward-list 1))
  1067. ((looking-back "\\s)" 2) (backward-list 1))
  1068. (t (self-insert-command (or arg 1)))))
  1069. (defun kill-this-buffer-unless-scratch ()
  1070. "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."
  1071. (interactive)
  1072. (if (not (string= (buffer-name) "*scratch*"))
  1073. (kill-this-buffer)
  1074. (delete-region (point-min) (point-max))
  1075. (switch-to-buffer (other-buffer))
  1076. (bury-buffer "*scratch*")))
  1077. (defun delete-backward-sentence ()
  1078. "LO: Delete to the beginning of the sentence/line."
  1079. (interactive)
  1080. (delete-region (point) (progn (backward-sentence) (point))))
  1081. (defun delete-backward-to-boundary (arg)
  1082. "LO: Delete backward to the previous word boundary. With ARG, do this many times."
  1083. (interactive "p")
  1084. (let ((a (point))
  1085. (b (progn
  1086. (backward-word arg)
  1087. (forward-word)
  1088. (point))))
  1089. (if (< a b)
  1090. (delete-region a (progn (backward-word arg) (point)))
  1091. (if (= a b)
  1092. (delete-region a (progn (backward-word arg) (point)))
  1093. (delete-region a b)))))
  1094. (defun comment-or-uncomment-region-or-line ()
  1095. "Comments or uncomments the region or the current line if there's no active region."
  1096. (interactive)
  1097. (let (beg end)
  1098. (if (region-active-p)
  1099. (setq beg (region-beginning) end (region-end))
  1100. (setq beg (line-beginning-position) end (line-end-position)))
  1101. (comment-or-uncomment-region beg end)))
  1102. (defun fold-toggle (column)
  1103. "Code folding by COLUMN."
  1104. (interactive "P")
  1105. (set-selective-display
  1106. (or column
  1107. (unless selective-display
  1108. (1+ (current-column))))))
  1109. (defun new-line-below ()
  1110. "LO: Create a new line below current line."
  1111. (interactive)
  1112. (move-end-of-line 1)
  1113. (newline-and-indent))
  1114. (defun new-line-above ()
  1115. "LO: Create a new line above current line."
  1116. (interactive)
  1117. (move-beginning-of-line 1)
  1118. (newline)
  1119. (forward-line -1))
  1120. (defun duplicate-thing (comment)
  1121. "LO: Duplicates the current line, or the region if active. If an argument (COMMENT) is given, the duplicated region will be commented out."
  1122. (interactive "P")
  1123. (save-excursion
  1124. (let ((start (if (region-active-p) (region-beginning) (point-at-bol)))
  1125. (end (if (region-active-p) (region-end) (point-at-eol))))
  1126. (goto-char end)
  1127. (unless (region-active-p)
  1128. (newline))
  1129. (insert (buffer-substring start end))
  1130. (when comment (comment-region start end)))))
  1131. (defun tidy ()
  1132. "LO: Ident, untabify and unwhitespacify current buffer, or region if active."
  1133. (interactive)
  1134. (let ((beg (if (region-active-p) (region-beginning) (point-min)))
  1135. (end (if (region-active-p) (region-end) (point-max))))
  1136. (let ((inhibit-message t))
  1137. (indent-region beg end))
  1138. (whitespace-cleanup)
  1139. (untabify beg (if (< end (point-max)) end (point-max)))
  1140. (if (region-active-p) (message "Indenting Region...Done") (message "Indenting File...Done"))))
  1141. (defun phil-columns ()
  1142. "LO: Good 'ol Phil-Columns."
  1143. (interactive)
  1144. (message "Good 'ol fill-columns")
  1145. (with-output-to-temp-buffer "*PHIL-COLUMN*"
  1146. (shell-command "mpv --no-video 'https://www.youtube.com/watch?v=YkADj0TPrJA&t=3m16s' > /dev/null 2>&1 & sleep 8; pkill mpv"))
  1147. (other-window 1)
  1148. (delete-window))
  1149. (declare-function first "Goto FIRST shell.")
  1150. (declare-function goto-non-shell-buffer "Goto something other than a shell buffer.")
  1151. (declare-function switch-shell "Switch shell.")
  1152. (let ((last-shell ""))
  1153. (defun toggle-shell ()
  1154. (interactive)
  1155. (cond ((string-match-p "^\\*shell<[1-9][0-9]*>\\*$" (buffer-name))
  1156. (goto-non-shell-buffer))
  1157. ((get-buffer last-shell) (switch-to-buffer last-shell))
  1158. (t (shell (setq last-shell "*shell<1>*")))))
  1159. (defun switch-shell (n)
  1160. (let ((buffer-name (format "*shell<%d>*" n)))
  1161. (setq last-shell buffer-name)
  1162. (cond ((get-buffer buffer-name)
  1163. (switch-to-buffer buffer-name))
  1164. (t (shell buffer-name)
  1165. (rename-buffer buffer-name)))))
  1166. (defun goto-non-shell-buffer ()
  1167. (let* ((r "^\\*shell<[1-9][0-9]*>\\*$")
  1168. (shell-buffer-p (lambda (b) (string-match-p r (buffer-name b))))
  1169. (non-shells (cl-remove-if shell-buffer-p (buffer-list))))
  1170. (when non-shells
  1171. (switch-to-buffer (first non-shells))))))
  1172. (defadvice shell (after kill-with-no-query nil activate)
  1173. "."
  1174. (set-process-query-on-exit-flag (get-buffer-process ad-return-value) nil))
  1175. (declare-function comint-truncate-buffer ".")
  1176. (defun clear-comint ()
  1177. "Run `comint-truncate-buffer' with the `comint-buffer-maximum-size' set to zero."
  1178. (interactive)
  1179. (let ((comint-buffer-maximum-size 0))
  1180. (comint-truncate-buffer)))
  1181. (defun c-setup ()
  1182. "Compile."
  1183. (local-set-key (kbd "C-c C-c") 'compile))
  1184. #+END_SRC
  1185. ** Bindings
  1186. #+begin_src emacs-lisp :results silent
  1187. (require 'company)
  1188. (add-hook 'comint-mode-hook (lambda () (local-set-key (kbd "c-l") 'clear-comint)))
  1189. (add-hook 'emacs-lisp-mode-hook 'turn-on-eldoc-mode)
  1190. (add-hook 'lisp-interaction-mode-hook 'turn-on-eldoc-mode)
  1191. (add-hook 'c-mode-common-hook 'c-setup)
  1192. (add-to-list 'auto-mode-alist '("\\.md\\'" . markdown-mode))
  1193. (defvar company-active-map (make-keymap)
  1194. "company mode keymap.")
  1195. (defvar artist-mode-map (make-keymap)
  1196. "artist mode keymap.")
  1197. (defvar custom-bindings (make-keymap)
  1198. "a keymap of custom bindings.")
  1199. (define-key custom-bindings (kbd "M-p") 'jump-to-previous-like-this)
  1200. (define-key custom-bindings (kbd "M-r") 'fill-paragraph)
  1201. (define-key custom-bindings (kbd "M-n") 'jump-to-next-like-this)
  1202. (define-key custom-bindings (kbd "M-<tab>") 'switch-to-next-buffer)
  1203. (define-key custom-bindings (kbd "M-<backspace>")'delete-backward-to-boundary)
  1204. (define-key custom-bindings (kbd "C-<backspace>")'delete-backward-to-boundary)
  1205. (define-key custom-bindings (kbd "C-}") 'mc/mark-next-like-this)
  1206. (define-key custom-bindings (kbd "C-)") 'mc/unmark-next-like-this)
  1207. (define-key custom-bindings (kbd "C-{") 'mc/mark-previous-like-this)
  1208. (define-key custom-bindings (kbd "C-(") 'mc/unmark-previous-like-this)
  1209. (define-key custom-bindings (kbd "C-'") 'mc-hide-unmatched-lines-mode)
  1210. (define-key custom-bindings (kbd "C-c 1") 'mc/insert-numbers)
  1211. (define-key custom-bindings (kbd "C-c s") 'mc/sort-regions)
  1212. (define-key custom-bindings "%" 'match-paren)
  1213. (define-key custom-bindings (kbd "C-x .") 'dash-at-point)
  1214. (define-key custom-bindings (kbd "C-x ,") 'dash-at-point-with-docset)
  1215. (define-key custom-bindings (kbd "C-s") 'leo-swiper)
  1216. (define-key custom-bindings (kbd "C-x C-l m") 'mu4e)
  1217. (define-key custom-bindings (kbd "C-x C-o t") 'find-todo-file)
  1218. (define-key custom-bindings (kbd "C-x C-l j") 'jabber)
  1219. (define-key custom-bindings (kbd "C-x C-l f") 'elfeed)
  1220. (define-key custom-bindings (kbd "C-x C-l a") 'org-agenda)
  1221. (define-key custom-bindings (kbd "C-,") 'org-cycle-agenda-files)
  1222. (define-key custom-bindings (kbd "C-x C-l c") 'calendar)
  1223. (define-key custom-bindings (kbd "M-SPC") #'hyperspace)
  1224. ;; (dolist (n (number-sequence 1 9))
  1225. ;; (global-set-key (kbd (concat "M-" (int-to-string n)))
  1226. ;; (lambda () (interactive) (switch-shell n))))
  1227. (define-key company-active-map (kbd "C-d") 'company-show-doc-buffer)
  1228. (define-key company-active-map (kbd "C-n") 'company-select-next)
  1229. (define-key company-active-map (kbd "C-p") 'company-select-previous)
  1230. (define-key company-active-map (kbd "<tab>") 'company-complete)
  1231. (define-key custom-bindings (kbd "C-c p") 'counsel-projectile-switch-project)
  1232. (define-key custom-bindings (kbd "C-c f") 'counsel-projectile-find-file)
  1233. (define-key custom-bindings (kbd "C-c c") 'ivy-resume)
  1234. (define-key custom-bindings (kbd "C-c m") 'magit-status)
  1235. (define-key custom-bindings (kbd "C-c D") 'define-word-at-point)
  1236. (define-key custom-bindings (kbd "C-@") 'er/expand-region)
  1237. (define-key custom-bindings (kbd "C-#") 'er/contract-region)
  1238. (define-key custom-bindings (kbd "C-S-c C-S-c") 'mc/edit-lines)
  1239. (define-key custom-bindings (kbd "C-c b") 'ivy-switch-buffer)
  1240. (define-key custom-bindings (kbd "C-c l") 'org-store-link)
  1241. (define-key custom-bindings (kbd "C-c t") 'org-set-tags)
  1242. (define-key custom-bindings (kbd "M-u") 'upcase-dwim)
  1243. (define-key custom-bindings (kbd "M-c") 'capitalize-dwim)
  1244. (define-key custom-bindings (kbd "M-l") 'downcase-dwim)
  1245. (define-key custom-bindings (kbd "M-o") 'other-window)
  1246. (define-key custom-bindings (kbd "C-c s") 'ispell-word)
  1247. (define-key custom-bindings (kbd "C-c C-d") 'org-capture)
  1248. (define-key custom-bindings (kbd "C-c <up>") 'windmove-up)
  1249. (define-key custom-bindings (kbd "C-c <down>") 'windmove-down)
  1250. (define-key custom-bindings (kbd "C-c <left>") 'windmove-left)
  1251. (define-key custom-bindings (kbd "C-c <right>") 'windmove-right)
  1252. (define-key custom-bindings (kbd "C-c a") (lambda () (interactive) (org-agenda nil "n")))
  1253. (define-key custom-bindings (kbd "C-c e") 'find-user-init-file)
  1254. (define-key custom-bindings (kbd "C-x f") 'phil-columns)
  1255. (define-key custom-bindings (kbd "C-x k") 'kill-this-buffer-unless-scratch)
  1256. (define-key custom-bindings (kbd "C-c d") 'duplicate-thing)
  1257. (define-key custom-bindings (kbd "C-;") 'comment-or-uncomment-region-or-line)
  1258. (define-key custom-bindings (kbd "C-o") 'new-line-below)
  1259. (define-key custom-bindings (kbd "C-S-o") 'new-line-above)
  1260. (define-key custom-bindings (kbd "<C-tab>") 'tidy)
  1261. (define-key custom-bindings (kbd "M-q")
  1262. (lambda ()
  1263. (interactive)
  1264. (kill-this-buffer)
  1265. (delete-window)
  1266. (message nil)
  1267. (message "Done")
  1268. ))
  1269. ;; (define-key custom-bindings (kbd "M-RET") '(lambda () (interactive) (term (getenv "SHELL"))))
  1270. (define-key artist-mode-map (kbd "C-c C-c") 'compile)
  1271. (define-minor-mode custom-bindings-mode
  1272. "A mode that activates custom-bindings."
  1273. t nil custom-bindings)
  1274. #+END_SRC
  1275. ** Development Specific
  1276. *** General
  1277. #+BEGIN_SRC emacs-lisp :results silent
  1278. (require 'rainbow-delimiters)
  1279. (global-flycheck-mode)
  1280. (add-hook 'before-save-hook 'delete-trailing-whitespace)
  1281. (add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
  1282. (setq-default indent-tabs-mode nil
  1283. tab-width 4)
  1284. (defvaralias 'c-basic-offset 'tab-width)
  1285. (defvaralias 'cperl-indent-level 'tab-width)
  1286. (electric-pair-mode 1)
  1287. (show-paren-mode 1)
  1288. (require 'dockerfile-mode)
  1289. (add-to-list 'auto-mode-alist '("Dockerfile*\\'" . dockerfile-mode))
  1290. (require 'gitignore-mode)
  1291. (add-to-list 'auto-mode-alist '("gitignore\\'" . gitignore-mode))
  1292. ;; Workaround to get Projectile to work again
  1293. (setq projectile-git-submodule-command nil)
  1294. (require 'json-mode)
  1295. (add-to-list 'auto-mode-alist '("\\.json\\'" . json-mode))
  1296. (require 'web-mode)
  1297. (add-to-list 'auto-mode-alist '("\\.html\\'" . web-mode))
  1298. #+END_SRC
  1299. *** Python
  1300. #+BEGIN_SRC emacs-lisp :results silent
  1301. (elpy-enable)
  1302. (setq python-shell-interpreter "jupyter"
  1303. python-shell-interpreter-args "console --simple-prompt")
  1304. (when (require 'flycheck nil t)
  1305. (setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
  1306. (add-hook 'elpy-mode-hook 'flycheck-mode))
  1307. (require 'py-autopep8)
  1308. (setq py-autopep8-options '("--ignore=E501"))
  1309. (add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)
  1310. #+END_SRC
  1311. *** Go
  1312. #+BEGIN_SRC emacs-lisp :results silent
  1313. (require 'go-mode)
  1314. (require 'go-playground)
  1315. (require 'gorepl-mode)
  1316. (require 'company-go)
  1317. (add-to-list 'auto-mode-alist '("\\.go\\'" . go-mode))
  1318. (add-hook 'go-mode-hook (lambda ()
  1319. (add-hook 'before-save-hook 'gofmt-before-save)
  1320. (local-set-key (kbd "M-.") 'godef-jump)
  1321. (local-set-key (kbd "M-,") 'pop-tag-mark)
  1322. (local-set-key (kbd "C-c C-c") (lambda ()
  1323. (interactive)
  1324. (ansi-term)
  1325. (comint-send-string "*ansi-term*" "make\n")))
  1326. (set (make-local-variable 'company-backends) '(company-go))
  1327. (setq company-tooltip-limit 20
  1328. company-echo-delay 0
  1329. company-begin-commands '(self-insert-command))
  1330. (gorepl-mode)))
  1331. (defun set-exec-path-from-shell-PATH ()
  1332. (let ((path-from-shell (replace-regexp-in-string
  1333. "[ \t\n]*$"
  1334. ""
  1335. (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'"))))
  1336. (setenv "PATH" path-from-shell)
  1337. (setq eshell-path-env path-from-shell)
  1338. (setq exec-path (split-string path-from-shell path-separator))))
  1339. (when window-system (set-exec-path-from-shell-PATH))
  1340. (setenv "GOPATH" "/home/locust/go")
  1341. (add-to-list 'exec-path "/home/locust/go/bin")
  1342. #+END_SRC
  1343. *** JS
  1344. **** Indium
  1345. #+BEGIN_SRC emacs-lisp :results silent
  1346. (add-to-list 'exec-path "/usr/local/bin")
  1347. #+END_SRC
  1348. *** TypeScript
  1349. #+BEGIN_SRC emacs-lisp :results silent
  1350. (defun setup-tide-mode ()
  1351. "Tide setup function."
  1352. (interactive)
  1353. (tide-setup)
  1354. (flycheck-mode +1)
  1355. (setq flycheck-check-syntax-automatically '(save mode-enabled))
  1356. (eldoc-mode +1)
  1357. (tide-hl-identifier-mode +1)
  1358. (company-mode +1))
  1359. ;; aligns annotation to the right hand side
  1360. (setq company-tooltip-align-annotations t)
  1361. ;; formats the buffer before saving
  1362. (add-hook 'before-save-hook 'tide-format-before-save)
  1363. (add-hook 'typescript-mode-hook #'setup-tide-mode)
  1364. (require 'typescript-mode)
  1365. (require 'tide)
  1366. (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))
  1367. (add-hook 'typescript-mode-hook
  1368. '(lambda ()
  1369. (set (make-local-variable 'company-backends) '(company-tide))
  1370. (setq company-tooltip-limit 20
  1371. company-echo-delay 0
  1372. company-begin-commands '(self-insert-command)
  1373. tide-format-options '(:insertSpaceAfterFunctionKeywordForAnonymousFunctions t :placeOpenBraceOnNewLineForFunctions nil))
  1374. (tide-setup)))
  1375. #+END_SRC
  1376. **** TSX
  1377. #+BEGIN_SRC emacs-lisp :results silent
  1378. (require 'web-mode)
  1379. (add-to-list 'auto-mode-alist '("\\.tsx\\'" . web-mode))
  1380. (add-hook 'web-mode-hook
  1381. (lambda ()
  1382. (when (string-equal "tsx" (file-name-extension buffer-file-name))
  1383. (setup-tide-mode))))
  1384. ;; enable typescript-tslint checker
  1385. (flycheck-add-mode 'typescript-tslint 'web-mode)
  1386. #+END_SRC
  1387. **** JSX
  1388. #+BEGIN_SRC emacs-lisp :results silent
  1389. (require 'web-mode)
  1390. (add-to-list 'auto-mode-alist '("\\.jsx\\'" . web-mode))
  1391. (add-hook 'web-mode-hook
  1392. (lambda ()
  1393. (when (string-equal "jsx" (file-name-extension buffer-file-name))
  1394. (setup-tide-mode))))
  1395. ;; configure jsx-tide checker to run after your default jsx checker
  1396. (flycheck-add-mode 'javascript-eslint 'web-mode)
  1397. (flycheck-add-next-checker 'javascript-eslint 'jsx-tide 'append)
  1398. #+END_SRC
  1399. *** Org
  1400. #+BEGIN_SRC emacs-lisp :results silent
  1401. (org-babel-do-load-languages
  1402. 'org-babel-load-languages
  1403. '((js . t)
  1404. (shell . t)
  1405. (emacs-lisp . t)))
  1406. (setq org-todo-keywords
  1407. '((sequence "TODO(t)" "|" "DONE(d)")
  1408. (sequence "BUG(b)" "|" "INPROGRESS(i)" "FIXED(f)")
  1409. (sequence "TEST(T)" "NOTEST(N)" "|" "COMPLETE(C)")
  1410. (sequence "|" "CANCELED(c)")
  1411. (sequence "|" "NEEDCLARIFICATION(n)")
  1412. (sequence "|" "PROVIDEUPDATE(p)")
  1413. (sequence "|" "WAITING(w)")
  1414. ))
  1415. (setq org-agenda-files
  1416. '("~/Dropbox/Org/todo.org"
  1417. "~/Dropbox/Org/archive.org"
  1418. "~/Dropbox/Org/diary/eaglecrk.org"))
  1419. (setq org-refile-targets
  1420. '((nil :maxlevel . 3)
  1421. (org-agenda-files :maxlevel . 3)))
  1422. ;; (add-hook 'focus-in-hook
  1423. ;; (lambda () (progn
  1424. ;; (setq org-tags-column (- 5 (frame-width)))) (org-align-all-tags)))
  1425. ;; (add-hook 'focus-out-hook
  1426. ;; (lambda () (progn
  1427. ;; (setq org-tags-column (- 5 (frame-width)))) (org-align-all-tags)))
  1428. (defvar org-src-tab-acts-natively)
  1429. (setq org-src-tab-acts-natively t)
  1430. (defvar org-confirm-babel-evaluate)
  1431. (defun my-org-confirm-babel-evaluate (lang _body)
  1432. "Execute certain languages without confirming.
  1433. Takes LANG to allow and BODY to execute."
  1434. (not (or (string= lang "js")
  1435. (string= lang "restclient")
  1436. (string= lang "emacs-lisp")
  1437. (string= lang "elisp")
  1438. (string= lang "sh")
  1439. (string= lang "shell"))))
  1440. (setq org-confirm-babel-evaluate #'my-org-confirm-babel-evaluate)
  1441. (add-to-list 'org-structure-template-alist
  1442. (list "e" (concat "#+BEGIN_SRC emacs-lisp :results silent\n"
  1443. "\n"
  1444. "#+END_SRC")))
  1445. (add-to-list 'org-structure-template-alist
  1446. (list "j" (concat "#+BEGIN_SRC js :cmd \"/usr/local/bin/babel-node\" :results output code\n"
  1447. "\n"
  1448. "#+END_SRC")))
  1449. (add-to-list 'org-structure-template-alist
  1450. (list "r" (concat "#+BEGIN_SRC restclient :results raw\n"
  1451. "\n"
  1452. "#+END_SRC")))
  1453. (setq org-directory "~/Dropbox/Org"
  1454. org-default-notes-file (concat org-directory "/todo.org")
  1455. org-startup-folded t
  1456. org-startup-indented t
  1457. org-startup-align-all-tables t
  1458. org-startup-with-inline-images t
  1459. org-startup-with-latex-preview t
  1460. org-log-done t
  1461. org-log-done-with-time t
  1462. org-log-into-drawer t
  1463. org-hide-leading-stars t
  1464. org-pretty-entities t
  1465. org-use-property-inheritance t
  1466. org-html-validation-link nil
  1467. org-html-text-markup-alist '((bold . "<b>%s</b>")
  1468. (code . "<code>%s</code>")
  1469. (italic . "<i>%s</i>")
  1470. (strike-through . "<del>%s</del>")
  1471. (underline . "<span class=\"underline\">%s</span>")
  1472. (verbatim . "<code class=\"verbatim\">%s</code>"))
  1473. )
  1474. (require 'org-protocol)
  1475. ;; Ensure the following is in ~/.config/mimeapps.list
  1476. ;;
  1477. ;; [Default Applications]
  1478. ;; x-scheme-handler/org-protocol=userapp-emacsclient.desktop
  1479. (setq org-capture-templates
  1480. '(("t" "new task" entry (file+headline "~/Dropbox/Org/todo.org" "Tasks")
  1481. "* TODO [#A] %?\nSCHEDULED: %(org-insert-time-stamp (org-read-date nil t \"+0d\"))\n%a\n")
  1482. ("n" "new note" entry (file+headline org-default-notes-file "Notes")
  1483. "* %?\n%i\n")
  1484. ("l" "store link" entry (file+olp org-default-notes-file "Links" "Unfiled")
  1485. "* %a\n%?\n")
  1486. ("d" "store link w/drawer" entry (file+olp org-default-notes-file "Links" "Unfiled")
  1487. "* %?\n%l\n:COPIED_TEXT:\n %i\n:END:\n")
  1488. ("f" "dotfile" entry (file+headline "~/Dropbox/Org/dotfiles.org" "Other")
  1489. "* %?\n:PROPERTIES:\n:CUSTOM_ID: %(org-id-get-create)\n:END:\n")
  1490. ))
  1491. (defun my-org-config ()
  1492. "Activate org and yas in 'org-mode' buffers."
  1493. (yas-minor-mode)
  1494. (lambda ()
  1495. (local-set-key (kbd "M-RET") 'org-insert-todo-heading)
  1496. (global-set-key (kbd "C-c c") nil)
  1497. (local-set-key (kbd "C-c c i") 'org-clock-in)
  1498. (local-set-key (kbd "C-c c o") 'org-clock-out)
  1499. )
  1500. )
  1501. (add-hook 'org-mode-hook #'my-org-config)
  1502. #+END_SRC
  1503. **** Presentations - Reveal
  1504. #+BEGIN_SRC emacs-lisp :results silent
  1505. (require 'ox-reveal)
  1506. (setq org-reveal-root "https://cdn.jsdelivr.net/npm/reveal.js"
  1507. org-reveal-klipsify-src t)
  1508. #+END_SRC
  1509. **** Mu4e
  1510. #+BEGIN_SRC emacs-lisp :results silent
  1511. ;;store org-mode links to messages
  1512. (require 'org-mu4e)
  1513. ;;store link to message if in header view, not to header query
  1514. (setq org-mu4e-link-query-in-headers-mode nil)
  1515. #+END_SRC
  1516. **** ElFeed
  1517. #+BEGIN_SRC emacs-lisp :results silent
  1518. (elfeed-org)
  1519. (setq rmh-elfeed-org-files (list "~/Dropbox/Org/elfeed.org"))
  1520. (defun leo/elfeed-search (arg)
  1521. "Search for ARG in feed."
  1522. (interactive)
  1523. (elfeed-search-set-filter arg))
  1524. (define-key elfeed-search-mode-map "a" (lambda () (interactive) (leo/elfeed-search "")))
  1525. (define-key elfeed-search-mode-map "e" (lambda () (interactive) (leo/elfeed-search "+emacs")))
  1526. (define-key elfeed-search-mode-map "d" (lambda () (interactive) (leo/elfeed-search "+daily")))
  1527. (define-key elfeed-search-mode-map "x" (lambda () (interactive) (leo/elfeed-search "xkcd")))
  1528. #+End_SRC
  1529. ** UI
  1530. *** Ligatures
  1531. #+BEGIN_SRC emacs-lisp :results silent
  1532. ;; Enable ligatures without prettify-symbols
  1533. (provide 'add-pragmatapro-symbol-keywords)
  1534. (defconst pragmatapro-fontlock-keywords-alist
  1535. (mapcar (lambda (regex-char-pair)
  1536. `(,(car regex-char-pair)
  1537. (0 (prog1 ()
  1538. (compose-region (match-beginning 1)
  1539. (match-end 1)
  1540. ,(concat (list ?\C-i)
  1541. (list (decode-char 'ucs (cadr regex-char-pair)))))))))
  1542. '(("\\(\\[ERROR\\]\\)" #XE380)
  1543. ("\\(\\[DEBUG\\]\\)" #XE381)
  1544. ("\\(\\[INFO\\]\\)" #XE382)
  1545. ("\\(\\[WARN\\]\\)" #XE383)
  1546. ("\\(\\[WARNING\\]\\)" #XE384)
  1547. ("\\(\\[ERR\\]\\)" #XE385)
  1548. ("\\(\\[FATAL\\]\\)" #XE386)
  1549. ("\\(\\[TRACE\\]\\)" #XE387)
  1550. ("\\(!!\\)" #XE900)
  1551. ("\\(!=\\)" #XE901)
  1552. ("\\(!==\\)" #XE902)
  1553. ("\\(!!!\\)" #XE903)
  1554. ("\\(!≡\\)" #XE904)
  1555. ("\\(!≡≡\\)" #XE905)
  1556. ("[^<]\\(!>\\)" #XE906)
  1557. ("\\(#(\\)" #XE920)
  1558. ("\\(#_\\)" #XE921)
  1559. ("\\(#{\\)" #XE922)
  1560. ("\\(#\\?\\)" #XE923)
  1561. ("[^<]\\(#>\\)" #XE924)
  1562. ("\\(##\\)" #XE925)
  1563. ("\\(%=\\)" #XE930)
  1564. ("[^<]\\(%>\\)" #XE931)
  1565. ("\\(&%\\)" #XE940)
  1566. ("\\(&&\\)" #XE941)
  1567. ("\\(&\\*\\)" #XE942)
  1568. ("\\(&\\+\\)" #XE943)
  1569. ("\\(&-\\)" #XE944)
  1570. ("\\(&/\\)" #XE945)
  1571. ("\\(&=\\)" #XE946)
  1572. ("\\(&&&\\)" #XE947)
  1573. ("[^<]\\(&>\\)" #XE948)
  1574. ("\\(\\*\\*\\*\\)" #XE960)
  1575. ("\\(\\*=\\)" #XE961)
  1576. ("\\(\\*/\\)" #XE962)
  1577. ("[^<]\\(\\*>\\)" #XE963)
  1578. ("\\(\\+\\+\\)" #XE970)
  1579. ("\\(\\+\\+\\+\\)" #XE971)
  1580. ("[^\\+]\\(\\+=\\)" #XE972)
  1581. ("[^<]\\(\\+>\\)" #XE973)
  1582. ("\\(\\+\\+=\\)" #XE974)
  1583. ("\\(--\\)" #XE980)
  1584. ("[^-]\\(-<\\)" #XE981)
  1585. ("\\(-<<\\)" #XE982)
  1586. ("\\(-=\\)" #XE983)
  1587. ("[^|]\\(->\\)" #XE984)
  1588. ("[^|]\\(->>\\)" #XE985)
  1589. ("\\(---\\)" #XE986)
  1590. ("\\(-->\\)" #XE987)
  1591. ("\\(-\\+-\\)" #XE988)
  1592. ("\\(-\\\\/\\)" #XE989)
  1593. ("[^\\^]\\(\\.\\.\\)" #XE990)
  1594. ("\\(\\.\\.\\.\\)" #XE991)
  1595. ("\\(\\.\\.<\\)" #XE992)
  1596. ("\\(\\.>\\)" #XE993)
  1597. ("\\(\\.~\\)" #XE994)
  1598. ("\\(\\.=\\)" #XE995)
  1599. ("\\(/\\*\\)" #XE9A0)
  1600. ("\\(//\\)" #XE9A1)
  1601. ("[^<]\\(/>\\)" #XE9A2)
  1602. ("[^=]\\(/=\\)" #XE9A3)
  1603. ("\\(/==\\)" #XE9A4)
  1604. ("\\(///\\)" #XE9A5)
  1605. ("\\(/\\*\\*\\)" #XE9A6)
  1606. ("\\(::\\)" #XE9B0)
  1607. ("\\(:=\\)" #XE9B1)
  1608. ("[^≡]\\(:≡\\)" #XE9B2)
  1609. ("\\(:>\\)" #XE9B3)
  1610. ("\\(:=>\\)" #XE9B4)
  1611. ("\\(<\\*\\)" #XE9C1)
  1612. ("\\(<\\*>\\)" #XE9C2)
  1613. ("[^<]\\(<-\\)" #XE9C4)
  1614. ("[^-]\\(<<\\)" #XE9C5)
  1615. ("\\(<<<\\)" #XE9C6)
  1616. ("\\(<<=\\)" #XE9C7)
  1617. ("[^<]\\(<=\\)" #XE9C8)
  1618. ("\\(<=>\\)" #XE9C9)
  1619. ("\\(<>\\)" #XE9CA)
  1620. ("\\(<<-\\)" #XE9CC)
  1621. ("\\(<|\\)" #XE9CD)
  1622. ("\\(<|>\\)" #XE9CB)
  1623. ("\\(<=<\\)" #XE9CE)
  1624. ("[^<]\\(<~\\)" #XE9CF)
  1625. ("\\(<~~\\)" #XE9D0)
  1626. ("\\(<<~\\)" #XE9D1)
  1627. ("\\(<\\$\\)" #XE9D2)
  1628. ("\\(<\\$>\\)" #XE9C0)
  1629. ("\\(<\\+\\)" #XE9D3)
  1630. ("\\(<\\+>\\)" #XE9C3)
  1631. ("\\(<~>\\)" #XE9E0)
  1632. ("\\(<\\*\\*>\\)" #XE9E1)
  1633. ("\\(<<\\^\\)" #XE9E2)
  1634. ("\\(<!\\)" #XE9E3)
  1635. ("\\(<!>\\)" #XE9D4)
  1636. ("\\(<@\\)" #XE9E4)
  1637. ("\\(<#\\)" #XE9E5)
  1638. ("\\(<#>\\)" #XE9D6)
  1639. ("\\(<%\\)" #XE9E6)
  1640. ("\\(<%>\\)" #XE9D7)
  1641. ("[^<]\\(<\\^\\)" #XE9E7)
  1642. ("\\(<&\\)" #XE9E8)
  1643. ("\\(<&>\\)" #XE9D9)
  1644. ("\\(<\\?\\)" #XE9E9)
  1645. ("\\(<\\.\\)" #XE9EA)
  1646. ("\\(<\\.>\\)" #XE9DB)
  1647. ("\\(</\\)" #XE9EB)
  1648. ("\\(</>\\)" #XE9DC)
  1649. ("\\(<\\\\\\)" #XE9EC)
  1650. ("\\(<\"\\)" #XE9ED)
  1651. ("\\(<\">\\)" #XE9DE)
  1652. ("\\(<:\\)" #XE9EE)
  1653. ("\\(<:>\\)" #XE9DF)
  1654. ("\\(<->\\)" #XE9EF)
  1655. ("\\(<!--\\)" #XE9F0)
  1656. ("\\(<--\\)" #XE9F1)
  1657. ("\\(<~<\\)" #XE9F2)
  1658. ("\\(<==>\\)" #XE9F3)
  1659. ("\\(==<\\)" #XEA00)
  1660. ("[^/!<=>]\\(==\\)[^><=]" #XEA01)
  1661. ("\\(===\\)" #XEA02)
  1662. ("[^<]\\(==>\\)" #XEA03)
  1663. ("[^=:<]\\(=>\\)" #XEA04)
  1664. ("\\(=~\\)" #XEA05)
  1665. ("\\(=>>\\)" #XEA06)
  1666. ("\\(=/=\\)" #XEA07)
  1667. ("[^!]\\(≡≡\\)" #XEA10)
  1668. ("\\(≡≡≡\\)" #XEA11)
  1669. ("\\(≡:≡\\)" #XEA12)
  1670. ("[^>]\\(>-\\)" #XEA20)
  1671. ("\\(>=\\)" #XEA21)
  1672. ("[^=-]\\(>>\\)" #XEA22)
  1673. ("\\(>>-\\)" #XEA23)
  1674. ("\\(>==\\)" #XEA24)
  1675. ("\\(>>>\\)" #XEA25)
  1676. ("\\(>=>\\)" #XEA26)
  1677. ("\\(>>\\^\\)" #XEA27)
  1678. ("\\(\\?\\?\\)" #XEA40)
  1679. ("\\(\\?~\\)" #XEA41)
  1680. ("\\(\\?=\\)" #XEA42)
  1681. ("\\(\\?>\\)" #XEA43)
  1682. ("\\(<\\?>\\)" #XE9DA)
  1683. ("\\(\\?\\?\\?\\)" #XEA44)
  1684. ("\\(\\^=\\)" #XEA48)
  1685. ("\\(\\^\\.\\)" #XEA49)
  1686. ("\\(\\^\\?\\)" #XEA4A)
  1687. ("\\(\\^\\.\\.\\)" #XEA4B)
  1688. ("\\(\\^<<\\)" #XEA4C)
  1689. ("\\(\\^>\\)" #XEA4E)
  1690. ("\\(\\^>>\\)" #XEA4D)
  1691. ("\\(<\\^>\\)" #XE9D8)
  1692. ("[^\\\\]\\(\\\\\\\\\\)" #XEA50)
  1693. ("[^<]\\(\\\\>\\)" #XEA51)
  1694. ("\\(<\\\\>\\)" #XE9DD)
  1695. ("\\(\\\\/-\\)" #XEA52)
  1696. ("\\(@>\\)" #XEA57)
  1697. ("\\(<@>\\)" #XE9D5)
  1698. ("\\(|=\\)" #XEA60)
  1699. ("\\(||\\)" #XEA61)
  1700. ("[^<]\\(|>\\)" #XEA62)
  1701. ("\\(|||\\)" #XEA63)
  1702. ("\\(|\\+|\\)" #XEA64)
  1703. ("\\(|->\\)" #XEA65)
  1704. ("\\(|-->\\)" #XEA66)
  1705. ("\\(|=>\\)" #XEA67)
  1706. ("\\(|==>\\)" #XEA68)
  1707. ("\\(~=\\)" #XEA70)
  1708. ("[^~<]\\(~>\\)" #XEA71)
  1709. ("\\(~~>\\)" #XEA72)
  1710. ("\\(~>>\\)" #XEA73)
  1711. ("[^<]\\(\">\\)" #XEA90))))
  1712. (defun add-pragmatapro-symbol-keywords ()
  1713. (font-lock-add-keywords nil pragmatapro-fontlock-keywords-alist))
  1714. (add-hook 'prog-mode-hook
  1715. #'add-pragmatapro-symbol-keywords)
  1716. #+END_SRC
  1717. Org Mode Specific Checkboxes
  1718. #+BEGIN_SRC emacs-lisp :results silent
  1719. ;; Enable Org mode checkbox ligatures without prettify-symbols
  1720. (provide 'add-checkbox-symbol-keywords)
  1721. (defconst checkbox-fontlock-keywords-alist
  1722. (mapcar (lambda (regex-char-pair)
  1723. `(,(car regex-char-pair)
  1724. (0 (prog1 ()
  1725. (compose-region (match-beginning 1)
  1726. (match-end 1)
  1727. ,(concat (list ?\C-i)
  1728. (list (decode-char 'ucs (cadr regex-char-pair)))))))))
  1729. '(("\\(\\[ \\]\\)" #XF096);2B1C
  1730. ("\\(\\[-\\]\\)" #XF147);29C7;F458
  1731. ("\\(\\[X\\]\\)" #XF046);2BBD
  1732. )))
  1733. (defun add-checkbox-symbol-keywords ()
  1734. (font-lock-add-keywords nil checkbox-fontlock-keywords-alist))
  1735. (add-hook 'org-mode-hook
  1736. #'add-checkbox-symbol-keywords)
  1737. #+END_SRC
  1738. Ligature Testing
  1739. #+BEGIN_SRC emacs-lisp :results silent
  1740. ;; All ligatures (for testing)
  1741. ;; [ERROR]
  1742. ;; [DEBUG]
  1743. ;; [INFO]
  1744. ;; [WARN]
  1745. ;; [WARNING]
  1746. ;; [ERR]
  1747. ;; [FATAL]
  1748. ;; [TRACE]
  1749. ;; !!
  1750. ;; !=
  1751. ;; !==
  1752. ;; !!!
  1753. ;; !≡
  1754. ;; !≡≡
  1755. ;; !>
  1756. ;; #(
  1757. ;; #_
  1758. ;; #{
  1759. ;; #?
  1760. ;; #>
  1761. ;; ##
  1762. ;; %=
  1763. ;; %>
  1764. ;; &%
  1765. ;; &&
  1766. ;; &*
  1767. ;; &+
  1768. ;; &-
  1769. ;; &/
  1770. ;; &=
  1771. ;; &&&
  1772. ;; &>
  1773. ;; ***
  1774. ;; *=
  1775. ;; */
  1776. ;; *>
  1777. ;; ++
  1778. ;; +++
  1779. ;; +=
  1780. ;; +>
  1781. ;; ++=
  1782. ;; --
  1783. ;; -<
  1784. ;; -<<
  1785. ;; -=
  1786. ;; ->
  1787. ;; ->>
  1788. ;; ---
  1789. ;; -->
  1790. ;; -+-
  1791. ;; -\/
  1792. ;; ..
  1793. ;; ...
  1794. ;; ..<
  1795. ;; .>
  1796. ;; .~
  1797. ;; .=
  1798. ;; /*
  1799. ;; //
  1800. ;; />
  1801. ;; /=
  1802. ;; /==
  1803. ;; ///
  1804. ;; /**
  1805. ;; ::
  1806. ;; :=
  1807. ;; :≡
  1808. ;; :>
  1809. ;; :=>
  1810. ;; <$>
  1811. ;; <*
  1812. ;; <*>
  1813. ;; <+>
  1814. ;; <-
  1815. ;; <<
  1816. ;; <<<
  1817. ;; <<=
  1818. ;; <=
  1819. ;; <=>
  1820. ;; <>
  1821. ;; <|>
  1822. ;; <<-
  1823. ;; <|
  1824. ;; <=<
  1825. ;; <~
  1826. ;; <~~
  1827. ;; <<~
  1828. ;; <$
  1829. ;; <+
  1830. ;; <!>
  1831. ;; <@>
  1832. ;; <#>
  1833. ;; <%>
  1834. ;; <^>
  1835. ;; <&>
  1836. ;; <?>
  1837. ;; <.>
  1838. ;; </>
  1839. ;; <\>
  1840. ;; <">
  1841. ;; <:>
  1842. ;; <~>
  1843. ;; <**>
  1844. ;; <<^
  1845. ;; <!
  1846. ;; <@
  1847. ;; <#
  1848. ;; <%
  1849. ;; <^
  1850. ;; <&
  1851. ;; <?
  1852. ;; <.
  1853. ;; </
  1854. ;; <\
  1855. ;; <"
  1856. ;; <:
  1857. ;; <->
  1858. ;; <!--
  1859. ;; <--
  1860. ;; <~<
  1861. ;; <==>
  1862. ;; ==<
  1863. ;; ==
  1864. ;; ===
  1865. ;; ==>
  1866. ;; =>
  1867. ;; =~
  1868. ;; =>>
  1869. ;; =/=
  1870. ;; ≡≡
  1871. ;; ≡≡≡
  1872. ;; ≡:≡
  1873. ;; >-
  1874. ;; >=
  1875. ;; >>
  1876. ;; >>-
  1877. ;; >==
  1878. ;; >>>
  1879. ;; >=>
  1880. ;; >>^
  1881. ;; ??
  1882. ;; ?~
  1883. ;; ?=
  1884. ;; ?>
  1885. ;; ???
  1886. ;; ^=
  1887. ;; ^.
  1888. ;; ^?
  1889. ;; ^..
  1890. ;; ^<<
  1891. ;; ^>>
  1892. ;; ^>
  1893. ;; \\
  1894. ;; \>
  1895. ;; \/-
  1896. ;; @>
  1897. ;; |=
  1898. ;; ||
  1899. ;; |>
  1900. ;; |||
  1901. ;; |+|
  1902. ;; |->
  1903. ;; |-->
  1904. ;; |=>
  1905. ;; |==>
  1906. ;; ~=
  1907. ;; ~>
  1908. ;; ~~>
  1909. ;; ~>>
  1910. ;; ">
  1911. #+END_SRC
  1912. *** Font
  1913. #+BEGIN_SRC emacs-lisp :results silent
  1914. (cond ((member "PragmataPro Liga" (font-family-list))
  1915. (set-face-attribute 'default nil :font "PragmataPro Liga-13")))
  1916. ;; (cond ((member "IBM Plex Mono Thin" (font-family-list))
  1917. ;; (set-face-attribute 'default nil :font "IBM Plex Mono Thin-13")))
  1918. ;; (cond ((member "IBM Plex Mono" (font-family-list))
  1919. ;; (set-face-attribute 'default nil :font "IBM Plex Mono-12")))
  1920. #+END_SRC
  1921. *** Org Headings
  1922. #+BEGIN_SRC emacs-lisp :results silent
  1923. (add-hook 'org-mode-hook 'org-bullets-mode)
  1924. (set-face-attribute 'org-level-1 nil :height 1.3)
  1925. (set-face-attribute 'org-level-2 nil :height 1.1)
  1926. (set-face-attribute 'org-level-3 nil :height 1.05)
  1927. (set-face-attribute 'org-level-4 nil :height 1.05)
  1928. (set-face-attribute 'org-scheduled-today nil :height 1.0)
  1929. (set-face-attribute 'org-agenda-date-today nil :height 1.1)
  1930. ;; (set-face-attribute 'org-table nil :foreground "#008787")
  1931. #+END_SRC
  1932. *** Doom Modeline
  1933. #+BEGIN_SRC emacs-lisp :results silent
  1934. (require 'doom-modeline)
  1935. (doom-modeline-mode 1)
  1936. ;; How tall the mode-line should be (only respected in GUI Emacs).
  1937. (setq doom-modeline-height 30)
  1938. ;; How wide the mode-line bar should be (only respected in GUI Emacs).
  1939. (setq doom-modeline-bar-width 4)
  1940. ;; Determines the style used by `doom-modeline-buffer-file-name'.
  1941. ;;
  1942. ;; Given ~/Projects/FOSS/emacs/lisp/comint.el
  1943. ;; truncate-upto-project => ~/P/F/emacs/lisp/comint.el
  1944. ;; truncate-from-project => ~/Projects/FOSS/emacs/l/comint.el
  1945. ;; truncate-with-project => emacs/l/comint.el
  1946. ;; truncate-except-project => ~/P/F/emacs/l/comint.el
  1947. ;; truncate-upto-root => ~/P/F/e/lisp/comint.el
  1948. ;; truncate-all => ~/P/F/e/l/comint.el
  1949. ;; relative-from-project => emacs/lisp/comint.el
  1950. ;; relative-to-project => lisp/comint.el
  1951. ;; file-name => comint.el
  1952. ;; buffer-name => comint.el<2> (uniquify buffer name)
  1953. ;;
  1954. ;; If you are expereicing the laggy issue, especially while editing remote files
  1955. ;; with tramp, please try `file-name' style.
  1956. ;; Please refer to https://github.com/bbatsov/projectile/issues/657.
  1957. (setq doom-modeline-buffer-file-name-style 'truncate-upto-project)
  1958. ;; What executable of Python will be used (if nil nothing will be showed).
  1959. (setq doom-modeline-python-executable "python")
  1960. ;; Whether show `all-the-icons' or not (if nil nothing will be showed).
  1961. (setq doom-modeline-icon t)
  1962. ;; Whether show the icon for major mode. It respects `doom-modeline-icon'.
  1963. (setq doom-modeline-major-mode-icon t)
  1964. ;; Display color icons for `major-mode'. It respects `all-the-icons-color-icons'.
  1965. (setq doom-modeline-major-mode-color-icon nil)
  1966. ;; Whether display minor modes or not. Non-nil to display in mode-line.
  1967. (setq doom-modeline-minor-modes nil)
  1968. ;; If non-nil, a word count will be added to the selection-info modeline segment.
  1969. (setq doom-modeline-enable-word-count nil)
  1970. ;; If non-nil, only display one number for checker information if applicable.
  1971. (setq doom-modeline-checker-simple-format t)
  1972. ;; Whether display perspective name or not. Non-nil to display in mode-line.
  1973. (setq doom-modeline-persp-name t)
  1974. ;; Whether display `lsp' state or not. Non-nil to display in mode-line.
  1975. (setq doom-modeline-lsp t)
  1976. ;; Whether display github notifications or not. Requires `ghub` package.
  1977. (setq doom-modeline-github nil)
  1978. ;; The interval of checking github.
  1979. (setq doom-modeline-github-interval (* 30 60))
  1980. ;; Whether display environment version or not.
  1981. (setq doom-modeline-env-version t)
  1982. ;; Whether display mu4e notifications or not. Requires `mu4e-alert' package.
  1983. (setq doom-modeline-mu4e t)
  1984. #+END_SRC