Compare commits

..

4 Commits

Author SHA1 Message Date
Jeremy Dormitzer
050091fed2 Use evil-window-map for SPC w 2021-03-19 12:14:06 -04:00
Jeremy Dormitzer
f88496cf58 Add gcmh and move gc config to early-init.el 2021-03-19 12:13:43 -04:00
Jeremy Dormitzer
13a3837f45 Add nosetests run-command recipe 2021-03-19 12:13:19 -04:00
Jeremy Dormitzer
6d0b0c6bd9 Put emacs defaults into a use-package declaration 2021-03-19 12:12:55 -04:00
5 changed files with 70 additions and 29 deletions

View File

@ -1,7 +1,8 @@
;; -*- lexical-binding: t; -*- ;; -*- lexical-binding: t; -*-
;; Fix Emacs' bad defaults ;; Fix Emacs' bad defaults
(use-package emacs
:init
;; Save backups and autosaves in a centralized place ;; Save backups and autosaves in a centralized place
(defvar autosave-directory (expand-file-name "autosaves" user-emacs-directory)) (defvar autosave-directory (expand-file-name "autosaves" user-emacs-directory))
(defvar backup-directory (expand-file-name "backups" user-emacs-directory)) (defvar backup-directory (expand-file-name "backups" user-emacs-directory))
@ -10,7 +11,7 @@
backup-directory-alist `(("." . ,backup-directory))) backup-directory-alist `(("." . ,backup-directory)))
;; Sensible variable defaults ;; Sensible variable defaults
(setq ring-bell-function nil (setq ring-bell-function 'ignore
enable-recursive-minibuffers t enable-recursive-minibuffers t
read-process-output-max (* 1024 1024) read-process-output-max (* 1024 1024)
vc-follow-symlinks t vc-follow-symlinks t
@ -21,8 +22,19 @@
even-window-sizes nil) even-window-sizes nil)
(setq-default indent-tabs-mode nil) (setq-default indent-tabs-mode nil)
;; default to utf-8 for all the things
(set-charset-priority 'unicode)
(setq locale-coding-system 'utf-8
coding-system-for-read 'utf-8
coding-system-for-write 'utf-8)
(set-terminal-coding-system 'utf-8)
(set-keyboard-coding-system 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
(setq default-process-coding-system '(utf-8-unix . utf-8-unix))
;; Always display line numbers in text/programming modes ;; Always display line numbers in text/programming modes
(add-hook 'prog-mode-hook #'display-line-numbers-mode) (add-hook 'prog-mode-hook #'display-line-numbers-mode)
(add-hook 'text-mode-hook #'display-line-numbers-mode) (add-hook 'text-mode-hook #'display-line-numbers-mode))
(provide 'init-defaults) (provide 'init-defaults)

View File

@ -176,6 +176,26 @@
"::" "::"
(python-info-current-defun))))))))) (python-info-current-defun)))))))))
(defun run-command-recipe-nosetests()
(when (and (derived-mode-p 'python-mode)
(= 0 (call-process "python" nil nil nil "-c" "import nose")))
(let ((test-file-p (string-match-p "test" (or (buffer-file-name) ""))))
(list
(when (and (projectile-project-root)
(file-exists-p (concat (file-name-as-directory (projectile-project-root))
"tests")))
(list :command-name "test all"
:command-line "nosetests -w tests"
:working-dir (projectile-project-root)))
(when test-file-p
(list :command-name "test this file"
:command-line (format "nosetests %s" (buffer-file-name))))
(when (and test-file-p (python-info-current-defun))
(list :command-name "test this function"
:command-line (format "nosetests %s:%s"
(buffer-file-name)
(python-info-current-defun))))))))
(defun run-command-recipe-web-ext () (defun run-command-recipe-web-ext ()
(when-let* ((_ (executable-find "web-ext")) (when-let* ((_ (executable-find "web-ext"))
(manifest (locate-dominating-file default-directory "manifest.json")) (manifest (locate-dominating-file default-directory "manifest.json"))
@ -210,6 +230,7 @@
run-command-recipe-kustomize run-command-recipe-kustomize
run-command-recipe-sops run-command-recipe-sops
run-command-recipe-pytest run-command-recipe-pytest
run-command-recipe-nosetests
run-command-recipe-web-ext run-command-recipe-web-ext
run-command-recipe-pip))) run-command-recipe-pip)))

View File

@ -24,13 +24,12 @@
"7" #'winum-select-window-7 "7" #'winum-select-window-7
"8" #'winum-select-window-8 "8" #'winum-select-window-8
"9" #'winum-select-window-9 "9" #'winum-select-window-9
"w" '(nil :which-key "window") "w" '(evil-window-map :which-key "window"))
"w/" #'split-window-horizontally
"w-" #'split-window-vertically (general-def evil-window-map
"wm" #'delete-other-windows "m" #'delete-other-windows
"wd" #'delete-window "u" #'winner-undo
"wp" #'winner-undo "C-r" #'winner-redo)
"wn" #'winner-redo)
;; Condense the which-key display for window selection bindings ;; Condense the which-key display for window selection bindings
(push '(("\\(.*\\) 0" . "select-window-0") . ("\\1 0..9" . "window 0..9")) (push '(("\\(.*\\) 0" . "select-window-0") . ("\\1 0..9" . "window 0..9"))

View File

@ -0,0 +1,5 @@
;; -*- lexical-binding: t; -*-
;; Some startup time optimizations stolen from Doom emacs
(setq gc-cons-threshold most-positive-fixnum ; 2^61 bytes
gc-cons-percentage 0.6)

View File

@ -1,8 +1,6 @@
;; -*- lexical-binding: t; -*- ;; -*- lexical-binding: t; -*-
;; Some startup time optimizations stolen from Doom emacs ;; Some startup time optimizations stolen from Doom emacs
(setq gc-cons-threshold most-positive-fixnum ; 2^61 bytes
gc-cons-percentage 0.6)
(defvar file-name-handler-alist-backup file-name-handler-alist) (defvar file-name-handler-alist-backup file-name-handler-alist)
(setq file-name-handler-alist nil) (setq file-name-handler-alist nil)
(add-hook 'emacs-startup-hook (add-hook 'emacs-startup-hook
@ -37,6 +35,12 @@
(straight-use-package 'use-package) (straight-use-package 'use-package)
(setq straight-use-package-by-default t) (setq straight-use-package-by-default t)
;; "Garbage Collection Magic Hack"
(use-package gcmh
:demand t
:config
(gcmh-mode 1))
;; Fix $PATH ;; Fix $PATH
(use-package exec-path-from-shell (use-package exec-path-from-shell
:hook (after-init . exec-path-from-shell-initialize) :hook (after-init . exec-path-from-shell-initialize)