about summary refs log tree commit diff
path: root/tools/emacs
diff options
context:
space:
mode:
Diffstat (limited to 'tools/emacs')
-rw-r--r--tools/emacs/config/functions.el29
-rw-r--r--tools/emacs/config/init.el19
-rw-r--r--tools/emacs/config/look-and-feel.el9
-rw-r--r--tools/emacs/default.nix20
4 files changed, 68 insertions, 9 deletions
diff --git a/tools/emacs/config/functions.el b/tools/emacs/config/functions.el
index 2b9713006837..1bec8ecd98a7 100644
--- a/tools/emacs/config/functions.el
+++ b/tools/emacs/config/functions.el
@@ -203,7 +203,7 @@
   (save-excursion
     (move-end-of-line nil)
     (insert (format " %s TODO(%s): %s"
-                    comment-start
+                    (s-trim-right comment-start)
                     (if prefix (read-string "Who needs to do this? ")
                       (getenv "USER"))
                     todo))))
@@ -238,4 +238,31 @@
   (if prefix (text-scale-adjust 0)
     (set-face-attribute 'default nil :height (or to 120))))
 
+(defun notmuch-depot-apply-patch ()
+  "Apply the currently opened notmuch message as a patch on the
+  depot."
+
+  (interactive)
+  ;; The implementation works by letting notmuch render a raw message
+  ;; and capturing it by overriding the `view-buffer' function it
+  ;; calls after rendering.
+  ;;
+  ;; The buffer is then passed to `git-am'.
+  (cl-letf (((symbol-function 'view-buffer)
+             (lambda (buffer &optional exit-action) buffer)))
+    (if-let ((raw-buffer (notmuch-show-view-raw-message)))
+        (progn
+          (with-current-buffer raw-buffer
+            (call-shell-region (point-min) (point-max) "git am -C ~/depot")
+            (message "Patch applied!")
+            (kill-buffer))
+          (magit-status "~/depot"))
+      (warn "notmuch failed to render the raw message buffer"))))
+
+(defun scrot-select ()
+  "Take a screenshot based on a mouse-selection and save it to
+  ~/screenshots."
+  (interactive)
+  (shell-command "scrot '$a_%s.png' -s -e 'mv $f ~/screenshots/'"))
+
 (provide 'functions)
diff --git a/tools/emacs/config/init.el b/tools/emacs/config/init.el
index eac109f985d0..d705274e9397 100644
--- a/tools/emacs/config/init.el
+++ b/tools/emacs/config/init.el
@@ -73,7 +73,9 @@
 (use-package multiple-cursors)
 
 (use-package notmuch
-  :bind (:map global-map ("s-g m" . notmuch)) ;; g m -> gmail
+  :bind (:map global-map
+              ("s-g m" . notmuch)
+              ("s-g M" . counsel-notmuch)) ;; g m -> gmail
   :config
   (setq notmuch-search-oldest-first nil))
 
@@ -147,6 +149,7 @@
                           (local-set-key ">" 'self-insert-command)))))
 
 (use-package f)
+(use-package geiser)
 
 (use-package go-mode
   :bind (:map go-mode-map ("C-c C-r" . recompile))
@@ -157,6 +160,12 @@
 
 (use-package haskell-mode)
 
+(use-package ielm
+  :hook ((inferior-emacs-lisp-mode . (lambda ()
+                                       (paredit-mode)
+                                       (rainbow-delimiters-mode-enable)
+                                       (company-mode)))))
+
 (use-package jq-mode
   :config (add-to-list 'auto-mode-alist '("\\.jq\\'" . jq-mode)))
 
@@ -182,6 +191,14 @@
 (use-package nginx-mode)
 (use-package rust-mode)
 
+(use-package sly
+  :hook ((sly-mrepl-mode . (lambda ()
+                             (paredit-mode)
+                             (rainbow-delimiters-mode-enable)
+                             (company-mode))))
+  :config
+  (setq common-lisp-hyperspec-root "file:///home/tazjin/docs/lisp/"))
+
 (use-package telega
   :bind (:map global-map ("s-t" . telega))
   :config (telega-mode-line-mode 1))
diff --git a/tools/emacs/config/look-and-feel.el b/tools/emacs/config/look-and-feel.el
index 98716dde6465..5a4d874f6f0d 100644
--- a/tools/emacs/config/look-and-feel.el
+++ b/tools/emacs/config/look-and-feel.el
@@ -21,10 +21,9 @@
   (mouse-wheel-mode t)
   (blink-cursor-mode -1))
 
-;; Configure editor fonts
-(let ((font (format "Input Mono-%d" 12)))
-  (setq default-frame-alist `((font-backend . "xft")
-                              (font . ,font)))
+;; Configure Emacs fonts.
+(let ((font (format "JetBrains Mono-%d" 12)))
+  (setq default-frame-alist `((font . ,font)))
   (set-frame-font font t t))
 
 ;; Configure telephone-line
@@ -37,7 +36,7 @@
   load, battery levels on all buffers."
 
   (when (bottom-right-window-p)
-      (telephone-line-raw mode-line-misc-info t)))
+    (telephone-line-raw mode-line-misc-info t)))
 
 (defun telephone-line-setup ()
   (telephone-line-defsegment telephone-line-last-window-segment ()
diff --git a/tools/emacs/default.nix b/tools/emacs/default.nix
index ce515928a279..dda7788b4355 100644
--- a/tools/emacs/default.nix
+++ b/tools/emacs/default.nix
@@ -20,6 +20,19 @@ let
   emacsBinPath = lib.makeBinPath [ third_party.telega ];
 
   identity = x: x;
+
+  # EXWM straight from GitHub. As of 2020-02-07, XELB in nixpkgs is
+  # already at a recent enough version and does not need to be
+  # overridden.
+  exwmMaster = exwm.overrideAttrs(_: {
+    src = third_party.fetchFromGitHub {
+      owner = "ch11ng";
+      repo = "exwm";
+      rev = "48db94f48bea1137132345abfe8256cfc6219248";
+      sha256 = "0jj12z6m5kvanq19gds3jpvid2mg8w28bbbq9iycl751y2sj4l1r";
+    };
+  });
+
   tazjinsEmacs = pkgfun: (emacsWithPackages(epkgs: pkgfun(
   # Actual ELPA packages (the enlightened!)
   (with epkgs.elpaPackages; [
@@ -32,6 +45,7 @@ let
 
   # MELPA packages:
   (with epkgs.melpaPackages; [
+    ace-link
     browse-kill-ring
     cargo
     clojure-mode
@@ -43,7 +57,7 @@ let
     elixir-mode
     elm-mode
     erlang
-    exwm
+    geiser
     go-mode
     gruber-darker-theme
     haskell-mode
@@ -56,6 +70,7 @@ let
     ivy-prescient
     jq-mode
     kotlin-mode
+    lispy
     lsp-mode
     magit
     markdown-toc
@@ -71,8 +86,8 @@ let
     racket-mode
     rainbow-delimiters
     refine
-    restclient
     request
+    restclient
     sly
     string-edit
     swiper
@@ -102,6 +117,7 @@ let
   # Custom packages
   (with pkgs.tools.emacs-pkgs; [
     carp-mode
+    exwmMaster
     dottime
     nix-util
     term-switcher