diff --git a/init.el b/init.el index 2a76b3b..60707af 100644 --- a/init.el +++ b/init.el @@ -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 "" '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)) diff --git a/lisp/+pulse.el b/lisp/+pulse.el index 6ba7ded..eefdd83 100644 --- a/lisp/+pulse.el +++ b/lisp/+pulse.el @@ -2,6 +2,8 @@ ;;; Code: +(require 'pulse) + (defgroup +pulse nil "Extra customizations for `pulse'." :group 'pulse diff --git a/lisp/+scratch.el b/lisp/+scratch.el new file mode 100644 index 0000000..976b08c --- /dev/null +++ b/lisp/+scratch.el @@ -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 diff --git a/lisp/+util.el b/lisp/+util.el index 0870a71..0184a48 100644 --- a/lisp/+util.el +++ b/lisp/+util.el @@ -77,5 +77,8 @@ ALIGNMENT can be one of these: (if (eq alignment 'right) "" filler) after))) +;;; COMMANDS + + (provide '+util) ;;; +util.el ends here