This commit is contained in:
Case Duckworth 2021-12-05 22:37:41 -06:00
parent cd3cc4f4e7
commit 58ab5fc5e2
4 changed files with 85 additions and 9 deletions

60
init.el
View File

@ -38,6 +38,19 @@
(save-buffer)))
(:hook '+init-add-setup-to-imenu))
(setup (:require auth-source)
(:option auth-sources (list (private/ "authinfo")
(private/ "authinfo.gpg")
"~/.authinfo"
"~/.authinfo.gpg")))
(setup (:require pulse)
(:also-load +pulse)
(:option pulse-flag nil
pulse-delay 0.5
pulse-iterations 1)
(+pulse-location-mode +1))
(setup calendar
(require '_location)
(:option calendar-location-name _location-name
@ -62,7 +75,8 @@
hardlink load move
shell touch symlink)
dired-dwim-target t)
(:bind "TAB" 'dired-subtree-cycle
(:bind "<backspace>" 'dired-up-directory
"TAB" 'dired-subtree-cycle
"i" 'dired-subtree-toggle
")" 'dired-git-info-mode)
(:hook 'dired-collapse-mode
@ -136,13 +150,6 @@
'display-fill-column-indicator-mode
'turn-on-auto-fill))
(setup pulse
(:also-load +pulse)
(:option pulse-flag nil
pulse-delay 0.5
pulse-iterations 1)
(+pulse-location-mode +1))
(setup text
(:hook 'turn-on-auto-fill))
@ -358,6 +365,29 @@
(with-eval-after-load 'orderless
(:option consult--regexp-compiler 'consult--orderless-regexp-compiler))))
(setup (:straight crux)
(:global "C-o" 'crux-smart-open-line
"M-o" 'crux-other-window-or-switch-buffer
"C-x 4 t" 'crux-transpose-windows)
(el-patch-feature crux)
(with-eval-after-load 'crux
(el-patch-defun crux-reopen-as-root ()
"Find file as root if necessary.
Meant to be used as `find-file-hook'.
See also `crux-reopen-as-root-mode'."
(unless (or
;; This helps fix for `nov-mode', and possibly others.
(el-patch-add (null buffer-file-name))
(tramp-tramp-file-p buffer-file-name)
(equal major-mode 'dired-mode)
(not (file-exists-p (file-name-directory buffer-file-name)))
(file-writable-p buffer-file-name)
(crux-file-owned-by-user-p buffer-file-name))
(crux-find-alternate-file-as-root buffer-file-name))))
(crux-reopen-as-root-mode +1))
(setup (:straight dictionary)
(:option dictionary-use-single-buffer t)
(autoload 'dictionary-search "dictionary"
@ -393,6 +423,10 @@
(:load-after consult embark)
(add-hook 'embark-collect-mode-hook 'consult-preview-at-point-mode))
(setup (:straight eros)
(:hook-into emacs-lisp-mode
lisp-interaction-mode))
(setup (:straight eshell-syntax-highlighting)
(:hook-into eshell-mode))
@ -693,7 +727,7 @@
(setup (:straight whitespace-cleanup-mode)
(:option whitespace-cleanup-mode-preserve-point t)
(remove-hook 'before-save-hook 'whitespace-cleanup)
;;(remove-hook 'before-save-hook 'whitespace-cleanup)
(global-whitespace-cleanup-mode +1))
(setup (:straight zzz-to-char)
@ -702,3 +736,11 @@
(interactive "P")
(call-interactively
(if prefix #'zzz-up-to-char #'zzz-to-char)))))
(setup (:straight scratch)
(:also-load +scratch)
(:option initial-major-mode 'emacs-lisp-mode
initial-scratch-message
";; ABANDON ALL HOPE YE WHO ENTER HERE")
(add-hook 'kill-buffer-query-functions '+scratch-immortal)
(add-hook 'scratch-create-buffer-hook '+scratch-buffer-setup))

View File

@ -2,6 +2,8 @@
;;; Code:
(require 'pulse)
(defgroup +pulse nil
"Extra customizations for `pulse'."
:group 'pulse

29
lisp/+scratch.el Normal file
View File

@ -0,0 +1,29 @@
;;; +scratch.el -*- lexical-binding: t; -*-
;;; Code:
(require 'scratch)
(defun +scratch-immortal ()
"Bury, don't kill \"*scratc*\" buffer.
For `kill-buffer-query-functions'."
(if (eq (current-buffer) (get-buffer "*scratch*"))
(progn (bury-buffer)
nil)
t))
(defun +scratch-buffer-setup ()
"Add comment to `scratch' buffer and name it accordingly."
(let* ((mode (format "%s" major-mode))
(string (concat "Scratch buffer for:" mode "\n\n")))
(when scratch-buffer
(save-excursion
(insert string)
(goto-char (point-min))
(comment-region (point-at-bol) (point-at-eol)))
(next-line 2))
(rename-buffer (concat "*scratch<" mode ">*") t)))
(provide '+scratch)
;;; +scratch.el ends here

View File

@ -77,5 +77,8 @@ ALIGNMENT can be one of these:
(if (eq alignment 'right) "" filler)
after)))
;;; COMMANDS
(provide '+util)
;;; +util.el ends here