I showed you my source code, pls respond
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.

1256 lines
38 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. #+TITLE: Dotfiles
  2. #+AUTHOR: Christopher James Hayward
  3. #+EMAIL: chris@chrishayward.xyz
  4. #+ROAM_KEY: https://github.com/chayward1/dotfiles
  5. #+begin_example
  6. _.-="_- _
  7. _.-=" _- | ||"""""""---._______ __..
  8. ___.===""""-.______-,,,,,,,,,,,,`-''----" """"" """"" __'
  9. __.--"" __ ,' o \ __ [__|
  10. __-""=======.--"" ""--.=================================.--"" ""--.=======:
  11. ] [w] : / \ : |========================| : / \ : [w] :
  12. V___________:| |: |========================| :| |: _-"
  13. V__________: \ / :_|=======================/_____: \ / :__-"
  14. -----------' "-____-" `-------------------------------' "-____-"
  15. #+end_example
  16. Immutable GNU Emacs dotfiles, inspired by Doom, built for Life, Liberty, and the Open Road.
  17. + 100% Literate
  18. + 100% Immutable
  19. + 100% Reproducible
  20. * Init
  21. :PROPERTIES:
  22. :header-args: :tangle ~/.local/source/dotfiles/init.el
  23. :END:
  24. Although later versions of Emacs introduce =early-init.el=, it's not used in this configuration for two reasons:
  25. + It's not required due to the modularity
  26. + Maintaining support for older versions
  27. Assuming you have completed all of the following tasks prior to proceeding further:
  28. 1. Imported the =secrets=
  29. 2. Initialized the =passwords=
  30. 3. Defined the =host= file
  31. 4. Created all required symbolic links
  32. Load the host configuration.
  33. #+begin_src emacs-lisp
  34. (let ((host-file (concat "~/.local/source/dotfiles/hosts/" system-name ".el")))
  35. (when (file-exists-p host-file)
  36. (load-file host-file)))
  37. #+end_src
  38. Load the enabled modules.
  39. #+begin_src emacs-lisp
  40. (dolist (m dotfiles/modules)
  41. (let ((mod-file (concat "~/.local/source/dotfiles/modules/" (symbol-name m) ".el")))
  42. (when (file-exists-p mod-file)
  43. (load-file mod-file))))
  44. #+end_src
  45. * Hosts
  46. Each host system that runs Emacs has a file defined in the =hosts/= sub directory, following the pattern of ~$HOSTNAME.el~. All of the configurations are defined within this file, the values of which are read from by the other modules during startup and installation. This does *not* cover hosts that are controlled via =TRAMP=, as that will be covered in another section.
  47. ** Example (Ubuntu)
  48. :PROPERTIES:
  49. :header-args: :tangle ~/.local/source/dotfiles/hosts/ubuntu.el
  50. :END:
  51. The first configuration, which was built using the Ubuntu 20.04 LTS server edition. I decided to incorporate =flatpaks= into this build. Setting the ~$BROWSER~ variable is required in the desktop module. Set the browser to the flatpak borwser currently installed, this could change to chromium, firefox, or any other browser by changing this environment variable.
  52. #+begin_src emacs-lisp
  53. (setenv "BROWSER" "flatpak run org.mozilla.firefox")
  54. #+end_src
  55. Add the modules you want to initialize to the ~dotfiles/modules~ variable.
  56. #+begin_src emacs-lisp
  57. (defvar dotfiles/modules '(core
  58. desktop
  59. writing
  60. projects
  61. interface))
  62. #+end_src
  63. Specify the cache directory.
  64. #+begin_src emacs-lisp
  65. (defvar dotfiles/cache "~/.cache/emacs")
  66. #+end_src
  67. Functionality like =completion= and =hints= can be delayed to avoid popups for common manuevers. Adjust this value to your personal taste.
  68. #+begin_src emacs-lisp
  69. (defvar dotfiles/idle 0.0)
  70. #+end_src
  71. Avoid the infamous *Emacs pinky* by binding =SPC= as a leader key, utilizing the thumb instead of the weaker pinky finger. You may change this value if you want to use something else.
  72. #+begin_src emacs-lisp
  73. (defvar dotfiles/leader-key "SPC")
  74. (defvar dotfiles/leader-key-global "C-SPC")
  75. #+end_src
  76. Define where the source repositories are stored, with most projects being relative from that directory.
  77. #+begin_src emacs-lisp
  78. (defvar dotfiles/src "~/.local/source/")
  79. #+end_src
  80. The brain project provides the basis for my agenda, notes, blog, and presentations.
  81. #+begin_src emacs-lisp
  82. (defvar dotfiles/brain (concat dotfiles/src "brain/"))
  83. (defvar dotfiles/notes (concat dotfiles/brain "notes/"))
  84. (defvar dotfiles/bib (concat dotfiles/brain "resources.bib"))
  85. #+end_src
  86. Secret keys and passwords are stored in a seperate repository.
  87. #+begin_src emacs-lisp
  88. (defvar dotfiles/secrets (concat dotfiles/src "secrets/"))
  89. (defvar dotfiles/passwords (concat dotfiles/src "passwords/"))
  90. #+end_src
  91. * Modules
  92. Breaking down the project into logical units or chapters to keep the code more maintainable and organized. This is also a fundemental requirement to achieve the goal of modularity. Incorporating just the =core= module on a build server to build literate programming projects is just one example of what can be achieved.
  93. ** Core
  94. :PROPERTIES:
  95. :header-args: :tangle ~/.local/source/dotfiles/modules/core.el :results silent
  96. :END:
  97. Minimal configuration to make Emacs usable for my own personal workflow. This does very little in the ways of improving the visuals, only removing what is included by default and not required.
  98. *** Cleanup
  99. Emacs creates a lot of files relative to ~user-emacs-directory~, these files are not part of this immutable configuration and do not belong in the emacs directory. How can we solve this issue? Shortly after initialization, before most packages are loaded, we change the value to ~dotfiles/cache~. I elaborate more on the technique in my post [[https://chrishayward.xyz/posts/immutable_emacs/][Immutable Emacs]].
  100. #+begin_src emacs-lisp
  101. (setq user-emacs-directory dotfiles/cache)
  102. #+end_src
  103. Because this project uses version-control, we can disable more unwanted features:
  104. + Lock files
  105. + Backup files
  106. #+begin_src emacs-lisp
  107. (setq create-lockfiles nil
  108. make-backup-files nil)
  109. #+end_src
  110. *** Package management
  111. Download and install packages using [[https://github.com/raxod502/straight.el][straight.el]], a functional package manager that integrates with =use-package=, giving us more control over where packages are sourced from.
  112. + Use the development branch
  113. + Integrate with ~use-package~
  114. Apply the configurations prior to bootstrapping the package manager, by setting (writing) to the variables that =straight= will ultimately read from.
  115. #+begin_src emacs-lisp
  116. (setq straight-repository-branch "develop"
  117. straight-use-package-by-default t)
  118. #+end_src
  119. Bootstrap the package manager, downloading, installing, or configuring depending on the state of the configuration. All packages are downloaded and built from source, and can be pinned to specific git commit hashes.
  120. #+begin_src emacs-lisp
  121. (defvar bootstrap-version)
  122. (let ((bootstrap-file
  123. (expand-file-name "straight/repos/straight.el/bootstrap.el" user-emacs-directory))
  124. (bootstrap-version 5))
  125. (unless (file-exists-p bootstrap-file)
  126. (with-current-buffer
  127. (url-retrieve-synchronously
  128. "https://raw.githubusercontent.com/raxod502/straight.el/develop/install.el"
  129. 'silent 'inhibit-cookies)
  130. (goto-char (point-max))
  131. (eval-print-last-sexp)))
  132. (load bootstrap-file nil 'nomessage))
  133. #+end_src
  134. Complete the integration with ~use-package~ by installing it with =straight=.
  135. #+begin_src emacs-lisp
  136. (straight-use-package 'use-package)
  137. #+end_src
  138. *** Hermetic evaluation
  139. Despite having our *stateful* and *immutable* configurations seperate, it's good practice to make efforts to reduce the trash created by Emacs.
  140. Install [[https://github.com/emacscollective/no-littering][no-littering]] to reduce the files created by Emacs.
  141. #+begin_src emacs-lisp
  142. (use-package no-littering)
  143. #+end_src
  144. Emacs' default user interface is horrendous, but with less than 10 lines of code we can change that.
  145. #+begin_src emacs-lisp
  146. (setq inhibit-startup-message t)
  147. (global-prettify-symbols-mode)
  148. (scroll-bar-mode -1)
  149. (menu-bar-mode -1)
  150. (tool-bar-mode -1)
  151. (tooltip-mode -1)
  152. #+end_src
  153. *** Literate programming
  154. *Organize your plain life in plain text*
  155. [[https://orgmode.org][Org-mode]] is one of the hallmark features of Emacs, and provides the basis for my Literate Programming platform. It's essentially a markdown language with rich features for project management, scheduling, development, and writing. It's hard to convey everything within its capabilities.
  156. + [[https://orgmode.org/worg/org-contrib/babel/languages/index.html][Babel languages]]
  157. + [[https://orgmode.org/manual/Structure-Templates.html][Structure templates]]
  158. #+begin_src emacs-lisp
  159. (use-package org
  160. :hook
  161. (org-mode . (lambda ()
  162. (org-indent-mode)
  163. (visual-line-mode 1)
  164. (variable-pitch-mode 1)))
  165. :config
  166. (setq org-ellipsis " ▾"
  167. org-log-done 'time
  168. org-log-into-drawer t
  169. org-src-preserve-indentation t)
  170. (org-babel-do-load-languages
  171. 'org-babel-load-languages
  172. '((shell . t)
  173. (python . t)
  174. (emacs-lisp . t)))
  175. (require 'org-tempo)
  176. (add-to-list 'org-structure-template-alist '("s" . "src"))
  177. (add-to-list 'org-structure-template-alist '("q" . "quote"))
  178. (add-to-list 'org-structure-template-alist '("e" . "example"))
  179. (add-to-list 'org-structure-template-alist '("sh" . "src shell"))
  180. (add-to-list 'org-structure-template-alist '("py" . "src python"))
  181. (add-to-list 'org-structure-template-alist '("el" . "src emacs-lisp")))
  182. #+end_src
  183. #+begin_src emacs-lisp
  184. (defun dotfiles/tangle (dir)
  185. "Recursively tangle the Org files within a directory."
  186. (interactive)
  187. (let ((org-files (directory-files-recursively dir "org")))
  188. (dolist (f org-files)
  189. (org-babel-tangle-file f))))
  190. #+end_src
  191. *** Custom keybindings
  192. Make the =ESC= key quit (most) prompts, instead of the default =C-g=.
  193. #+begin_src emacs-lisp
  194. (global-set-key (kbd "<escape>") 'keyboard-escape-quit)
  195. #+end_src
  196. **** Hints
  197. Download [[https://github.com/justbur/emacs-which-key][which-key]], a package that displays the current incomplete keybinding input in a mini-buffer, showing available completion options.
  198. #+begin_src emacs-lisp
  199. (use-package which-key
  200. :diminish which-key-mode
  201. :init (which-key-mode)
  202. :config (setq which-key-idle-delay dotfiles/idle))
  203. #+end_src
  204. **** Leader
  205. Implement the *leader* key using [[https://github.com/noctuid/general.el][general.el]], letting us easily configure prefixed keybindings in a much cleaner manner than the default methods.
  206. #+begin_src emacs-lisp
  207. (use-package general
  208. :config
  209. (general-create-definer dotfiles/leader
  210. :states '(normal motion)
  211. :keymaps 'override
  212. :prefix dotfiles/leader-key
  213. :global-prefix dotfiles/leader-key-global))
  214. #+end_src
  215. Use [[https://github.com/abo-abo/hydra][hydra]] for transient keybindings sharing a common prefix.
  216. #+begin_src emacs-lisp
  217. (use-package hydra)
  218. #+end_src
  219. **** Evil mode
  220. After a few hour with =vim= I knew it was game over, I cannot even think of another way I would feel comfortable editing text. Luckily, there exist packages to emulate this within Emacs. [[https://evil.readthedocs.io/en/latest/index.html][evil-mode]] is the extensible VI layer for Emacs.
  221. #+begin_src emacs-lisp
  222. (use-package evil
  223. :init (setq evil-want-integration t
  224. evil-want-keybinding nil)
  225. :config (evil-mode 1))
  226. #+end_src
  227. Unfortunately the default keybindings are *lacking*, but there is a community curated package [[https://github.com/emacs-evil/evil-collection][evil-collection]], which does a much better job implementing keybindings you would expect to find.
  228. #+begin_src emacs-lisp
  229. (use-package evil-collection
  230. :after evil
  231. :config (evil-collection-init))
  232. #+end_src
  233. Surround text with functions, quotations, and any other symbols using the [[https://github.com/emacs-evil/evil-surround][evil-surround]] package.
  234. #+begin_src emacs-lisp
  235. (use-package evil-surround
  236. :config (global-evil-surround-mode 1))
  237. #+end_src
  238. https://github.com/redguardtoo/evil-nerd-commenter
  239. + Toggle comments with =M-;=
  240. #+begin_src emacs-lisp
  241. (use-package evil-nerd-commenter
  242. :bind ("M-;" . evilnc-comment-or-uncomment-lines))
  243. #+end_src
  244. **** Shortcuts
  245. Again cherry picked from =Doom=, I want to continue utilizing the muscle memory I have developed from a year of mainlining the framework.
  246. + Close buffers with =SPC c=
  247. + Find files with =SPC . (period)=
  248. + Switch buffers with =SPC , (comma)=
  249. #+begin_src emacs-lisp
  250. (dotfiles/leader
  251. "." '(find-file :which-key "Files")
  252. "," '(switch-to-buffer :which-key "Buffers")
  253. "c" '(kill-buffer-and-window :which-key "Close"))
  254. #+end_src
  255. Run helper functions with =SPC h=.
  256. + Packages =p=
  257. + Variables =v=
  258. + Functions =f=
  259. #+begin_src emacs-lisp
  260. (dotfiles/leader
  261. "h" '(:ignore t :which-key "Help")
  262. "hp" '(describe-package :which-key "Package")
  263. "hv" '(describe-variable :which-key "Variable")
  264. "hf" '(describe-function :which-key "Function"))
  265. #+end_src
  266. Quit emacs with =SPC q=.
  267. + Saving =q=
  268. + Without =w=
  269. + Frame (daemon) =f=
  270. #+begin_src emacs-lisp
  271. (dotfiles/leader
  272. "q" '(:ignore t :which-key "Quit")
  273. "qq" '(save-buffers-kill-emacs :which-key "Save")
  274. "qw" '(kill-emacs :which-key "Now")
  275. "qf" '(delete-frame :which-key "Frame"))
  276. #+end_src
  277. Window management with =SPC w=.
  278. + Swap with =w=
  279. + Close with =c=
  280. + Motions with =h,j,k,l=
  281. + Split with =s + <MOTION>=
  282. #+begin_src emacs-lisp
  283. (dotfiles/leader
  284. "w" '(:ignore t :which-key "Window")
  285. "ww" '(window-swap-states :which-key "Swap")
  286. "wc" '(delete-window :which-key "Close")
  287. "wh" '(windmove-left :which-key "Left")
  288. "wj" '(windmove-down :which-key "Down")
  289. "wk" '(windmove-up :which-key "Up")
  290. "wl" '(windmove-right :which-key "Right")
  291. "ws" '(:ignore t :which-key "Split")
  292. "wsj" '(split-window-below :which-key "Down")
  293. "wsl" '(split-window-right :which-key "Right"))
  294. #+end_src
  295. Place runtime tweaks behind =SPC t=.
  296. #+begin_src emacs-lisp
  297. (dotfiles/leader
  298. "t" '(:ignore t :which-key "Tweaks"))
  299. #+end_src
  300. *** Version control
  301. Another hallmark feature is [[https://github.com/magit/magit][Magit]], a complete git porcelain within Emacs.
  302. #+begin_src emacs-lisp
  303. (use-package magit
  304. :custom (magit-display-buffer-function
  305. #'magit-display-buffer-same-window-except-diff-v1))
  306. #+end_src
  307. Work directly with github issues / pull requests using [[https://github.com/magit/forge][Forge]].
  308. + Requires a valid ~$GITHUB_TOKEN~
  309. #+begin_src emacs-lisp
  310. (use-package forge)
  311. #+end_src
  312. Open the *status* page for the current repository with =SPC g=.
  313. #+begin_src emacs-lisp
  314. (dotfiles/leader
  315. "g" '(magit-status :which-key "Magit"))
  316. #+end_src
  317. *** Terminal emulation
  318. While not a traditional terminal emulator, =eshell= provides me with all of the functionality I expect and require from one. Some users may be left wanting more, I would recommend they look into =vterm=.
  319. https://github.com/zwild/eshell-prompt-extras
  320. + Enable lambda shell prompt
  321. #+begin_src emacs-lisp
  322. (use-package eshell-prompt-extras
  323. :config (setq eshell-highlight-prompt nil
  324. eshell-prompt-function 'epe-theme-lambda))
  325. #+end_src
  326. Open an =eshell= buffer with =SPC e=.
  327. #+begin_src emacs-lisp
  328. (dotfiles/leader
  329. "e" '(eshell :which-key "Shell"))
  330. #+end_src
  331. *** File management
  332. Emacs' can feel more modern when icon-fonts are installed and prioritized. I feel that this makes navigation of folders much faster, given that file types may be quickly identified by their corresponding icons.
  333. https://github.com/domtronn/all-the-icons.el
  334. + Collects various icon fonts
  335. #+begin_src emacs-lisp
  336. (use-package all-the-icons)
  337. #+end_src
  338. https://github.com/jtbm37/all-the-icons-dired
  339. + Integration with dired
  340. #+begin_src emacs-lisp
  341. (use-package all-the-icons-dired
  342. :hook (dired-mode . all-the-icons-dired-mode))
  343. #+end_src
  344. When opening =dired=, I don't want to have to press =RET= twice to navigate to the current directory. This can be avoided with ~dired-jump~, included in the =dired-x= package shipped with =dired=.
  345. #+begin_src emacs-lisp
  346. (require 'dired-x)
  347. #+end_src
  348. By default =dired= will create a new buffer everytime you press =RET= over a directory. In my workflow this leads to many unwanted =dired= buffers that have to be cleaned up manually. [[https://github.com/crocket/dired-single][Dired-single]] lets us reuse the same dired buffer.
  349. + Move up a directory with =h=
  350. + Open a single buffer with =l=
  351. #+begin_src emacs-lisp
  352. (use-package dired-single
  353. :config
  354. (evil-collection-define-key 'normal 'dired-mode-map
  355. "h" 'dired-single-up-directory
  356. "l" 'dired-single-buffer))
  357. #+end_src
  358. Open a dired buffer with =SPC d=.
  359. #+begin_src emacs-lisp
  360. (dotfiles/leader
  361. "d" '(dired-jump :which-key "Dired"))
  362. #+end_src
  363. ** Desktop
  364. :PROPERTIES:
  365. :header-args: :tangle ~/.local/source/dotfiles/modules/desktop.el :results silent
  366. :END:
  367. I use Emacs as a Desktop Environment with the [[https://github.com/ch11ng/exwm][exwm]] package. It allows Emacs to function as a complete tiling window manager for =X11=. My workflow includes launching the window manager with =xinitrc=, without the use of a display manager, controlling *everything* within Emacs.
  368. #+begin_src conf :tangle ~/.local/source/dotfiles/config/xinitrc
  369. exec dbus-launch --exit-with-session emacs -mm --debug-init
  370. #+end_src
  371. When launching into a session, if the display server is not running then =startx= should be invoked, to run the window manager. Anything that needs to be included in the ~$PATH~ should occur before the end of this file.
  372. #+begin_src sh :tangle ~/.local/source/dotfiles/config/profile
  373. GOPATH="$HOME/.go/"
  374. export GOPATH
  375. if [ -d "$GOPATH/bin" ]; then
  376. PATH="$GOPATH/bin:$PATH"
  377. fi
  378. if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then
  379. exec startx
  380. fi
  381. #+end_src
  382. Define a method to run an external process, allowing us to launch any application on a new process without interferring with Emacs.
  383. #+begin_src emacs-lisp
  384. (defun dotfiles/run (command)
  385. "Run an external process."
  386. (interactive (list (read-shell-command "λ ")))
  387. (start-process-shell-command command nil command))
  388. #+end_src
  389. Some methods must be called and applied to the current call process in order to function correctly with Emacs hooks.
  390. #+begin_src emacs-lisp
  391. (defun dotfiles/run-in-background (command)
  392. (let ((command-parts (split-string command "[ ]+")))
  393. (apply #'call-process `(,(car command-parts) nil 0 nil ,@(cdr command-parts)))))
  394. #+end_src
  395. Place keybindings for executing shell commands behind =SPC x=.
  396. + Run with =x=
  397. + Run in backround with =g=
  398. + Run asynchronously with =z=
  399. #+begin_src emacs-lisp
  400. (dotfiles/leader
  401. "x" '(:ignore t :which-key "Execute")
  402. "xx" '(dotfiles/run :which-key "Run")
  403. "xb" '(dotfiles/run-in-background :which-key "Run (background)")
  404. "xz" '(async-shell-command :which-key "Async"))
  405. #+end_src
  406. When the window manager first launches the ~init-hook~ will be called, this allows us to define some custom logic when it's initialized.
  407. + Display time and date
  408. + Display battery info (if available)
  409. In my personal configuration, I do not want the battery or time displayed within Emacs when it's not running as desktop environment because that information is typically already available.
  410. #+begin_src emacs-lisp
  411. (defun dotfiles/init-hook ()
  412. (exwm-workspace-switch-create 1)
  413. (setq display-time-and-date t)
  414. (display-battery-mode 1)
  415. (display-time-mode 1))
  416. #+end_src
  417. Using =autorandr= with pre configured profiles, switching screens (AKA hot plugging) is also handled through a hook.
  418. #+begin_src emacs-lisp
  419. (defun dotfiles/update-display ()
  420. (dotfiles/run-in-background "autorandr --change --force"))
  421. #+end_src
  422. Finally we configure the window manager.
  423. + Enable =randr= support
  424. Connect our custom hooks and configure the input keys, a custom layer for defining which keys are captured by Emacs, and which are passed through to =X= applications.
  425. + Pass through to Emacs
  426. + =M-x= to Emacs
  427. + =C-g= to Emacs
  428. + =C-SPC= to Emacs
  429. + Bindings with =S= (Super / Win)
  430. + Reset =S-r=
  431. + Launch =S-&=
  432. + Workspace =S-[1..9]=
  433. #+begin_src emacs-lisp
  434. (use-package exwm
  435. :config
  436. (require 'exwm-randr)
  437. (exwm-randr-enable)
  438. (add-hook 'exwm-init-hook #'dotfiles/init-hook)
  439. (add-hook 'exwm-randr-screen-change-hook #'dotfiles/update-display)
  440. (dotfiles/update-display)
  441. (setq exwm-input-prefix-keys
  442. '(?\M-x
  443. ?\C-g
  444. ?\C-\ )
  445. exwm-input-global-keys
  446. `(([?\s-r] . exwm-reset)
  447. ([?\s-&] . dotfiles/run)
  448. ,@(mapcar (lambda (i)
  449. `(,(kbd (format "s-%d" i)) .
  450. (lambda ()
  451. (interactive)
  452. (exwm-workspace-switch-create ,i))))
  453. (number-sequence 1 9))))
  454. (exwm-enable))
  455. #+end_src
  456. ** Writing
  457. :PROPERTIES:
  458. :header-args: :tangle ~/.local/source/dotfiles/modules/writing.el :results silent
  459. :END:
  460. I am using [[https://orgmode.org][Org-mode]] extensively for writing projects for different purposes. Improvements beyond what are required for my Literate Programming platform include:
  461. [[https://github.com/integral-dw/org-superstar-mode][Org-superstar-mode]] for making headline stars more *super*.
  462. #+begin_src emacs-lisp
  463. (use-package org-superstar
  464. :hook (org-mode . org-superstar-mode))
  465. #+end_src
  466. *** Mail
  467. Plain text email delivered via mu, mu4e and mbsync. I run my own email server, so your configuration may differ from mine. This is the ~mbsyncrc~ file I use to synchronize my local mail with my server. This is required for mu4e in Emacs.
  468. #+begin_src conf :tangle ~/.local/source/dotfiles/config/mbsyncrc
  469. IMAPStore xyz-remote
  470. Host mail.chrishayward.xyz
  471. User chris@chrishayward.xyz
  472. PassCmd "pass chrishayward.xyz/chris"
  473. SSLType IMAPS
  474. MaildirStore xyz-local
  475. Path ~/.cache/mail/
  476. Inbox ~/.cache/mail/inbox
  477. SubFolders Verbatim
  478. Channel xyz
  479. Master :xyz-remote:
  480. Slave :xyz-local:
  481. Patterns * !Archives
  482. Create Both
  483. Expunge Both
  484. SyncState *
  485. #+end_src
  486. The system typically expects to find this file at ~$HOME/.mbsyncrc~, but you may also specify a custom path if launching the command using arguments. I chose to symlink the default location to my repository.
  487. #+begin_src shell :tangle no
  488. mbsync -a
  489. mu index --maildir="~/.cache/mail"
  490. #+end_src
  491. Once the mail is being synchronized, and the mail has been indexed with =mu=, it's time to install the required packages for Emacs.
  492. #+begin_src emacs-lisp
  493. (use-package mu4e
  494. :load-path "/usr/share/emacs/site-lisp/mu4e"
  495. :config
  496. (setq mu4e-change-filenames-when-moving t
  497. mu4e-update-interval (* 5 60) ;; Every 5 minutes.
  498. mu4e-get-mail-command "mbsync -a"
  499. mu4e-maildir "~/.cache/mail"
  500. mu4e-compose-signature
  501. (concat "Chris Hayward\n"
  502. "https://chrishayward.xyz\n"))
  503. ;; Ensure plain text scales for all devices.
  504. (setq mu4e-compose-format-flowed t)
  505. ;; GPG signing key for outbound mail.
  506. (setq mml-secure-openpgp-signers '("37AB1CB72B741E478CA026D43025DCBD46F81C0F"))
  507. (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime)
  508. (setq message-send-mail-function 'smtpmail-send-it)
  509. ;; Configure mail account(s).
  510. (setq mu4e-contexts
  511. (list
  512. ;; Main
  513. ;; chris@chrishayward.xyz
  514. (make-mu4e-context
  515. :name "Main"
  516. :match-func
  517. (lambda (msg)
  518. (when msg
  519. (string-prefix-p "/Main" (mu4e-message-field msg :maildir))))
  520. :vars
  521. '((user-full-name . "Christopher James Hayward")
  522. (user-mail-address . "chris@chrishayward.xyz")
  523. (smtpmail-smtp-server . "mail.chrishayward.xyz")
  524. (smtpmail-smtp-service . 587)
  525. (smtpmail-stream-type . starttls))))))
  526. #+end_src
  527. Create a keybinding to open the mail dashboard with =SPC m=.
  528. #+begin_src emacs-lisp
  529. (dotfiles/leader
  530. "m" '(mu4e :which-key "Mail"))
  531. #+end_src
  532. *** Brain
  533. [[https://github.com/org-roam/org-roam][Org-roam]] is a rudimentary roam replica built on =Org mode=.
  534. #+begin_src emacs-lisp
  535. (use-package org-roam
  536. :hook (after-init . org-roam-mode)
  537. :custom (org-roam-directory dotfiles/brain))
  538. #+end_src
  539. [[https://github.com/org-roam/org-roam-server][Org-roam-server]] is a web application that visualizes the =Org roam= database, available when Emacs' running at [[http://localhost:8080][localhost:8080]].
  540. #+begin_src emacs-lisp
  541. (use-package org-roam-server
  542. :hook (org-roam-mode . org-roam-server-mode))
  543. #+end_src
  544. Configure keybindings behind =SPC r=.
  545. + Find with =f=
  546. + Buffer with =b=
  547. + Capture with =c=
  548. + Dailies with =d=
  549. #+begin_src emacs-lisp
  550. (dotfiles/leader
  551. "r" '(:ignore t :which-key "Roam")
  552. "rf" '(org-roam-find-file :which-key "Find")
  553. "rb" '(org-roam-buffer-toggle-display :which-key "Buffer")
  554. "rc" '(org-roam-capture :which-key "Capture")
  555. "rd" '(:ignore t :which-key "Dailies")
  556. "rdd" '(org-roam-dailies-find-date :which-key "Date")
  557. "rdt" '(org-roam-dailies-find-today :which-key "Today")
  558. "rdm" '(org-roam-dailies-find-tomorrow :which-key "Tomorrow")
  559. "rdy" '(org-roam-dailies-find-yesterday :which-key "Yesterday"))
  560. #+end_src
  561. Configure the default capture template for new topics.
  562. #+begin_src emacs-lisp
  563. (setq org-roam-capture-templates
  564. '(("d" "Default" plain (function org-roam-capture--get-point)
  565. "%?"
  566. :file-name "${slug}"
  567. :head "#+TITLE: ${title}\n"
  568. :unnarrowed t)))
  569. #+end_src
  570. Configure the default capture template for daily entries.
  571. #+begin_src emacs-lisp
  572. (setq org-roam-dailies-capture-templates
  573. '(("d" "Default" entry (function org-roam-capture--get-point)
  574. "* %?"
  575. :file-name "daily/%<%Y-%m-%d>"
  576. :head "#+TITLE: %<%Y-%m-%d>\n")))
  577. #+end_src
  578. *** Notes
  579. #+begin_src emacs-lisp
  580. (use-package org-noter
  581. :after org
  582. :config
  583. (setq org-noter-always-create-frame nil
  584. org-noter-notes-search-path dotfiles/notes))
  585. #+end_src
  586. #+begin_src emacs-lisp
  587. (use-package org-pdftools
  588. :hook (org-mode . org-pdftools-setup-link))
  589. #+end_src
  590. #+begin_src emacs-lisp
  591. (use-package org-noter-pdftools
  592. :after org-noter
  593. :config
  594. (with-eval-after-load 'pdf-annot
  595. (add-hook 'pdf-annot-active-handler-functions #'org-noter-pdftools-jump-to-note)))
  596. #+end_src
  597. #+begin_src emacs-lisp
  598. (setq bibtex-completion-notes-path dotfiles/notes
  599. bibtex-completion-bibliography dotfiles/bib
  600. bibtex-completion-pdf-field "file"
  601. bibtex-completion-notes-template-multiple-files
  602. (concat
  603. "#+TITLE: ${title}\n"
  604. "#+ROAM_KEY: cite:${=key=}\n"
  605. "#* TODO Notes\n"
  606. ":PROPERTIES:\n"
  607. ":CUSTOM_ID: ${=key}\n"
  608. ":NOTER_DOCUMENT: %(orb-process-file-field \"${=key=}\")\n"
  609. ":AUTHOR: ${author-abbrev}\n"
  610. ":JOURNAL: ${journaltitle}\n"
  611. ":DATE: ${date}\n"
  612. ":YEAR: ${year}\n"
  613. ":DOI: ${doi}\n"
  614. ":URL: ${url}\n"
  615. ":END:\n\n"))
  616. #+end_src
  617. #+begin_src emacs-lisp
  618. (use-package org-ref
  619. :config
  620. (setq org-ref-completion-library 'org-ref-helm-cite
  621. org-ref-get-pdf-filename-function 'org-ref-get-pdf-filename-helm-bibtex
  622. org-ref-default-bibliography dotfiles/bib
  623. org-ref-bibliography-notes dotfiles/notes
  624. org-ref-notes-directory dotfiles/notes
  625. org-ref-notes-function 'orb-edit-notes
  626. org-ref-note-title-format "* TODO %y - %t\n
  627. :PROPERTIES:\n
  628. :CUSTOM_ID: %k\n
  629. :NOTER_DOCUMENT: %F\n
  630. :ROAM_KEY: cite:%k\n
  631. :AUTHOR: %9a\n
  632. :JOURNAL: %j\n
  633. :YEAR: %y\n
  634. :VOLUME: %v\n
  635. :PAGES: %p\n
  636. :DOI: %D\n
  637. :URL: %U\n
  638. :END:\n\n"))
  639. #+end_src
  640. #+begin_src emacs-lisp
  641. (use-package org-roam-bibtex
  642. :after (org-roam)
  643. :hook (org-roam-mode . org-roam-bibtex-mode)
  644. :config
  645. (setq orb-preformat-keywords
  646. '("=key=" "title" "url" "file" "author-or-editor" "keywords")))
  647. #+end_src
  648. #+begin_src emacs-lisp
  649. (add-to-list 'org-roam-capture-templates
  650. '("n" "Notes" plain (function org-roam-capture--get-point)
  651. ""
  652. :file-name "notes/${slug}"
  653. :head "#+TITLE: ${=key=}: ${title}\n\n
  654. #+ROAM_KEY:${ref}\n\n* ${title}\n
  655. :PROPERTIES:\n
  656. :CUSTOM_ID: ${=key=}\n
  657. :URL: ${url}\n
  658. :AUTHOR: ${author-or-editor}\n
  659. :NOTER_DOCUMENT:%(orb-process-file-field \"${=key=}\")\n
  660. :NOTER_PAGE:\n
  661. :END:\n\n"))
  662. #+end_src
  663. *** Agenda
  664. Configure agenda sources.
  665. + Dailies ~~/.local/source/brain/daily/~
  666. + Secrets ~~/.local/source/secrets/org/~
  667. #+begin_src emacs-lisp
  668. (setq org-agenda-files '("~/.local/source/brain/daily/"
  669. "~/.local/source/secrets/org/"))
  670. #+end_src
  671. Open an agenda buffer with =SPC a=.
  672. #+begin_src emacs-lisp
  673. (dotfiles/leader
  674. "a" '(org-agenda :which-key "Agenda"))
  675. #+end_src
  676. *** Blogging
  677. I use [[https://gohugo.io][Hugo]] for my personal [[https://chrishayward.xyz][website]], which I write in =Org-mode= before compiling to =hugo-markdown=.
  678. [[https://github.com/kaushalmodi/ox-hugo][Ox-hugo]], configured for =one-post-per-file= is my technique for managing my blog.
  679. #+begin_src emacs-lisp
  680. (use-package ox-hugo
  681. :after ox)
  682. #+end_src
  683. Creaate a capture template for blog posts in the =posts= sub directory.
  684. #+begin_src emacs-lisp
  685. (add-to-list 'org-roam-capture-templates
  686. '("b" "Blogging" plain (function org-roam-capture--get-point)
  687. "%?"
  688. :file-name "posts/${slug}"
  689. :head "#+TITLE: ${title}\n
  690. #+HUGO_BASE_DIR: ~/.local/source/website\n
  691. #+HUGO_SECTION: posts\n"))
  692. #+end_src
  693. *** Screencasts
  694. Create screencasts with =one-frame-per-action= GIF recording via [[https://github.com/takaxp/emacs-gif-screencast][emacs-gif-screencast]].
  695. + Can be paused / resumed
  696. + High quality images
  697. + Optimized size
  698. It requires the installation of ~scrot~ and ~convert~ from the =ImageMagick= library.
  699. #+begin_src emacs-lisp
  700. (use-package gif-screencast
  701. :custom
  702. (gif-screencast-output-directory (concat dotfiles/brain "screens/")))
  703. #+end_src
  704. Screencast controls behind =SPC s=.
  705. + Start / stop with =s=
  706. + Pause with =t=
  707. #+begin_src emacs-lisp
  708. (dotfiles/leader
  709. "s" '(:ignore t :which-key "Screencast")
  710. "ss" '(gif-screencast-start-or-stop :which-key "Start / Stop")
  711. "sp" '(gif-screencast-toggle-pause :which-key "Pause"))
  712. #+end_src
  713. *** Presentations
  714. Produce high quality presentations that work anywhere with =HTML/JS= and the [[https://revealjs.com][Reveal.js]] package.
  715. [[https://github.com/hexmode/ox-reveal][Ox-reveal]], configured to use a =cdn= allows us to produce ones that are not dependent on a local version of =Reveal.js=.
  716. #+begin_src emacs-lisp
  717. (use-package ox-reveal
  718. :after ox
  719. :custom (org-reveal-root "https://cdn.jsdelivr.net/reveal.js/3.9.2/"))
  720. #+end_src
  721. Create a capture template for presentations stored in the =slides= sub directory.
  722. #+begin_src emacs-lisp
  723. (add-to-list 'org-roam-capture-templates
  724. '("p" "Presentation" plain (function org-roam-capture--get-point)
  725. "%?"
  726. :file-name "slides/${slug}"
  727. :head "#+TITLE: ${title}\n"))
  728. #+end_src
  729. ** Projects
  730. :PROPERTIES:
  731. :header-args: :tangle ~/.local/source/dotfiles/modules/projects.el :results silent
  732. :END:
  733. An IDE like experience (or better) can be achieved in Emacs using two *Microsoft* open source initiatives.
  734. Turn Emacs into an *IDE* (or better) with the [[https://microsoft.github.io/language-server-protocol/][Language Server Protocol]], an open source initiative from *Microsoft* for the *VSCode* editor.
  735. [[https://emacs-lsp.github.io/lsp-mode/][Lsp-mode]] brings support for language servers into Emacs.
  736. #+begin_src emacs-lisp
  737. (use-package lsp-mode
  738. :custom (gc-cons-threshold 1000000000)
  739. (lsp-idle-delay 0.500))
  740. #+end_src
  741. https://emacs-lsp.github.io/lsp-ui/
  742. + UI improvements for =lsp-mode=
  743. #+begin_src emacs-lisp
  744. (use-package lsp-ui
  745. :custom (lsp-ui-doc-position 'at-point)
  746. (lsp-ui-doc-delay 0.500))
  747. #+end_src
  748. *** Management
  749. Configure [[https://projectile.mx][projectile]], a project interaction library for Emacs. It provides a nice set of features for operating on a project level without introducing external dependencies.
  750. #+begin_src emacs-lisp
  751. (use-package projectile
  752. :config
  753. (setq projectile-project-search-path '("~/.local/source"))
  754. (projectile-mode))
  755. #+end_src
  756. *** Passwords
  757. Pass makes managing passwords extremely easy, encrypring them in a file structure and providing easy commands for generating, modify, and copying passwords. =password-store.el= provides a wrapper for the functionality within Emacs.
  758. #+begin_src emacs-lisp
  759. (use-package password-store
  760. :custom (password-store-dir dotfiles/passwords))
  761. #+end_src
  762. Configure keybindings behind =SPC p=.
  763. + Copy with =p=
  764. + Rename with =r=
  765. + Generate with =g=
  766. #+begin_src emacs-lisp
  767. (dotfiles/leader
  768. "p" '(:ignore t :which-key "Passwords")
  769. "pp" '(password-store-copy :which-key "Copy")
  770. "pr" '(password-store-rename :which-key "Rename")
  771. "pg" '(password-store-generate :which-key "Generate"))
  772. #+end_src
  773. *** Debugging
  774. Handled through the [[https://microsoft.github.io/debug-adapter-protocol/][Debug Adapter Protocol]], an open source initiative from *Microsoft* for the *VSCode* editor.
  775. [[https://emacs-lsp.github.io/dap-mode/][Dap-mode]] adds support for the protocol to Emacs.
  776. #+begin_src emacs-lisp
  777. (use-package dap-mode)
  778. #+end_src
  779. *** Completion
  780. Text completion framework via =company= aka *Complete Anything*.
  781. http://company-mode.github.io/
  782. + Integrate with =lsp-mode=
  783. #+begin_src emacs-lisp
  784. (use-package company)
  785. (use-package company-lsp)
  786. #+end_src
  787. *** Languages
  788. Support for individual languages are implemented here.
  789. **** C/C++
  790. Full *IDE* experience for Python within Emacs.
  791. + Completion, jumps via =lsp-mode=
  792. + Debugging via =dap-mode=
  793. Install the =ccls= language server.
  794. + https://github.com/MaskRay/ccls
  795. #+begin_src emacs-lisp
  796. (use-package ccls
  797. :hook ((c-mode c++-mode objc-mode cuda-mode) .
  798. (lambda () (require 'ccls) (lsp))))
  799. #+end_src
  800. **** Python
  801. Full *IDE* experience for Python within Emacs.
  802. + Completion, jumps via =lsp-mode=
  803. + Debugging via =dap-mode=
  804. Install the =pyls= language server.
  805. #+begin_src shell :tangle no
  806. pip install --user "python-language-server[all]"
  807. #+end_src
  808. https://www.emacswiki.org/emacs/PythonProgrammingInEmacs
  809. + Built in mode
  810. #+begin_src emacs-lisp
  811. (use-package python-mode
  812. :hook (python-mode . lsp)
  813. :config (require 'dap-python)
  814. :custom (python-shell-interpreter "python3") ;; Required if "python" is not python 3.
  815. (dap-python-executable "python3") ;; Same as above.
  816. (dap-python-debugger 'debugpy))
  817. #+end_src
  818. **** Go
  819. Full *IDE* experience for Rust within Emacs.
  820. + Completion via =lsp-mode=
  821. + Debugging via =dap-mode=
  822. Install the =gopls= language server.
  823. #+begin_src sh :tangle no
  824. GO111MODULE=on go get golang.org/x/tools/gopls@latest
  825. #+end_src
  826. Set the ~GOPATH~ environment variable prior to loading, this allows us to change the default value of ~$HOME/go~ to ~$HOME/.go~.
  827. #+begin_src emacs-lisp
  828. (setenv "GOPATH" (concat (getenv "HOME") "/.go/"))
  829. #+end_src
  830. Additionally, include the =bin= subdirectory of the ~$GOPATH~ in the ~$PATH~ variable, adding compiled golang programs.
  831. #+begin_src emacs-lisp
  832. (use-package go-mode
  833. :hook (go-mode . lsp))
  834. #+end_src
  835. Apply some custom behaviour before saving:
  836. + Format buffer
  837. + Organize imports
  838. #+begin_src emacs-lisp
  839. (defun dotfiles/go-hook ()
  840. (add-hook 'before-save-hook #'lsp-format-buffer t t)
  841. (add-hook 'before-save-hook #'lsp-organize-imports t t))
  842. #+end_src
  843. #+begin_src emacs-lisp
  844. (add-hook 'go-mode-hook #'dotfiles/go-hook)
  845. #+end_src
  846. ** Interface
  847. :PROPERTIES:
  848. :header-args: :tangle ~/.local/source/dotfiles/modules/interface.el :results silent
  849. :END:
  850. *Bring Emacs out of the eighties*
  851. *** Fonts
  852. Configure the system font with a single ~font-family~ and define the size, of which variations to the font size are relative to this value.
  853. #+begin_src emacs-lisp
  854. (defvar dotfiles/font "Fira Code")
  855. (defvar dotfiles/font-size 96)
  856. #+end_src
  857. Write out to all *3* of Emacs' default font faces.
  858. #+begin_src emacs-lisp
  859. (set-face-attribute 'default nil :font dotfiles/font :height dotfiles/font-size)
  860. (set-face-attribute 'fixed-pitch nil :font dotfiles/font :height dotfiles/font-size)
  861. (set-face-attribute 'variable-pitch nil :font dotfiles/font :height dotfiles/font-size)
  862. #+end_src
  863. Define a transient keybinding for scaling the text.
  864. #+begin_src emacs-lisp
  865. (defhydra hydra-text-scale (:timeout 4)
  866. "Scale"
  867. ("j" text-scale-increase "Increase")
  868. ("k" text-scale-decrease "Decrease")
  869. ("f" nil "Finished" :exit t))
  870. #+end_src
  871. Increase the font size in buffers with =SPC t f=.
  872. + Increase =j=
  873. + Decrease =k=
  874. + Finish =f=
  875. #+begin_src emacs-lisp
  876. (dotfiles/leader
  877. "tf" '(hydra-text-scale/body :which-key "Font"))
  878. #+end_src
  879. *** Lines
  880. Relative line numbers are important when using =VI= emulation keys. You can prefix most commands with a *number*, allowing you to jump up / down by a line count.
  881. #+begin_example
  882. 5:
  883. 4:
  884. 3:
  885. 2:
  886. 1:
  887. 156: << CURRENT LINE >>
  888. 1:
  889. 2:
  890. 3:
  891. 4:
  892. 5:
  893. #+end_example
  894. https://github.com/emacsmirror/linum-relative
  895. + Integrate with ~display-line-numbers-mode~ for performance
  896. #+begin_src emacs-lisp
  897. (use-package linum-relative
  898. :init (setq linum-relative-backend
  899. 'display-line-numbers-mode)
  900. :config (linum-relative-global-mode))
  901. #+end_src
  902. Add line numbers to the toggles behind =SPC t l=.
  903. #+begin_src emacs-lisp
  904. (dotfiles/leader
  905. "tl" '(linum-relative-global-mode :which-key "Lines"))
  906. #+end_src
  907. https://github.com/Fanael/rainbow-delimiters
  908. + Colourize nested parenthesis
  909. #+begin_src emacs-lisp
  910. (use-package rainbow-delimiters
  911. :hook (prog-mode . rainbow-delimiters-mode))
  912. #+end_src
  913. *** Themes
  914. Cherry pick a few modules from =doom-emacs=. High quality and modern colour themes are provided in the [[https://github.com/hlissner/emacs-doom-themes][doom-themes]] package.
  915. #+begin_src emacs-lisp
  916. (use-package doom-themes
  917. :init (load-theme 'doom-moonlight t))
  918. #+end_src
  919. [[https://github.com/seagle0128/doom-modeline][doom-modeline]] provides an elegant status bar / modeline.
  920. #+begin_src emacs-lisp
  921. (use-package doom-modeline
  922. :init (doom-modeline-mode 1)
  923. :custom ((doom-modeline-height 16)))
  924. #+end_src
  925. Load a theme with =SPC t t=.
  926. #+begin_src emacs-lisp
  927. (dotfiles/leader
  928. "tt" '(load-theme t t :which-key "Theme"))
  929. #+end_src
  930. *** Ligatures
  931. Enable font ligatures via [[https://github.com/jming422/fira-code-mode][fira-code-mode]], perform this action *only* when ~Fira Code~ is set as the current font.
  932. #+begin_src emacs-lisp
  933. ;; (use-package fira-code-mode
  934. ;; :config
  935. ;; (global-fira-code-mode))
  936. #+end_src
  937. #+begin_src emacs-lisp
  938. ;; (use-package fira-code-mode
  939. ;; :hook prog-mode)
  940. #+end_src
  941. *** Dashboard
  942. Present a dashboard when first launching Emacs.
  943. #+begin_src emacs-lisp
  944. (use-package dashboard
  945. :config
  946. (setq dashboard-center-content t
  947. dashboard-set-init-info t
  948. dashboard-set-file-icons t
  949. dashboard-set-heading-icons t
  950. dashboard-startup-banner 'logo
  951. dashboard-projects-backend 'projectile
  952. dashboard-items '((projects . 5)
  953. (recents . 5)
  954. (agenda . 5 )))
  955. (dashboard-setup-startup-hook))
  956. #+end_src
  957. When running in *daemon* mode, ensure that the dashboard is the initial buffer.
  958. #+begin_src emacs-lisp
  959. (setq initial-buffer-choice
  960. (lambda ()
  961. (get-buffer "*dashboard*")))
  962. #+end_src