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; -*-
;; Fix Emacs' bad defaults
(use-package emacs
:init
;; Save backups and autosaves in a centralized place
(defvar autosave-directory (expand-file-name "autosaves" user-emacs-directory))
(defvar backup-directory (expand-file-name "backups" user-emacs-directory))
@ -10,7 +11,7 @@
backup-directory-alist `(("." . ,backup-directory)))
;; Sensible variable defaults
(setq ring-bell-function nil
(setq ring-bell-function 'ignore
enable-recursive-minibuffers t
read-process-output-max (* 1024 1024)
vc-follow-symlinks t
@ -21,8 +22,19 @@
even-window-sizes 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
(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)

View File

@ -176,6 +176,26 @@
"::"
(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 ()
(when-let* ((_ (executable-find "web-ext"))
(manifest (locate-dominating-file default-directory "manifest.json"))
@ -210,6 +230,7 @@
run-command-recipe-kustomize
run-command-recipe-sops
run-command-recipe-pytest
run-command-recipe-nosetests
run-command-recipe-web-ext
run-command-recipe-pip)))

View File

@ -24,13 +24,12 @@
"7" #'winum-select-window-7
"8" #'winum-select-window-8
"9" #'winum-select-window-9
"w" '(nil :which-key "window")
"w/" #'split-window-horizontally
"w-" #'split-window-vertically
"wm" #'delete-other-windows
"wd" #'delete-window
"wp" #'winner-undo
"wn" #'winner-redo)
"w" '(evil-window-map :which-key "window"))
(general-def evil-window-map
"m" #'delete-other-windows
"u" #'winner-undo
"C-r" #'winner-redo)
;; Condense the which-key display for window selection bindings
(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; -*-
;; 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)
(setq file-name-handler-alist nil)
(add-hook 'emacs-startup-hook
@ -37,6 +35,12 @@
(straight-use-package 'use-package)
(setq straight-use-package-by-default t)
;; "Garbage Collection Magic Hack"
(use-package gcmh
:demand t
:config
(gcmh-mode 1))
;; Fix $PATH
(use-package exec-path-from-shell
:hook (after-init . exec-path-from-shell-initialize)