Skip to content

Latest commit

 

History

History
2934 lines (2493 loc) · 81.1 KB

init.el.org

File metadata and controls

2934 lines (2493 loc) · 81.1 KB

init.el

;;; init.el --- My Emacs configuration. -*- lexical-binding: t; -*-

Emacs native compiler

Compile Elisp to native machine code.

(setq comp-num-cpus 4)
(setq comp-deferred-compilation t)

Whether to report warnings and errors from asynchronous native compilation.

(setq native-comp-async-report-warnings-errors nil)

Process output

Maximum number of bytes to read from subprocess in a single chunk.

Enlarge the value only if the subprocess generates very large (megabytes) amounts of data in one go.

(setq read-process-output-max (* 1024 1024))

Language & Encoding

Add UTF8 at the front of the priority list for automatic detection.

(prefer-coding-system 'utf-8)

Set up multilingual environment to use UTF-8.

(set-language-environment "UTF-8")

Set default value of various coding systems to UTF-8.

(set-default-coding-systems 'utf-8)

Transparency

(set-frame-parameter (selected-frame) 'alpha '(85 50))
(add-to-list 'default-frame-alist '(alpha 85 50))

Fonts

(defun set-font-laptop ()
  "Set the default font for use without external monitor."
  (interactive)
  (set-frame-font "Inconsolata-14" nil t))

(defun set-font-monitor ()
  "Set the default font for use with external monitor."
  (interactive)
  (set-frame-font "Inconsolata-12" nil t))

Use package

Bootstrap use-package.

(require 'package)
(unless (package-installed-p 'use-package)
  (package-refresh-contents)
  (package-install 'use-package))

Report details about loading and configuration.

(setq use-package-verbose t)

Always ensure packages are installed when running on a non-guix system.

(unless (file-exists-p "/gnu/store")
  (require 'use-package-ensure)
  (setq use-package-always-ensure t))

External Monitor

(defvar my-external-monitor "DP-1"
  "The name of the external monitor.")

(defun monitor-connected-p (monitor)
  "Return t if MONITOR is connected, otherwise nil."
  (not (string= "" (shell-command-to-string (format "xrandr --listmonitors | grep %s" monitor)))))

Abbrev mode

(use-package abbrev
  :diminish
  :hook ((text-mode prog-mode) . abbrev-mode)
  :custom
  ;; Set the name of file from which to read abbrevs.
  (abbrev-file-name "~/.emacs.d/abbrev_defs")
  ;; Silently save word abbrevs too when files are saved.
  (save-abbrevs 'silently))

Aide.el

(use-package aide
  :commands (aide-openai-completion-region-insert)
  :load-path ("~/workspace/aide.el"))

Aio

(use-package aio
  :defer t)

Ansi Color

Colorize the current buffer. See: Stack Overflow

(defun colorize-current-buffer ()
  (interactive)
  (require 'ansi-color)
  (let ((inhibit-read-only t))
    (ansi-color-apply-on-region (point-min) (point-max))))

Auto revert mode

Reload files when they change on disk.

(use-package autorevert
  :config
  (global-auto-revert-mode t))

Calendar

The calendar and diary by default display times of day in the conventional American style with the hours from 1 through 12, minutes, and either ‘am’ or ‘pm’. If you prefer the European style, also known in the US as military, in which the hours go from 00 to 23, you can alter the variable calendar-time-display-form. This variable is a list of expressions that can involve the variables 12-hours, 24-hours, and minutes, which are all numbers in string form, and am-pm and time-zone, which are both alphabetic strings.

(setq calendar-time-display-form
      '(24-hours ":" minutes
                 (if time-zone " (") time-zone (if time-zone ")")))

Cask

(use-package cask
  :disabled)

ChatGPT

Use ChatGPT inside Emacs

This Emacs Code extension allows you to use the official OpenAI API to generate code or natural language responses from OpenAI’s ChatGPT to your questions, right within the editor.

(use-package chatgpt
  :commands (chatgpt chatgpt-new))

Custom functions

Load a file only if it exists.

(defun load-if-exists (file)
  "Load `file` if it exists."
  (when (file-exists-p file)
    (load file)))

Indent the whole buffer.

(defun indent-buffer ()
  "Indent the whole buffer."
  (interactive)
  (if (and (fboundp 'eglot-managed-p)
           (eglot-managed-p))
      (eglot-format-buffer)
    (indent-region (point-min) (point-max))))

Remove all tabs from the current buffer.

(defun untabify-buffer ()
  "Remove all tabs from the current buffer."
  (interactive)
  (untabify (point-min) (point-max)))

Cleanup the current buffer.

(defun cleanup-buffer ()
  "Cleanup the current buffer."
  (interactive)
  (indent-buffer)
  (delete-trailing-whitespace))

Find file as root.

(defun sudo-edit (&optional arg)
  (interactive "p")
  (if (or arg (not buffer-file-name))
      (find-file (concat "/sudo:root@localhost:" (read-file-name "File: ")))
    (find-alternate-file (concat "/sudo:root@localhost:" buffer-file-name))))

Swap two buffers.

(defun swap-buffers ()
  "Swap your buffers."
  (interactive)
  (cond ((not (> (count-windows)1))
         (message "You can't rotate a single window!"))
        (t
         (setq i 1)
         (setq numWindows (count-windows))
         (while  (< i numWindows)
           (let* ((w1 (elt (window-list) i))
                  (w2 (elt (window-list) (+ (% i numWindows) 1)))
                  (b1 (window-buffer w1))
                  (b2 (window-buffer w2))
                  (s1 (window-start w1))
                  (s2 (window-start w2)))
             (set-window-buffer w1  b2)
             (set-window-buffer w2 b1)
             (set-window-start w1 s2)
             (set-window-start w2 s1)
             (setq i (1+ i)))))))

Rotate two buffers.

(defun rotate-buffers ()
  "Rotate your buffers."
  (interactive)
  (if (= (count-windows) 2)
      (let* ((this-win-buffer (window-buffer))
             (next-win-buffer (window-buffer (next-window)))
             (this-win-edges (window-edges (selected-window)))
             (next-win-edges (window-edges (next-window)))
             (this-win-2nd (not (and (<= (car this-win-edges)
                                         (car next-win-edges))
                                     (<= (cadr this-win-edges)
                                         (cadr next-win-edges)))))
             (splitter
              (if (= (car this-win-edges)
                     (car (window-edges (next-window))))
                  'split-window-horizontally
                'split-window-vertically)))
        (delete-other-windows)
        (let ((first-win (selected-window)))
          (funcall splitter)
          (if this-win-2nd (other-window 1))
          (set-window-buffer (selected-window) this-win-buffer)
          (set-window-buffer (next-window) next-win-buffer)
          (select-window first-win)
          (if this-win-2nd (other-window 1))))))

Show the face found at the current point.

(defun what-face (pos)
  "Show the face found at the current point."
  (interactive "d")
  (let ((face (or (get-char-property (point) 'read-face-name)
                  (get-char-property (point) 'face))))
    (if face (message "Face: %s" face) (message "No face at %d" pos))))

Reload the ~/.Xresources configuration.

(defun xresources ()
  "Reload the ~/.Xresources configuration."
  (interactive)
  (shell-command "xrdb -merge ~/.Xresources ")
  (message "X resources reloaded."))

Insert a Clojure UUID.

(defun insert-clj-uuid (n)
  "Insert a Clojure UUID tagged literal in the form of #uuid
  \"11111111-1111-1111-1111-111111111111\". The prefix argument N
  specifies the padding used."
  (interactive "P")
  (let ((n (or n 1)))
    (if (or (< n 0) (> n 9))
        (error "Argument N must be between 0 and 9."))
    (let ((n (string-to-char (number-to-string n))))
      (insert
       (format "#uuid \"%s-%s-%s-%s-%s\""
               (make-string 8 n)
               (make-string 4 n)
               (make-string 4 n)
               (make-string 4 n)
               (make-string 12 n))))))

Run the current buffer through zprint.

(defun zprint-buffer ()
  "Run the current buffer through zprint."
  (interactive)
  (shell-command-on-region (point-min) (point-max) "zprint" nil t)
  (goto-char (point-min))
  (deactivate-mark))

Copilot.el

Copilot.el is an Emacs plugin for GitHub Copilot.

(use-package copilot
  :hook ((clojure-mode . copilot-mode)
         (clojure-ts-mode . copilot-mode)
         (clojurec-mode . copilot-mode)
         (clojurescript-mode . copilot-mode)
         (emacs-lisp-mode . copilot-mode)
         (prog-mode . copilot-mode))
  :bind (:map copilot-completion-map
              ("C-<return>" . 'copilot-accept-completion)
              ("M-n" . 'copilot-next-completion)
              ("M-p" . 'copilot-previous-completion)))

Corfu

(use-package corfu
  :bind
  (:map corfu-map
        ("TAB" . corfu-next)
        ([tab] . corfu-next)
        ("C-<tab>" . corfu-previous))
  :custom
  (corfu-cycle t)
  :hook ((after-init . global-corfu-mode)))

Cape

(use-package cape
  :init
  (add-to-list 'completion-at-point-functions #'cape-dabbrev)
  (add-to-list 'completion-at-point-functions #'cape-file)
  (add-to-list 'completion-at-point-functions #'cape-elisp-block)
  (add-to-list 'completion-at-point-functions #'cape-history)
  (add-to-list 'completion-at-point-functions #'cape-keyword)
  (add-to-list 'completion-at-point-functions #'cape-elisp-symbol))

Datomic.el

(use-package datomic
  :commands (datomic)
  :load-path
  ("~/workspace/datomic.el/src"
   "~/workspace/datomic.el/test"))

Docopt.el

(use-package parsec
  :defer t)
(use-package docopt
  :commands docopt
  :load-path
  ("~/workspace/docopt.el/src"
   "~/workspace/docopt.el/test"))

Eldoc

(use-package eldoc
  :diminish
  :hook ((c-mode-common emacs-lisp-mode) . eldoc-mode)
  :custom
  (eldoc-echo-area-display-truncation-message nil)
  (eldoc-echo-area-prefer-doc-buffer t)
  (eldoc-echo-area-use-multiline-p 3))

Eldoc Box

(use-package eldoc-box
  :disabled
  :hook ((eglot-managed-mode . eldoc-box-hover-mode)))

Mac OSX

Make Emacs use the $PATH set up by the user’s shell.

(use-package exec-path-from-shell
  :init
  (setq exec-path-from-shell-variables
        '("CHROME_EXECUTABLE"
          "EDITOR"
          "GOOGLE_APPLICATION_CREDENTIALS"
          "MANPATH"
          "METALS_JAVA_OPTS"
          "METALS_JDK_PATH"
          "NPM_PACKAGES"
          "NUCLI_HOME"
          "NUCLI_PY_FULL"
          "NU_COUNTRY"
          "NU_HOME"
          "PATH"
          "SPARK_HOME"
          "XDG_CONFIG_DIRS"
          "XDG_DATA_DIRS"))
  (exec-path-from-shell-initialize))

This variable describes the behavior of the command key.

(setq mac-option-key-is-meta t)
(setq mac-right-option-modifier nil)

Aggressive Indent Mode

(use-package aggressive-indent
  :disabled t
  :init
  (add-hook 'emacs-lisp-mode-hook #'aggressive-indent-mode)
  (add-hook 'clojure-mode-hook #'aggressive-indent-mode))

Ascii Doc

(use-package adoc-mode
  :mode (("\\.adoc\\'" . adoc-mode)))

Arei

Asynchronous Reliable Extensible IDE for Guile Scheme.

(use-package arei
  :commands (arei))

Avy

(use-package avy
  :bind (("M-j" . avy-goto-char-timer)
         :map isearch-mode-map
         ("C-'" . avy-search)))

Bluetooth

(use-package bluetooth
  :commands bluetooth-list-devices)

BNF Mode

A GNU Emacs major mode for editing BNF grammars.

(use-package bnf-mode
  :mode (("\\.bnf\\'" . bnf-mode)))

Common Lisp Hyper Spec

(use-package clhs
  :init (clhs-setup))

(defun hyperspec-lookup--hyperspec-lookup-eww (orig-fun &rest args)
  (let ((browse-url-browser-function 'eww-browse-url))
    (apply orig-fun args)))

(advice-add 'hyperspec-lookup :around #'hyperspec-lookup--hyperspec-lookup-eww)

Eglot

(use-package eglot
  :hook ((c-mode . eglot-ensure)
         (c++-mode . eglot-ensure)
         (clojure-mode . eglot-ensure)
         (clojure-ts-mode . eglot-ensure)
         (elixir-mode . eglot-ensure)
         (python-mode . eglot-ensure)
         ;; (scala-mode . eglot-ensure)
         ;; (scheme-mode . eglot-ensure)
         )
  :config
  (add-to-list 'eglot-server-programs '(elixir-mode . ("~/workspace/elixir-ls/release/language_server.sh")))
  (add-to-list 'eglot-server-programs '(java-mode . ("~/.emacs.d/share/eclipse.jdt.ls/bin/jdtls")))
  (add-to-list 'eglot-server-programs '(scala-mode . ("metals")))
  ;; (add-to-list 'eglot-server-programs `(scheme-mode . ("guile-lsp-server")))
  ;; (add-hook 'eglot-managed-mode-hook
  ;;           ;; This displays full docs for clojure functions.
  ;;           ;; See https://github.com/joaotavora/eglot/discussions/894
  ;;           #'(lambda ()
  ;;               (setq-local eldoc-documentation-strategy
  ;;                           #'eldoc-documentation-compose

  ;;                           eldoc-echo-area-use-multiline-p
  ;;                           5)))
  :custom
  (eglot-connect-timeout 120)
  (eglot-extend-to-xref t))

Eglot Java

Provides additional Java programming language support for Eglot.

(use-package eglot-java
  :disabled
  :hook ((java-mode . eglot-java-mode)))

EJira

JIRA integration to Emacs org-mode.

(use-package ejira
  :disabled
  :load-path ("~/workspace/ejira")
  :init
  (setq jiralib2-url "https://nubank.atlassian.net"
        jiralib2-auth 'basic
        jiralib2-user-login-name "roman.scherer@nubank.com.br"
        jiralib2-token nil
        ejira-org-directory "~/jira"
        ejira-projects '("STEM")

        ;; Configure JIRA priorities
        ejira-priorities-alist '(("Highest" . ?A)
                                 ("High"    . ?B)
                                 ("Medium"  . ?C)
                                 ("Low"     . ?D)
                                 ("Lowest"  . ?E))

        ;; Map JIRA states to org states.
        ejira-todo-states-alist '(("Unscheduled" . 1)
                                  ("Groomed" . 2)
                                  ("Ready For Development" . 3)
                                  ("In Development" . 4)
                                  ("Ready For Review" . 5)
                                  ("Ready For Deploy" . 6)
                                  ("Done" . 7))

        ;; Set the highest/lowest org priorities
        org-priority-highest ?A
        org-priority-lowest ?E)
  :config
  ;; Tries to auto-set custom fields by looking into /editmeta
  ;; of an issue and an epic.
  (add-hook 'jiralib2-post-login-hook #'ejira-guess-epic-sprint-fields)

  ;; They can also be set manually if autoconfigure is not used.
  ;; (setq ejira-sprint-field       'customfield_10001
  ;;       ejira-epic-field         'customfield_10002
  ;;       ejira-epic-summary-field 'customfield_10004)

  (require 'ejira-agenda)

  ;; Make the issues visisble in your agenda by adding `ejira-org-directory'
  ;; into your `org-agenda-files'.
  (add-to-list 'org-agenda-files ejira-org-directory)

  ;; Add an agenda view to browse the issues that
  (org-add-agenda-custom-command
   '("j" "My JIRA issues"
     ((ejira-jql "resolution = unresolved and assignee = currentUser()"
                 ((org-agenda-overriding-header "Assigned to me")))))))

ElFeed

(use-package elfeed
  :commands (elfeed)
  :config
  (setq elfeed-feeds
        '("http://planet.clojure.in/atom.xml"
          "https://grumpyhacker.com/feed.xml"
          "https://nullprogram.com/feed"
          "https://planet.emacslife.com/atom.xml"
          "https://sulami.github.io/atom.xml"
          "http://planet.lisp.org/rss20.xml"
          "https://planet.scheme.org/atom.xml")))

LLM

(use-package llm
  :defer t
  :custom
  (llm-log t))

Ellama

(use-package ellama
  :load-path ("~/workspace/ellama")
  :commands (ellama-ask-about
             ellama-ask-line
             ellama-ask-selection
             ellama-code-complete
             ellama-code-edit
             ellama-code-improve
             ellama-code-review
             ellama-complete
             ellama-context-add-buffer
             ellama-context-add-file
             ellama-context-add-info-node
             ellama-context-add-selection
             ellama-define-word
             ellama-improve-conciseness
             ellama-improve-grammar
             ellama-improve-wording
             ellama-load-session
             ellama-provider-select
             ellama-session-switch
             ellama-summarize
             ellama-summarize-killring
             ellama-summarize-webpage
             ellama-translate
             ellama-translate-buffer)
  :custom
  (ellama-auto-scroll t)
  (ellama-language "German")
  :config
  (require 'llm-openai)
  (require 'llm-vertex)
  (add-to-list 'ellama-providers
               (cons "Nu Gemini 1.0"
                     (make-llm-vertex
                      :chat-model "gemini-pro"
                      :project "iteng-itsystems")))
  (add-to-list 'ellama-providers
               (cons "Nu Gemini 1.5"
                     (make-llm-vertex
                      :chat-model "gemini-1.5-pro-preview-0215"
                      :project "iteng-itsystems")))
  (add-to-list 'ellama-providers
               (cons "Nu OpenAI Local Proxy"
                     (make-llm-openai-compatible
                      :url "http://127.0.0.1:8899/v1/"
                      :chat-model "gpt-4-turbo-preview"
                      :embedding-model "text-embedding-ada-002")))
  (add-to-list 'ellama-providers
               (cons "OpenAI GPT-3"
                     (make-llm-openai
                      :key (auth-source-pick-first-password :host "openai.com" :user "ellama")
                      :chat-model "gpt-3.5-turbo"
                      :embedding-model "text-embedding-ada-002")))
  (add-to-list 'ellama-providers
               (cons "OpenAI GPT-4"
                     (make-llm-openai
                      :key (auth-source-pick-first-password :host "openai.com" :user "ellama")
                      :chat-model "gpt-4-turbo-preview"
                      :embedding-model "text-embedding-ada-002")))
  (setq ellama-provider (alist-get "OpenAI GPT-3" ellama-providers nil nil #'string=)))

(defun ellama-chat-whisper ()
  "Record audio in a temporary buffer with the `whisper-run`
command. When the user presses a key, stop the recording with by
invoking `whisper-run` again.  The text in the temporary buffer
is then passwd to the ellama-chat command."
  (interactive)
  (require 'ellama)
  (require 'whisper)
  (let ((buffer (get-buffer-create whisper--stdout-buffer-name)))
    (with-current-buffer buffer
      (erase-buffer)
      (make-local-variable 'whisper-after-transcription-hook)
      (add-hook 'whisper-after-transcription-hook
                (lambda ()
                  (let ((transcription (buffer-substring (line-beginning-position)
                                                         (line-end-position))))

                    (ellama-chat transcription)))
                nil t)
      (let ((recording-process (whisper-run)))
        (message "Recording, then asking Ellama. Press RET to stop.")
        (while (not (equal ?\r (read-char)))
          (sit-for 0.5))
        (whisper-run)))))


(defun ellama-ask-about-whisper ()
  "Record audio in a temporary buffer with the `whisper-run`
command. When the user presses a key, stop the recording with by
invoking `whisper-run` again.  The text in the temporary buffer
is then passwd to the ellama-chat command."
  (interactive)
  (require 'ellama)
  (require 'whisper)
  (let ((about-buffer (current-buffer))
        (buffer (get-buffer-create whisper--stdout-buffer-name)))
    (with-current-buffer buffer
      (erase-buffer)
      (make-local-variable 'whisper-after-transcription-hook)
      (add-hook 'whisper-after-transcription-hook
                (lambda ()
                  (let ((transcription (buffer-substring (line-beginning-position)
                                                         (line-end-position))))
                    (with-current-buffer about-buffer
                      (if (region-active-p)
                          (ellama-context-add-selection)
                        (ellama-context-add-buffer (buffer-name (current-buffer)))))
                    (ellama-chat transcription)))
                nil t)
      (let ((recording-process (whisper-run)))
        (message "Recording, then asking Ellama. Press RET to stop.")
        (while (not (equal ?\r (read-char)))
          (sit-for 0.5))
        (whisper-run)))))

Elisa

(use-package elisa
  :disabled)

LLM Nu

(use-package nu-llm
  :after ellama
  :load-path (lambda () (expand-file-name "nu-llm.el" (getenv "NU_HOME")))
  :config
  (when (fboundp 'nu-llm-make-openai)
    (add-to-list 'ellama-providers (cons "Nu OpenAI GPT-3.5" (nu-llm-make-openai :chat-model "gpt-3.5-turbo")))
    (add-to-list 'ellama-providers (cons "Nu OpenAI GPT-4" (nu-llm-make-openai :chat-model "gpt-4-turbo")))
    (add-to-list 'ellama-providers (cons "Nu OpenAI GPT-4o" (nu-llm-make-openai :chat-model "gpt-4o")))
    (setq ellama-provider (alist-get "Nu OpenAI GPT-4o" ellama-providers nil nil #'string=))))

Elixir

(use-package elixir-mode
  :bind (:map elixir-mode-map
              ("C-c C-f" . elixir-format)))

eval-expr

(use-package eval-expr
  :hook ((emacs-lisp-mode . eval-expr-install)))

Clojure mode

(use-package clojure-mode
  :after (nu)
  :mode (("\\.edn\\'" . clojure-mode)
         ("\\.cljs\\'" . clojurescript-mode)
         ("\\.cljx\\'" . clojurex-mode)
         ("\\.cljc\\'" . clojurec-mode))
  :config
  (add-hook 'clojure-mode-hook #'subword-mode)
  (add-hook 'clojure-mode-hook #'paredit-mode)
  (define-key clojure-mode-map (kbd "C-c t") #'projectile-toggle-between-implementation-and-test)
  (define-clojure-indent
   (assoc 1)
   (match? 0)
   (time! 1)
   (fdef 1)
   (providing 1)
   ;; cljs.test
   (async 1)
   ;; ClojureScript
   (this-as 1)
   ;; COMPOJURE
   (ANY 2)
   (DELETE 2)
   (GET 2)
   (HEAD 2)
   (POST 2)
   (PUT 2)
   (context 2)
   ;; ALGO.MONADS
   (domonad 1)
   ;; Om.next
   (defui '(1 nil nil (1)))
   ;; CUSTOM
   (api-test 1)
   (web-test 1)
   (database-test 1)
   (defroutes 'defun)
   (flow 'defun)
   (for-all '(1 (2)))
   (assoc-some 1)
   (let-entities 2)
   (functions/constraint-fn 2))
  (put 'defmixin 'clojure-backtracking-indent '(4 (2)))
  (require 'clojure-mode-extra-font-locking))

Cider

(use-package cider
  :commands (cider-jack-in cider-jack-in-clojurescript)
  :load-path ("~/workspace/cider")
  :config
  ;; Enable eldoc in Clojure buffers
  (add-hook 'cider-mode-hook #'eldoc-mode)

  ;; ;; Disable showing eldoc, use lsp-mode.
  ;; (setq cider-eldoc-display-for-symbol-at-point nil)

  ;; Add Cider Xref backend to the end, use lsp-mode.
  ;; (setq cider-xref-fn-depth -90)
  ;; (setq cider-xref-fn-depth 0)
  ;; (setq cider-xref-fn-depth 90)

  ;; Pretty print in the REPL.
  (setq cider-repl-use-pretty-printing t)

  ;; Hide *nrepl-connection* and *nrepl-server* buffers from appearing
  ;; in some buffer switching commands like switch-to-buffer
  (setq nrepl-hide-special-buffers nil)

  ;; Enabling CamelCase support for editing commands(like forward-word,
  ;; backward-word, etc) in the REPL is quite useful since we often have
  ;; to deal with Java class and method names. The built-in Emacs minor
  ;; mode subword-mode provides such functionality
  (add-hook 'cider-repl-mode-hook #'subword-mode)

  ;; The use of paredit when editing Clojure (or any other Lisp) code is
  ;; highly recommended. You're probably using it already in your
  ;; clojure-mode buffers (if you're not you probably should). You might
  ;; also want to enable paredit in the REPL buffer as well.
  (add-hook 'cider-repl-mode-hook #'paredit-mode)

  ;; Auto-select the error buffer when it's displayed:
  (setq cider-auto-select-error-buffer t)

  ;; Controls whether to pop to the REPL buffer on connect.
  (setq cider-repl-pop-to-buffer-on-connect nil)

  ;; T to wrap history around when the end is reached.
  (setq cider-repl-wrap-history t)

  ;; Don't log protocol messages to the `nrepl-message-buffer-name' buffer.
  (setq nrepl-log-messages t)

  ;; Don't show the `*cider-test-report*` buffer on passing tests.
  (setq cider-test-report-on-success nil)

  ;; (setq cider-injected-middleware-version "0.0.0")
  ;; (setq cider-required-middleware-version "0.0.0")

  ;; (add-to-list 'cider-jack-in-nrepl-middlewares "stem.nrepl/middleware")
  ;; (cider-add-to-alist 'cider-jack-in-dependencies "stem/nrepl" "1.1.2-SNAPSHOT")

  ;; (add-to-list 'cider-jack-in-nrepl-middlewares "nrepl-rebl.core/wrap-rebl")
  ;; (cider-add-to-alist 'cider-jack-in-dependencies "nrepl-rebl/nrepl-rebl" "0.1.1")

  ;; Whether to use git.io/JiJVX for adding sources and javadocs to the classpath.
  (setq cider-enrich-classpath nil)

  (cider-add-to-alist 'cider-jack-in-dependencies "refactor-nrepl/refactor-nrepl" "3.10.0")

  ;; TODO: How to do this without printing a message?
  (defun custom/cider-inspector-mode-hook ()
    (visual-line-mode -1)
    (toggle-truncate-lines 1))

  (add-hook 'cider-inspector-mode-hook #'custom/cider-inspector-mode-hook))

Clojure refactor

(use-package clj-refactor
  :hook ((clojure-mode . clj-refactor-mode))
  :config
  (cljr-add-keybindings-with-prefix "C-c C-R")
  ;; Don't place a newline after the `:require` and `:import` tokens
  (setq cljr-insert-newline-after-require nil)
  ;; Don't use prefix notation when cleaning the ns form.
  (setq cljr-favor-prefix-notation nil)
  ;; Don't warn when running an AST op.
  (setq cljr-warn-on-eval nil)
  ;; ;; Don't build AST on startup.
  (setq cljr-eagerly-build-asts-on-startup nil)
  ;; Print a message when the AST has been built.
  (setq cljr--debug-mode t))

Code GPT

This Emacs Code extension allows you to use the official OpenAI API to generate code or natural language responses from OpenAI’s GPT-3 to your questions, right within the editor.

(use-package codegpt
  :commands (codegpt))

Consult

(use-package consult
  ;; Replace bindings. Lazily loaded due by `use-package'.
  :bind (;; C-c bindings (mode-specific-map)
         ("C-c h" . consult-history)
         ("C-c m" . consult-mode-command)
         ("C-c b" . consult-bookmark)
         ("C-c k" . consult-kmacro)
         ;; C-x bindings (ctl-x-map)
         ("C-x M-:" . consult-complex-command)     ;; orig. repeat-complex-command
         ("C-x b" . consult-buffer)                ;; orig. switch-to-buffer
         ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
         ("C-x 5 b" . consult-buffer-other-frame)  ;; orig. switch-to-buffer-other-frame
         ;; Custom M-# bindings for fast register access
         ("M-#" . consult-register-load)
         ("M-'" . consult-register-store)          ;; orig. abbrev-prefix-mark (unrelated)
         ("C-M-#" . consult-register)
         ;; Other custom bindings
         ("M-y" . consult-yank-pop)                ;; orig. yank-pop
         ("<help> a" . consult-apropos)            ;; orig. apropos-command
         ;; M-g bindings (goto-map)
         ("M-g e" . consult-compile-error)
         ("M-g f" . consult-flymake)               ;; Alternative: consult-flycheck
         ("M-g g" . consult-goto-line)             ;; orig. goto-line
         ("M-g M-g" . consult-goto-line)           ;; orig. goto-line
         ("M-g o" . consult-outline)
         ("M-g m" . consult-mark)
         ("M-g k" . consult-global-mark)
         ("M-g i" . consult-imenu)
         ("M-g I" . consult-project-imenu)
         ;; M-s bindings (search-map)
         ("M-s f" . consult-find)
         ("M-s L" . consult-locate)
         ("M-s g" . consult-grep)
         ("M-s G" . consult-git-grep)
         ("M-s r" . consult-ripgrep)
         ("M-s l" . consult-line)
         ("M-s m" . consult-multi-occur)
         ("M-s k" . consult-keep-lines)
         ("M-s u" . consult-focus-lines)
         ;; Isearch integration
         ("M-s e" . consult-isearch)
         :map isearch-mode-map
         ("M-e" . consult-isearch)                 ;; orig. isearch-edit-string
         ("M-s e" . consult-isearch)               ;; orig. isearch-edit-string
         ("M-s l" . consult-line))                 ;; required by consult-line to detect isearch

  ;; Enable automatic preview at point in the *Completions* buffer.
  ;; This is relevant when you use the default completion UI,
  ;; and not necessary for Selectrum, Vertico etc.
  ;; :hook (completion-list-mode . consult-preview-at-point-mode)

  ;; The :init configuration is always executed (Not lazy)
  :init

  ;; Optionally configure the register formatting. This improves the register
  ;; preview for `consult-register', `consult-register-load',
  ;; `consult-register-store' and the Emacs built-ins.
  (setq register-preview-delay 0
        register-preview-function #'consult-register-format)

  ;; Optionally tweak the register preview window.
  ;; This adds thin lines, sorting and hides the mode line of the window.
  (advice-add #'register-preview :override #'consult-register-window)

  ;; Use Consult to select xref locations with preview
  (setq xref-show-xrefs-function #'consult-xref
        xref-show-definitions-function #'consult-xref)

  ;; Configure other variables and modes in the :config section,
  ;; after lazily loading the package.
  :config

  ;; Optionally configure preview. The default value
  ;; is 'any, such that any key triggers the preview.
  ;; (setq consult-preview-key 'any)
  ;; (setq consult-preview-key (kbd "M-."))
  ;; (setq consult-preview-key (list (kbd "<S-down>") (kbd "<S-up>")))
  ;; For some commands and buffer sources it is useful to configure the
  ;; :preview-key on a per-command basis using the `consult-customize' macro.
  (consult-customize
   consult-theme
   :preview-key '(:debounce 0.2 any)
   consult-ripgrep consult-git-grep consult-grep
   consult-bookmark consult-recent-file consult-xref
   consult--source-bookmark consult--source-recent-file
   consult--source-project-recent-file
   :preview-key "M-.")

  ;; Optionally configure the narrowing key.
  ;; Both < and C-+ work reasonably well.
  (setq consult-narrow-key "<") ;; (kbd "C-+")

  ;; Optionally make narrowing help available in the minibuffer.
  ;; You may want to use `embark-prefix-help-command' or which-key instead.
  ;; (define-key consult-narrow-map (vconcat consult-narrow-key "?") #'consult-narrow-help)

  (autoload 'projectile-project-root "projectile")
  (setq consult-project-root-function #'projectile-project-root))

Consult Github

(use-package consult-gh
  :after consult)

Geiser

Emacs and Scheme talk to each other.

(use-package geiser
  :commands (geiser run-geiser))

The Geiser implementation for Guile scheme.

(use-package geiser-guile
  :after geiser
  :custom
  (geiser-default-implementation 'guile)
  :config
  ;; (add-to-list 'geiser-guile-load-path (expand-file-name "~/workspace/guix"))
  (add-to-list 'geiser-guile-load-path (expand-file-name "~/workspace/asahi-guix/channel/src"))
  (add-to-list 'geiser-guile-load-path (expand-file-name "~/workspace/guix-channel"))
  (add-to-list 'geiser-guile-load-path (expand-file-name "~/workspace/guix-home"))
  (add-to-list 'geiser-guile-load-path (expand-file-name "~/workspace/guix-system")))

GraphQL Mode

(use-package graphql-mode
  :mode "\\.graphql\\'"
  :config
  (setq graphql-url "http://localhost:7000/graphql"))

Guix

(defun guix-home-reconfigure ()
  "Run Guix Home reconfigure."
  (interactive)
  (let ((buffer (get-buffer-create "*Guix Home Reconfigure*"))
        (default-directory "~/workspace/guix-home"))
    (async-shell-command "guix home -L . reconfigure r0man/home/config.scm" buffer)))

Configure the full name of the user logged in.

(setq user-full-name "r0man")

Dart

(use-package dart-mode
  :hook (dart-mode . flutter-test-mode))

Data Debug

(use-package data-debug
  :bind (("M-:" . data-debug-eval-expression)))

Delete trailing whitespace

(add-hook 'before-save-hook 'delete-trailing-whitespace)

Docker

(use-package docker
  :commands (docker))

EIEIO

Enhanced Implementation of Emacs Interpreted Objects

(use-package eieio-datadebug
  :after (eieio))

Emacs Lisp

(use-package emacs-lisp
  :bind (("C-c C-p " . pp-eval-last-sexp)
         ("C-c C-j " . pp-json-eval-last-sexp)))

Emacs Refactor

(use-package emr
  :commands (emr-show-refactor-menu))

Embark

Emacs Mini-Buffer Actions Rooted in Key maps.

Make sure the OS does not capture C-..

See: https://emacsnotes.wordpress.com/2022/08/16/who-stole-c-c-and-possibly-other-keys-from-my-emacs/

(use-package embark
  :bind
  (("C-." . embark-act)         ;; pick some comfortable binding
   ("C-;" . embark-dwim)        ;; good alternative: M-.
   ("C-h B" . embark-bindings)) ;; alternative for `describe-bindings'
  :init
  ;; Optionally replace the key help with a completing-read interface
  (setq prefix-help-command #'embark-prefix-help-command)
  :custom-face
  (embark-keybinding ((t :inherit bold)))
  :config
  ;; Hide the mode line of the Embark live/completions buffers
  (add-to-list 'display-buffer-alist
               '("\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
                 nil
                 (window-parameters (mode-line-format . none)))))

Embark Consult

(use-package embark-consult
  :after (embark consult)
  :demand t ; only necessary if you have the hook below
  ;; if you want to have consult previews as you move around an
  ;; auto-updating embark collect buffer
  :hook
  (embark-collect-mode . consult-preview-at-point-mode))

Flutter

(use-package flutter
  :after dart-mode
  :bind (:map dart-mode-map ("C-M-x" . #'flutter-run-or-hot-reload))
  :custom (flutter-sdk-path "/opt/flutter"))

Forge

(use-package forge
  :after magit
  :commands (forge-pull))

GIF Screencast

(use-package gif-screencast
  :commands gif-screencast-start-or-stop
  ;; :bind ("<f9>" . gif-screencast-start-or-stop)
  :config
  (setq gif-screencast-scale-factor 1.0))
;; (with-eval-after-load 'gif-screencast
;;   (setq gif-screencast-scale-factor 1.0)
;;   (define-key gif-screencast-mode-map (kbd "<f8>") 'gif-screencast-toggle-pause)
;;   (global-set-key (kbd "<f9>") 'gif-screencast-start-or-stop))

Guess Language

Emacs minor mode that detects the language of what you’re typing. Automatically switches the spell checker and typo-mode.

(use-package guess-language
  :disabled
  :hook (text-mode . guess-language-mode)
  :config
  (setq guess-language-langcodes
        '((de . ("de_DE" "German"))
          (en . ("en_US" "English"))))
  (setq guess-language-languages '(en de es))
  (setq guess-language-min-paragraph-length 15))

Guix

(use-package guix
  :hook ((scheme-mode . guix-devel-mode)))

GPTel

(use-package gptel
  :commands gptel
  :load-path ("~/workspace/gptel")
  :custom
  (gptel-openai-endpoint "http://localhost:3005/v1"))

Helpful

Helpful is an alternative to the built-in Emacs help that provides much more contextual information.

(use-package helpful
  :disabled
  :bind (("C-h f" . helpful-callable)
         ("C-h v" . helpful-variable)
         ("C-h k" . helpful-key)
         ("C-c C-d" . helpful-at-point)
         ("C-h F" . helpful-function)
         ("C-h C" . helpful-command)))

History

If set to t when adding a new history element, all previous identical elements are deleted from the history list.

(setq history-delete-duplicates t)

HTMLize

(use-package htmlize
  :commands (htmlize-buffer htmlize-file))

Hy Mode

(use-package hy-mode
  :mode (("\\.hy\\'" . hy-mode))
  :config
  (add-hook 'hy-mode-hook 'paredit-mode)
  (setq hy-indent-specform
        '(("for" . 1)
          ("for*" . 1)
          ("while" . 1)
          ("except" . 1)
          ("catch" . 1)
          ("let" . 1)
          ("if" . 1)
          ("when" . 1)
          ("unless" . 1)
          ("test-set" . 1)
          ("test-set-fails" . 1))))

Lisp Mode

(use-package lisp-mode
  :mode (("source-registry.conf" . lisp-mode)))

Auto Save

Set the auto save directory.

(setq my-auto-save-directory (concat user-emacs-directory "auto-save/"))
(setq auto-save-file-name-transforms `((".*" ,my-auto-save-directory t)))

Backup

Set the backup directory.

(setq my-backup-directory (concat user-emacs-directory "backups/"))

Put all backup files in a separate directory.

(setq backup-directory-alist `((".*" . ,my-backup-directory)))

Copy all files, don’t rename them.

(setq backup-by-copying t)

If non-nil, backups of registered files are made as with other files. If nil (the default), files covered by version control don’t get backups.

(setq vc-make-backup-files nil)

If t, delete excess backup versions silently.

(setq delete-old-versions t)

Number of newest versions to keep when a new numbered backup is made.

(setq kept-new-versions 20)

Number of oldest versions to keep when a new numbered backup is made.

(setq kept-old-versions 20)

Make numeric backup versions unconditionally.

(setq version-control t)

Version Control

Disable all version control to speed up file saving.

(setq vc-handled-backends nil)

Message Buffer

Increase the number of messages in the Messages buffer.

(setq message-log-max 10000)

Mermaid

Emacs major mode for working with mermaid graphs.

(use-package mermaid-mode
  :mode ("\\.mermaid\\'" "\\.mmd\\'"))

Misc

Answer questions with “y” or “n”.

(setq use-short-answers t)

Highlight matching parentheses when the point is on them.

(show-paren-mode 1)

Enter debugger if an error is signaled?

(setq debug-on-error nil)

Don’t show startup message.

(setq inhibit-startup-message t)

Toggle column number display in the mode line.

(column-number-mode)

Don’t display time, load level, and mail flag in mode lines.

(display-time-mode 0)

Whether to add a newline automatically at the end of the file.

(setq require-final-newline t)

Highlight trailing whitespace.

(setq show-trailing-whitespace t)

Controls the operation of the TAB key.

(setq tab-always-indent 'complete)

The maximum size in lines for term buffers.

(setq term-buffer-maximum-size (* 10 2048))

Use Firefox as default browser.

(setq browse-url-browser-function 'browse-url-firefox)

Clickable URLs.

(define-globalized-minor-mode global-goto-address-mode goto-address-mode goto-address-mode)
(global-goto-address-mode)

Whether Emacs should confirm killing processes on exit.

(setq confirm-kill-processes nil)

Compilation mode

Enable colors in compilation mode. http://stackoverflow.com/questions/3072648/cucumbers-ansi-colors-messing-up-emacs-compilation-buffer

(defun colorize-compilation-buffer ()
  (let ((inhibit-read-only t))
    (ansi-color-apply-on-region (point-min) (point-max))))
(use-package compile
  :commands (compile)
  :custom
  ;; Auto scroll compilation buffer.
  (compilation-scroll-output 't)
  :config
  (add-hook 'compilation-filter-hook #'colorize-compilation-buffer))

CSS mode

(use-package css-mode
  :mode ("\\.css\\'" . css-mode)
  :custom
  (css-indent-offset 2))

SCSS mode

(use-package scss-mode
  :mode (("\\.sass\\'" . scss-mode)
         ("\\.scss\\'" . scss-mode))
  :custom
  (scss-compile-at-save nil))

Desktop save mode

(use-package desktop
  :hook (after-init . (lambda () (desktop-save-mode 1)))
  :config
  ;; Disable Verbose reporting of lazily created buffers.
  (setq desktop-lazy-verbose nil)
  ;; Always save desktop.
  (setq desktop-save t)
  ;; Load desktop even if it is locked.
  (setq desktop-load-locked-desktop t)
  ;; Number of buffers to restore immediately.
  (setq desktop-restore-eager 4)
  ;; Don't save some buffers.
  (setq desktop-buffers-not-to-save
        (concat "\\("
                "\\.bbdb|\\.gz"
                "\\)$"))
  ;; Don't save certain modes.
  (add-to-list 'desktop-modes-not-to-save 'Info-mode)
  (add-to-list 'desktop-modes-not-to-save 'dired-mode)
  (add-to-list 'desktop-modes-not-to-save 'fundamental-mode)
  (add-to-list 'desktop-modes-not-to-save 'info-lookup-mode))

Inferior Lisp mode

(use-package inf-lisp
  :commands (inferior-lisp)
  :custom
  (inferior-lisp-program "sbcl"))

Dired mode

(use-package dired
  :bind (("C-x C-d" . dired))
  :commands (dired)
  :custom
  ;; Try to guess a default target directory.
  (dired-dwim-target t)
  ;; Switches passed to `ls' for Dired. MUST contain the `l' option.
  (dired-listing-switches "-alh"))

Find Clojure files in dired mode.

(defun find-dired-clojure (dir)
  "Run find-dired on Clojure files."
  (interactive (list (read-directory-name "Find Clojure files in directory: " nil "" t)))
  (find-dired dir "-name \"*.clj\""))

Find Elisp files in dired mode.

(defun find-dired-elisp (dir)
  "Run find-dired on Elisp files."
  (interactive (list (read-directory-name "Find Elisp files in directory: " nil "" t)))
  (find-dired dir "-name \"*.el\""))

Dired-x mode

Run shell command in background.

(defun dired-do-shell-command-in-background (command)
  "In dired, do shell command in background on the file or directory named on
 this line."
  (interactive
   (list (dired-read-shell-command (concat "& on " "%s: ") nil (list (dired-get-filename)))))
  (call-process command nil 0 nil (dired-get-filename)))
(use-package dired-x
  :after dired
  :bind (:map dired-mode-map
              ("&" . dired-do-shell-command-in-background))
  :custom
  (dired-guess-shell-alist-user
   '(("\\.mp4\\'" "mplayer")
     ("\\.mkv\\'" "mplayer")
     ("\\.mov\\'" "mplayer")
     ("\\.xlsx?\\'" "libreoffice"))))

Electric pair mode

Electric Pair mode, a global minor mode, provides a way to easily insert matching delimiters. Whenever you insert an opening delimiter, the matching closing delimiter is automatically inserted as well, leaving point between the two.

(use-package elec-pair
  :hook (after-init . electric-pair-mode))

Prog Mode

(use-package prog-mode
  :hook (emacs-lisp-mode . prettify-symbols-mode))

Elint

A linter for Emacs Lisp.

(use-package elint
  :commands (elint-initialize elint-current-buffer)
  :bind (:map emacs-lisp-mode-map
              ("C-c e E" . elint-current-buffer)))

Elisp

The major mode for editing Emacs Lisp code.

(use-package emacs-lisp-mode
  :no-require t
  :mode ("\\.el\\'" "Cask")
  :bind (:map emacs-lisp-mode-map
              ("C-c C-k" . eval-buffer)
              ("C-c e c" . cancel-debug-on-entry)
              ("C-c e d" . debug-on-entry)
              ("C-c e e" . toggle-debug-on-error)
              ("C-c e f" . emacs-lisp-byte-compile-and-load)
              ("C-c e l" . find-library)
              ("C-c e r" . eval-region)))

ERT

The major mode for editing Emacs Lisp code.

(use-package ert
  ;; :no-require t
  ;; :mode ("\\.el\\'")
  :bind (:map emacs-lisp-mode-map
              ("C-c ," . ert)
              ("C-c C-," . ert)))

Elisp slime navigation

Slime-style navigation for Emacs Lisp.

(use-package elisp-slime-nav
  :diminish
  :hook (emacs-lisp-mode . elisp-slime-nav-mode))

Emacs server

Start the Emacs server if it’s not running.

(use-package server
  :if window-system
  :init
  (require 'server)
  (unless (server-running-p)
    (add-hook 'after-init-hook 'server-start t)))

Emacs multimedia system

(use-package emms
  :commands (emms)
  :config
  (emms-all)
  (emms-default-players)
  (add-to-list 'emms-player-list 'emms-player-mpd)
  (condition-case nil
      (emms-player-mpd-connect)
    (error (message "Can't connect to music player daemon.")))
  (setq emms-source-file-directory-tree-function 'emms-source-file-directory-tree-find)
  (setq emms-player-mpd-music-directory (expand-file-name "~/Music"))
  (load-if-exists "~/.emms.el"))

Expand region

(use-package expand-region
  :bind (("C-c C-+" . er/expand-region)
         ("C-c C--" . er/contract-region)))

Flycheck

(use-package flycheck
  :hook ((after-init . global-flycheck-mode)))
(use-package flycheck-elsa
  :hook ((emacs-lisp-mode . flycheck-elsa-setup)))

Git Email

(use-package git-email
  :commands (git-email-send-email git-email-format-patch))

Github browse file

(use-package github-browse-file
  :commands (github-browse-file github-browse-file-blame))

GPTel

A simple LLM client for Emacs.

(use-package gptel
  :commands (gptel)
  :config
  (gptel-make-ollama "Ollama"
                     :host "localhost:11434"
                     :stream t
                     :models '("llama2:latest")))
(use-package nu-gptel
  :after gptel
  :load-path (lambda () (expand-file-name "nu-gptel" (getenv "NU_HOME")))
  :config
  (setq-default gptel-backend nu-gptel-openai))

Inspector

(use-package inspector
  :commands (inspector-inspect-expression
             inspector-inspect-last-sexp))

(use-package tree-inspector
  :commands (tree-inspector-inspect-expression
             tree-inspector-inspect-last-sexp))

isa.el

(use-package isa
  :commands (isa)
  :if (file-directory-p "~/workspace/nu/isa.el/")
  :load-path "~/workspace/nu/isa.el/")

Jiralib2

Lisp bindings to JIRA REST API.

(use-package jiralib2
  :after (ox-jira)
  :defer t)

Jinx

Jinx is a fast just-in-time spell-checker for Emacs. Jinx highlights misspelled words in the text of the visible portion of the buffer. For efficiency, Jinx highlights misspellings lazily, recognizes window boundaries and text folding, if any. For example, when unfolding or scrolling, only the newly visible part of the text is checked if it has not been checked before. Each misspelling can be corrected from a list of dictionary words presented as a completion menu.

(use-package jinx
  :disabled
  :hook (emacs-startup . global-jinx-mode)
  :bind (("M-$" . jinx-correct)
         ("C-M-$" . jinx-languages)))

Kubel

(use-package kubel
  :commands (kubel))

Kubernetes

(use-package kubernetes
  :bind (("C-x C-k s" . kubernetes-overview))
  :commands (kubernetes-overview))

Kotlin

(use-package kotlin-mode
  :mode ("\\.kt\\'" "\\.kts\\'" "\\.ktm\\'"))

Magit

(use-package magit
  :bind (("C-x C-g s" . magit-status))
  :config
  (setq magit-stage-all-confirm nil)
  (setq magit-unstage-all-confirm nil)
  (setq ediff-window-setup-function 'ediff-setup-windows-plain))

Nubank

(use-package nu
  :commands (nu nu-datomic-query nu-session-switch)
  :load-path ("~/workspace/nu/nudev/ides/emacs/"
              "~/workspace/nu/nudev/ides/emacs/test/")
  :config
  (require 'nu)
  (require 'nu-metapod)
  (require 'nu-datomic-query))

Nu Tools Build

(use-package nu-tools-build
  :commands (nu-tools-build)
  :load-path ("~/workspace/nu/tools-build/"))

Java

Indent Java annotations. See http://lists.gnu.org/archive/html/help-gnu-emacs/2011-04/msg00262.html

(use-package java-mode
  :hook ((java-mode . eglot-ensure))
  :config
  (setq c-comment-start-regexp "\\(@\\|/\\(/\\|[*][*]?\\)\\)")
  (modify-syntax-entry ?@ "< b" java-mode-syntax-table))

JavaScript

Number of spaces for each indentation step in `js-mode’.

(use-package js
  :mode "\\.js\\'"
  :custom
  (js-indent-level 2))

JArchive

Jarchive teaches emacs how to open project dependencies that reside inside jar files.

(use-package jarchive
  :config
  (jarchive-setup)
  :after (eglot))

RCIRC

An Emacs IRC client.

(use-package rcirc
  :commands (rcirc)
  :custom
  (rcirc-default-nick "r0man")
  (rcirc-default-user-name "r0man")
  (rcirc-default-full-name "r0man")
  (rcirc-server-alist '(("irc.libera.chat"
                         :channels ("#clojure" "#guix")
                         :encryption tls
                         :port 6697)))
  (rcirc-private-chat t)
  (rcirc-debug-flag t)
  :config
  (load-if-exists "~/.rcirc.el")
  (add-hook 'rcirc-mode-hook
            (lambda ()
              (set (make-local-variable 'scroll-conservatively) 8192)
              (rcirc-track-minor-mode 1))))

Message

(use-package message
  :defer t
  :custom
  ;; Send mail via smtpmail.
  (message-send-mail-function 'smtpmail-send-it)
  :init
  ;; GPG sign messages
  (add-hook 'message-send-hook 'mml-secure-message-sign-pgpmime))

Macrostep

Interactive macro-expander for Emacs.

(use-package macrostep
  :commands (macrostep-expand)
  :bind (:map emacs-lisp-mode-map
              ("C-c m" . macrostep-expand)))

Makem.sh

(use-package makem
  :load-path ("~/workspace/makem.sh")
  :commands (makem))

Markdown mode

(use-package markdown-mode
  :mode "\\.md\\'"
  :custom
  (markdown-hide-urls t)
  :config
  (add-to-list 'auto-mode-alist '("README\\.md\\'" . gfm-mode)))

Marginalia

This package adds marginalia to the minibuffer completions. Marginalia are marks or annotations placed at the margin of the page of a book or in this case helpful colorful annotations placed at the margin of the minibuffer for your completion candidates. Marginalia can only add annotations to the completion candidates. It cannot modify the appearance of the candidates themselves, which are shown unaltered as supplied by the original command.

(use-package marginalia
  ;; Either bind `marginalia-cycle` globally or only in the minibuffer
  :bind (("M-A" . marginalia-cycle)
         :map minibuffer-local-map
         ("M-A" . marginalia-cycle))
  :hook (after-init . marginalia-mode))

Mu4e

Configure mu.

mu init --maildir=~/Mail --my-address=roman@burningswell.com --my-address=roman.scherer@burningswell.com --my-address=roman.scherer@nubank.com.br
mu index
(use-package mu4e
  :commands mu4e
  :config
  (setq mu4e-maildir "~/Mail")

  ;; Make sure that moving a message (like to Trash) causes the
  ;; message to get a new file name.  This helps to avoid the
  ;; dreaded "UID is N beyond highest assigned" error.
  ;; See this link for more info: https://stackoverflow.com/a/43461973
  (setq mu4e-change-filenames-when-moving t)

  ;; Do not show colors in the HTML.
  (setq shr-use-colors nil)

  ;; Refresh mail every minute.
  (setq mu4e-update-interval (* 1 60))

  ;; The policy to determine the context when entering the mu4e main view.
  (setq mu4e-context-policy 'pick-first)

  (setq mu4e-bookmarks
        '((:name "Burning Swell"
                 :query "maildir:/burningswell/* AND NOT flag:list"
                 :key ?b)
          (:name "Nubank"
                 :query "maildir:/nubank/* AND NOT flag:list"
                 :key ?n)
          (:name "Guix Devel"
                 :query "list:guix-devel.gnu.org"
                 :key ?g)
          (:name "Guix Help"
                 :query "list:help-guix.gnu.org"
                 :key ?h)
          (:name "Unread messages"
                 :query "flag:unread AND NOT flag:trashed AND NOT list:itaipu.nubank.github.com"
                 :key ?u)
          (:name "Today's messages"
                 :query "date:today..now AND NOT list:itaipu.nubank.github.com"
                 :key ?t)
          (:name "Last 7 days"
                 :query "date:7d..now AND NOT list:itaipu.nubank.github.com"
                 ;; :hide-unread t
                 :key ?w)
          (:name "Messages with images"
                 :query "mime:image/*"
                 :key ?p)))

  (setq mu4e-contexts
        (list
         (make-mu4e-context
          :name "Burningswell"
          :match-func
          (lambda (msg)
            (when msg
              (string-prefix-p "/burningswell" (mu4e-message-field msg :maildir))))
          :vars '((mu4e-drafts-folder . "/burningswell/[Gmail]/Drafts")
                  (mu4e-refile-folder . "/burningswell/[Gmail]/All Mail")
                  (mu4e-sent-folder . "/burningswell/[Gmail]/Sent Mail")
                  (mu4e-trash-folder . "/burningswell/[Gmail]/Trash")
                  (user-full-name . "Roman Scherer")
                  (user-mail-address . "roman.scherer@burningswell.com")))
         (make-mu4e-context
          :name "Nubank"
          :match-func
          (lambda (msg)
            (when msg
              (string-prefix-p "/nubank" (mu4e-message-field msg :maildir))))
          :vars '((mu4e-drafts-folder . "/nubank/[Gmail]/Drafts")
                  (mu4e-refile-folder . "/nubank/[Gmail]/All Mail")
                  (mu4e-sent-folder . "/nubank/[Gmail]/Sent Mail")
                  (mu4e-trash-folder . "/nubank/[Gmail]/Trash")
                  (user-full-name . "Roman Scherer")
                  (user-mail-address . "roman.scherer@nubank.com.br"))))))

Mu4e Alert

(use-package mu4e-alert
  :disabled
  ;; :after mu4e
  :config
  ;; Show unread emails from all inboxes
  ;; (setq mu4e-alert-interesting-mail-query dw/mu4e-inbox-query)
  ;; Show notifications for mails already notified
  (setq mu4e-alert-notify-repeated-mails nil)
  (setq mu4e-alert-style 'libnotify)
  (mu4e-alert-enable-notifications)
  (add-hook 'after-init-hook #'mu4e-alert-enable-mode-line-display))

Multi Libvterm

(use-package multi-vterm
  :bind (("C-x M" . multi-vterm)
         ("C-x m" . multi-vterm-next)
         ;; :map projectile-mode-map
         ;; ("C-c p m" . multi-vterm-projectile)
         ))

Multiple cursors

(use-package multiple-cursors
  :defer 1)

Nucli

(use-package nucli
  :bind (("C-x N" . nucli))
  :commands (nucli)
  :load-path ("~/workspace/nu/nucli.el/src"
              "~/workspace/nu/nucli.el/test"))

Save hist mode

Save the mini buffer history.

(use-package savehist
  :hook (after-init . savehist-mode)
  :custom
  (savehist-additional-variables '(kill-ring search-ring regexp-search-ring))
  (savehist-file "~/.emacs.d/savehist"))

Save buffer as is

(defun save-buffer-as-is ()
  "Save file \"as is\", that is in read-only-mode."
  (interactive)
  (if buffer-read-only
      (save-buffer)
    (read-only-mode 1)
    (save-buffer)
    (read-only-mode 0)))

Slime

The Superior Lisp Interaction Mode for Emacs

(use-package slime
  :disabled
  :commands (slime))

Sly

SLY is Sylvester the Cat’s Common Lisp IDE for Emacs

(use-package sly
  :commands (sly))

Scheme

Use Guile as scheme program.

(use-package scheme
  :mode (("\\.scm\\'" . scheme-mode))
  :custom
  (scheme-program-name "guile"))

Smarter beginning of line

(defun smarter-move-beginning-of-line (arg)
  "Move point back to indentation of beginning of line.

Move point to the first non-whitespace character on this line.
If point is already there, move to the beginning of the line.
Effectively toggle between the first non-whitespace character and
the beginning of the line.

If ARG is not nil or 1, move forward ARG - 1 lines first.  If
point reaches the beginning or end of the buffer, stop there."
  (interactive "^p")
  (setq arg (or arg 1))

  ;; Move lines first
  (when (/= arg 1)
    (let ((line-move-visual nil))
      (forward-line (1- arg))))

  (let ((orig-point (point)))
    (back-to-indentation)
    (when (= orig-point (point))
      (move-beginning-of-line 1))))

Remap C-a to `smarter-move-beginning-of-line’

(global-set-key [remap move-beginning-of-line]
                'smarter-move-beginning-of-line)

SQL mode

Use 2 spaces for indentation in SQL mode.

(setq sql-indent-offset 0)

Load database connection settings.

(eval-after-load "sql"
  '(load-if-exists "~/.sql.el"))

SQL Indent

Support for indenting code in SQL files.

(use-package sql-indent
  :hook (sql-mode . sqlind-minor-mode))

Tramp

(use-package tramp
  :defer t
  :config
  (setq tramp-verbose 10)
  (tramp-set-completion-function
   "ssh"
   '((tramp-parse-shosts "~/.ssh/known_hosts")
     (tramp-parse-hosts "/etc/hosts"))))

Uniquify

(use-package uniquify
  :custom
  (uniquify-after-kill-buffer-p t)
  (uniquify-buffer-name-style 'post-forward-angle-brackets)
  (uniquify-ignore-buffers-re "^\\*")
  (uniquify-separator "|"))

Open AI

(use-package openai
  :defer t
  :config
  (setq openai-key #'openai-key-auth-source))

Open With

Open files with external programs.

(use-package openwith
  :hook ((after-init . openwith-mode))
  :config
  (setq openwith-associations
        (list
         (list (openwith-make-extension-regexp
                '("mpg" "mpeg" "mp3" "mp4"
                  "avi" "wmv" "wav" "mov" "flv"
                  "ogm" "ogg" "mkv"))
               "vlc"
               '(file))
         (list (openwith-make-extension-regexp
                '("doc" "xls" "ppt" "odt" "ods" "odg" "odp"))
               "libreoffice"
               '(file)))))

Orderless

(use-package orderless
  :after (vertico)
  :custom
  (completion-styles '(orderless basic))
  (completion-category-overrides
   '(;; (command (styles partial-completion))
     (file (styles basic partial-completion))
     ;; (project-file (styles orderless partial-completion))
     ;; (symbol (styles partial-completion))
     ;; (variable (styles partial-completion))
     )))

Org GCal

(use-package org-gcal
  :commands (org-gcal-fetch org-gcal-sync)
  :config
  (setq org-gcal-remove-api-cancelled-events t)
  (setq org-gcal-client-id "307472772807-cb0c244ep89qoec5sdu672st8funmqtr.apps.googleusercontent.com")
  (setq org-gcal-client-secret
        (auth-source-pick-first-password
         :host org-gcal-client-id
         :user "roman.scherer@nubank.com.br"))
  (setq org-gcal-fetch-file-alist '(("roman.scherer@nubank.com.br" .  "~/nubank-calendar.org")))
  (add-to-list 'org-agenda-files "~/nubank-calendar.org"))

Org Jira

Use Jira in Emacs org-mode.

(use-package org-jira
  :load-path ("~/workspace/org-jira")
  :commands (org-jira-get-issues)
  :config
  (make-directory org-jira-working-dir t)
  (setq jiralib-url "https://nubank.atlassian.net"))

Org mode

(use-package org
  :mode ("\\.org\\'" . org-mode)
  :config
  (require 'ob-clojure)
  (setq org-agenda-include-diary t)
  (setq org-babel-clojure-backend 'cider)
  (setq org-src-fontify-natively t)
  (setq org-confirm-babel-evaluate
        (lambda (lang body)
          (not (member lang '("plantuml")))))
  (org-babel-do-load-languages
   'org-babel-load-languages
   '((clojure . t)
     (gnuplot . t)
     (emacs-lisp . t)
     (mermaid . t)
     (plantuml . t)
     (ruby . t)
     (shell . t)
     (sql . t)
     (sqlite . t))))

Org Plus Contrib

(use-package org-plus-contrib
  :commands org-invoice-report
  :init (require 'org-invoice)
  :no-require t)

Org Present

(use-package org-present
  :commands org-present)

Org Reveal

(use-package ox-reveal
  :after (ox))

Org Roam

(use-package org-roam
  :disabled
  :after (org)
  :init
  (org-roam-db-autosync-mode)
  :custom
  (org-roam-directory (file-truename "~/workspace/org-roam")))

Org Tree Slide

A presentation tool for org-mode based on the visibility of outline trees.

(use-package org-tree-slide
  :bind
  (:map org-tree-slide-mode-map
        ("<prior>" . org-tree-slide-move-previous-tree)
        ("<next>" . org-tree-slide-move-next-tree))
  :config
  (add-hook 'org-tree-slide-mode-hook (lambda () (org-display-inline-images))))

Ox GFM

Github Flavored Markdown exporter for Org Mode.

(use-package ox-gfm
  :after (ox))

Ox Jira

JIRA Backend for Org Export Engine.

(use-package ox-jira
  :after (ox))

Pandoc

An Emacs mode for interacting with Pandoc.

(use-package pandoc-mode
  :hook markdown-mode)

The org-mode Pandoc exporter.

(use-package ox-pandoc
  :after (ox))

Paredit

(use-package paredit
  :diminish
  ;; Bind RET to nil, to fix Cider REPL buffer eval issue
  :bind (:map paredit-mode-map ("RET" . nil))
  :hook ((clojure-mode . paredit-mode)
         (clojurescript-mode . paredit-mode)
         (emacs-lisp-mode . paredit-mode)
         (lisp-mode . paredit-mode)
         (scheme-mode . paredit-mode)))

Pass

(use-package pass
  :commands (pass pass-copy))

Pepita

(use-package pepita
  :commands (pepita-new-search)
  :config
  (setq pepita-splunk-url "https://localhost:8089/services/"))

Pixel Scroll Precision Mode

When enabled, this minor mode allows to scroll the display precisely, according to the turning of the mouse wheel.

(use-package pixel-scroll
  :hook (after-init . (lambda () (pixel-scroll-precision-mode 1))))

PlantUML

(use-package plantuml-mode
  :mode (("\\.plantump\\'" . plantuml-mode)
         ("\\.plu\\'" . plantuml-mode)
         ("\\.pum\\'" . plantuml-mode)
         ("\\.uml\\'" . plantuml-mode))
  :custom
  (org-plantuml-jar-path "~/.guix-profile/share/java/plantuml.jar"))

Plz

An HTTP library for Emacs.

(use-package plz
  :defer t
  :custom
  (plz-curl-program "curl"))

Pretty Print JSON

(defun pp-json-display-expression (expression out-buffer-name)
  "Prettify and display EXPRESSION in an appropriate way, depending on length.
If a temporary buffer is needed for representation, it will be named
after OUT-BUFFER-NAME."
  (with-current-buffer (get-buffer-create out-buffer-name)
    (switch-to-buffer-other-window (current-buffer))
    (js-mode)
    (erase-buffer)
    (json-insert expression)
    (json-pretty-print-buffer)
    (beginning-of-buffer)))

(defun pp-json-eval-expression (expression)
  "Evaluate EXPRESSION and pretty-print its value.
Also add the value to the front of the list in the variable `values'."
  (interactive
   (list (read--expression "Eval: ")))
  (message "Evaluating...")
  (let ((result (eval expression lexical-binding)))
    (values--store-value result)
    (pp-json-display-expression result "*Pp JSON Eval Output*")))

(defun pp-json-eval-last-sexp (arg)
  "Run `pp-json-eval-expression' on sexp before point.
With ARG, pretty-print output into current buffer.
Ignores leading comment characters."
  (interactive "P")
  (if arg
      (insert (pp-to-string (eval (elisp--eval-defun-1
                                   (macroexpand (pp-last-sexp)))
                                  lexical-binding)))
    (pp-json-eval-expression (elisp--eval-defun-1
                              (macroexpand (pp-last-sexp))))))

Projectile

Project Interaction Library for Emacs.

(use-package projectile
  :bind
  (("C-x C-f" . projectile-find-file)
   :map projectile-command-map
   ("s g" . consult-grep)
   ("s r" . consult-ripgrep))
  :bind-keymap
  (("C-c p" . projectile-command-map))
  :custom
  (projectile-completion-system 'default)
  :config
  (add-to-list 'projectile-project-root-files-bottom-up "pubspec.yaml")
  (add-to-list 'projectile-project-root-files-bottom-up "BUILD")
  :hook
  ((after-init . projectile-mode)))

Ruby mode

Provides font-locking, indentation support, and navigation for Ruby.

(use-package ruby-mode
  :mode (("Capfile\\'" . ruby-mode)
         ("Gemfile\\'" . ruby-mode)
         ("Guardfile\\'" . ruby-mode)
         ("Rakefile\\'" . ruby-mode)
         ("Vagrantfile\\'" . ruby-mode)
         ("\\.gemspec\\'" . ruby-mode)
         ("\\.rake\\'" . ruby-mode)
         ("\\.ru\\'" . ruby-mode)))

Rainbow mode

Colorize color names in buffers.

(use-package rainbow-mode
  :defer 1)

Redshank

Common Lisp Editing Extensions (for Emacs)

Redshank is a collection of code-wrangling Emacs macros mostly geared towards Common Lisp, but some are useful for other Lisp dialects, too. Redshank’s code transformations aim to be expression-based (as opposed to character-based), thus it uses the excellent Paredit mode as editing substrate whenever possible.

(use-package redshank
  :diminish
  :hook ((emacs-lisp-mode . redshank-mode)
         (lisp-mode . redshank-mode)))

Scala Mode

(use-package scala-mode
  :interpreter ("scala" . scala-mode)
  :mode "\\.scala\\'")

SBT Mode

(use-package sbt-mode
  :commands (sbt-start sbt-command)
  :config
  ;; WORKAROUND: https://github.com/ensime/emacs-sbt-mode/issues/31
  ;; allows using SPACE when in the minibuffer
  (substitute-key-definition
   'minibuffer-complete-word
   'self-insert-command
   minibuffer-local-completion-map)
  ;; sbt-supershell kills sbt-mode:  https://github.com/hvesalai/emacs-sbt-mode/issues/152
  (setq sbt:program-options '("-Dsbt.supershell=false")))

Sendmail

(use-package sendmail
  :defer t
  :custom
  ;; Send mail via smtpmail.
  (send-mail-function 'smtpmail-send-it))

Simple

(use-package simple
  :defer t
  :custom
  ;; Use mu4e to send emails.
  (mail-user-agent 'mu4e-user-agent))

Slack

Slack client for emacs.

(use-package slack
  :disabled
  :commands (slack-start)
  :load-path ("~/.emacs.d/elpa/slack-20211129.310")
  :init
  (setq slack-buffer-emojify t)
  (setq slack-prefer-current-team t)
  :config
  (setq slack-render-image-p nil)
  (slack-register-team
   :name "nubank"
   :cookie (auth-source-pick-first-password
            :host "nubank.slack.com"
            :user "roman.scherer@nubank.com.br^cookie")
   :token (auth-source-pick-first-password
           :host "nubank.slack.com"
           :user "roman.scherer@nubank.com.br")
   :subscribed-channels '((stem))))

Startup

(use-package startup
  :custom
  ;; My email address.
  (user-mail-address "roman.scherer@burningswell.com"))

Stateful Check

(use-package stateful-check
  :disabled
  :after cider
  :load-path "~/workspace/stateful-check"
  :config
  (add-to-list 'cider-jack-in-nrepl-middlewares "stateful-check.nrepl/middleware")
  (cider-add-to-alist 'cider-jack-in-dependencies "org.clojars.czan/stateful-check" "0.4.5-SNAPSHOT"))

SMTP Mail

(use-package smtpmail
  :custom
  ;; Whether to print info in debug buffer.
  (smtpmail-debug-info t)
  ;; The name of the host running SMTP server.
  (smtpmail-smtp-server "smtp.gmail.com")
  ;; SMTP service port number.
  (smtpmail-smtp-service 587)
  ;; Type of SMTP connections to use.
  (smtpmail-stream-type 'starttls))

So Long

(global-so-long-mode 1)

Splunk

(use-package paimon
  :commands (paimon)
  :load-path
  ("~/workspace/paimon.el/src"
   "~/workspace/paimon.el/test")
  :config
  (require 'nu-paimon))

Language Server Protocol

Emacs client for the Language Server Protocol.

(use-package lsp-mode
  :bind-keymap ("C-c l" . lsp-command-map)
  :commands (lsp)
  :load-path ("~/workspace/lsp-mode"
              "~/workspace/lsp-mode/clients")
  :hook (;; (clojure-mode . lsp-deferred)
         ;; (clojure-ts-mode . lsp-deferred)
         ;; (clojurec-mode . lsp-deferred)
         ;; (clojurescript-mode . lsp-deferred)
         (dart-mode . lsp-deferred)
         (elixir-mode . lsp-deferred)
         (lsp-mode . lsp-enable-which-key-integration)
         (lsp-mode . lsp-lens-mode)
         (scala-mode . lsp-deferred)
         ;; (sql-mode . lsp-deferred)
         (terraform-mode . lsp-deferred)
         (yaml-mode . lsp-deferred))
  :custom
  (lsp-eldoc-enable-hover nil)
  (lsp-enable-indentation nil)
  (lsp-elixir-server-command '("~/workspace/elixir-ls/release/language_server.sh"))
  (lsp-file-watch-threshold nil)
  (lsp-headerline-breadcrumb-enable nil)
  (lsp-keymap-prefix "C-c l")
  (lsp-log-io t)
  (lsp-modeline-code-actions-enable nil)
  (lsp-prefer-flymake nil)
  (lsp-restart 'ignore)
  (lsp-sqls-server "~/go/bin/sqls")
  (lsp-terraform-server "~/bin/terraform-lsp")
  (lsp-ui-doc-enable nil)
  (lsp-ui-sideline-enable nil))
(use-package lsp-dart
  :after lsp-mode
  :hook dart-mode
  :custom
  (lsp-dart-dap-flutter-hot-reload-on-save t)
  (lsp-dart-dap-flutter-hot-restart-on-save nil)
  (lsp-dart-flutter-widget-guides nil)
  (lsp-dart-sdk-dir "/opt/flutter/bin/cache/dart-sdk"))
(use-package lsp-treemacs
  :after lsp-mode
  :commands lsp-treemacs-errors-list)
(use-package lsp-metals
  :after lsp-mode
  :config (setq lsp-metals-treeview-show-when-views-received nil))
(use-package lsp-java
  :disabled
  :after lsp-mode)
(use-package lsp-ui
  :after lsp-mode
  :commands lsp-ui-mode)
(use-package hover
  :defer t)
(use-package posframe
  :defer t)
(use-package dap-mode
  :load-path ("~/workspace/dap-mode")
  :hook
  (lsp-mode . dap-mode)
  (lsp-mode . dap-ui-mode))
(use-package treemacs
  :defer t)

SoundKlaus

(use-package soundklaus
  :commands
  (soundklaus-activities
   soundklaus-connect
   soundklaus-my-favorites
   soundklaus-my-playlists
   soundklaus-my-tracks
   soundklaus-playlists
   soundklaus-tracks)
  :load-path
  ("~/workspace/soundklaus.el"
   "~/workspace/soundklaus.el/test"))

stem.el

(use-package stem
  :commands (stem)
  :if (file-directory-p "~/workspace/nu/stem.el/")
  :load-path ("~/workspace/nu/stem.el/src/"
              "~/workspace/nu/stem.el/test/"))

Tabs

Don’t insert tabs.

(setq-default indent-tabs-mode nil)

Terraform

Major mode of Terraform configuration files.

(use-package terraform-mode
  :mode "\\.tf\\'")

Unfill

Functions providing the inverse of Emacs fill-paragraph and fill-region.

(use-package unfill
  :commands (unfill-region unfill-paragraph unfill-toggle))

Undo Tree

Treat undo history as a tree.

(use-package undo-tree
  :hook (after-init . global-undo-tree-mode)
  :custom
  (undo-tree-auto-save-history nil))

Vertico

Vertical Interactive Completion.

(use-package vertico
  :hook (after-init . vertico-mode)
  :custom
  (vertico-cycle t))

Virtual Env Wrapper

Virtualenv tool for Emacs.

(use-package virtualenvwrapper
  :commands (venv-workon)
  :custom
  (venv-location "~/.virtualenv"))

Vterm

Fully-fledged terminal emulator inside Emacs.

(use-package vterm
  :commands (vterm)
  :custom
  (vterm-max-scrollback 100000))

Warnings

Log and display warnings.

(use-package warnings                   ;
  :custom
  (warning-minimum-level :emergency))

Web mode

An Emacs mode for editing web templates. HTML documents can embed parts (CSS / JavaScript) and blocks (client / server side).

(use-package web-mode
  :mode (("\\.jsx\\'" . web-mode)
         ("\\.html\\'" . web-mode))
  :custom
  (web-mode-code-indent-offset 2)
  (web-mode-css-indent-offset 2)
  (web-mode-markup-indent-offset 2))

Which Key

Emacs package that displays available keybindings in popup.

(use-package which-key
  :diminish
  :config (which-key-mode))

Whisper

Speech-to-Text interface for Emacs using OpenAI’s whisper model and whisper.cpp as inference engine.

(use-package whisper
  :bind ("C-H-r" . whisper-run)
  :custom
  (whisper-model "small")
  (whisper-language "en"))

Winner mode

Restore old window configurations.

(use-package winner
  :hook ((after-init . winner-mode)))

WSD Mode

Emacs major-mode for Web Sequence Diagrams.

(use-package wsd-mode
  :mode "\\.wsd\\'")

X509

Major mode for viewing certificates, CRLs, keys, DH-parameters and ASN.1 using OpenSSL.

(use-package x509-mode
  :commands
  (x509-viewasn1
   x509-viewcert
   x509-viewcrl
   x509-viewdh
   x509-viewkey))

YAML mode

(use-package yaml-mode
  :mode (("\\.yaml\\'" . yaml-mode)
         ("\\.yaml.tmpl\\'" . yaml-mode)
         ("\\.yml\\'" . yaml-mode)))

YASnippet

The YASnippet mode.

(use-package yasnippet
  :hook ((js-mode . yas-minor-mode)
         (js2-mode . yas-minor-mode)
         (ruby-mode . yas-minor-mode)
         (sql-mode . yas-minor-mode))
  :config
  (yas-reload-all))

The YASnippet collection.

(use-package yasnippet-snippets
  :after (yasnippet)
  :defer t
  :config
  (add-to-list 'yas-snippet-dirs "~/workspace/guix/etc/snippets/yas"))

After init hook

(add-hook
 'after-init-hook
 (lambda ()

   (set-mouse-color "white")

   ;; Load system specific config.
   (load-if-exists (concat user-emacs-directory system-name ".el"))

   ;; Load keyboard bindings.
   (global-set-key (kbd "C-c C-c M-x") 'execute-extended-command)
   (global-set-key (kbd "C-c n") 'cleanup-buffer)
   (global-set-key (kbd "C-c r") 'rotate-buffers)
   (global-set-key (kbd "C-x C-b") 'list-buffers)
   (global-set-key (kbd "C-x C-o") 'delete-blank-lines)
   (global-set-key (kbd "C-x TAB") 'indent-rigidly)
   (global-set-key (kbd "C-x ^") 'enlarge-window)
   (global-set-key (kbd "C-x f") 'find-file)
   (global-set-key (kbd "C-x h") 'mark-whole-buffer)

   (define-key emacs-lisp-mode-map (kbd "C-c C-t t") 'buttercup-run-at-point)
   (define-key lisp-mode-shared-map (kbd "RET") 'reindent-then-newline-and-indent)
   (define-key read-expression-map (kbd "TAB") 'lisp-complete-symbol)))