diff options
Diffstat (limited to '')
-rw-r--r-- | init.el | 226 |
1 files changed, 113 insertions, 113 deletions
@@ -75,7 +75,19 @@ '((:eval (format "[%s]" (number-to-string - exwm-workspace-current-index))))))))) + exwm-workspace-current-index)))))))) + + ;; make some mode-line spaces smaller + (csetq + mode-line-format + (mapcar + (lambda (x) + (if (and (stringp x) (or (string= x " ") (string= x " "))) + " " + x)) + mode-line-format) + mode-line-buffer-identification + (propertized-buffer-identification "%10b"))) (add-hook 'after-init-hook #'b/post-init) ;; increase number of lines kept in *Messages* log @@ -95,29 +107,34 @@ ;;; Package management -(progn ; `borg' - (add-to-list 'load-path - (expand-file-name "lib/borg" user-emacs-directory)) - (require 'borg) - (borg-initialize) - (setq borg-rewrite-urls-alist - '(("git@github.com:" . "https://github.com/") - ("git@gitlab.com:" . "https://gitlab.com/")))) - -(defmacro csetq (&rest args) - "Set the value of user option VAR to VALUE. - -More generally, you can use multiple variables and values, as in - (csetq VAR VALUE VAR VALUE...) -This sets each user option VAR's value to the corresponding VALUE. - -\(fn [VAR VALUE]...)" - (declare (debug setq)) - `(progn - ,@(cl-loop for (var value) on args by 'cddr - collect - `(funcall (or (get ',var 'custom-set) #'set-default) - ',var ,value)))) +;; (progn ; `borg' +;; (add-to-list 'load-path +;; (expand-file-name "lib/borg" user-emacs-directory)) +;; (require 'borg) +;; (borg-initialize) +;; (setq borg-rewrite-urls-alist +;; '(("git@github.com:" . "https://github.com/") +;; ("git@gitlab.com:" . "https://gitlab.com/")))) + +;; variables of interest: +;; package-archive-priorities +;; package-load-list +;; package-pinned-packages + +;; (let* ((b (find-file-noselect "refinery-theme.el")) +;; (d (with-current-buffer b (package-buffer-info)))) +;; (package-generate-description-file d "refinery-theme-pkg.el")) +(run-with-idle-timer 0.01 nil #'require 'package) +(with-eval-after-load 'package + (when (= (length package-archives) 1) + (csetq + package-archives + `(,@package-archives + ("org" . "https://orgmode.org/elpa/") + ("bndl" . "https://p.bndl.org/elpa/")))) + (package-initialize)) + +(csetq package-archive-upload-base "/ssh:caffeine:~/www/p/elpa") ;;; Initial setup @@ -131,33 +148,31 @@ This sets each user option VAR's value to the corresponding VALUE. (expand-file-name (convert-standard-filename "var/") user-emacs-directory) "The directory where packages place their persistent data files.") +(defvar b/lisp-dir + (expand-file-name + (convert-standard-filename "lisp/") user-emacs-directory) + "The directory where packages place their persistent data files.") (defun b/etc (file) "Expand filename FILE relative to `b/etc-dir'." (expand-file-name (convert-standard-filename file) b/etc-dir)) (defun b/var (file) "Expand filename FILE relative to `b/var-dir'." (expand-file-name (convert-standard-filename file) b/var-dir)) +(defun b/lisp (file) + "Expand filename FILE relative to `b/lisp-dir'." + (expand-file-name (convert-standard-filename file) b/lisp-dir)) (csetq auto-save-list-file-prefix (b/var "auto-save/sessions/") nsm-settings-file (b/var "nsm-settings.el")) -(require 'auto-compile) -(auto-compile-on-load-mode) -(auto-compile-on-save-mode) -(setq auto-compile-display-buffer nil) -(setq auto-compile-mode-line-counter t) -(setq auto-compile-source-recreate-deletes-dest t) -(setq auto-compile-toggle-deletes-nonlib-dest t) -(setq auto-compile-update-autoloads t) - ;; separate custom file (don't want it mixing with init.el) (with-eval-after-load 'custom (setq custom-file (b/etc "custom.el")) (when (file-exists-p custom-file) (load custom-file)) ;; while at it, treat themes as safe - (setf custom-safe-themes t) + ;; (setf custom-safe-themes t) ;; only one custom theme at a time (comment (defadvice load-theme (before clear-previous-themes activate) @@ -289,12 +304,11 @@ This sets each user option VAR's value to the corresponding VALUE. ;; lazy-person-friendly yes/no prompts (defalias 'yes-or-no-p #'y-or-n-p) -;; enable automatic reloading of changed buffers and files -(progn ; autorevert - (csetq auto-revert-verbose nil - global-auto-revert-non-file-buffers nil) - (require 'autorevert) - (global-auto-revert-mode 1)) +;; autorevert: enable automatic reloading of changed buffers and files +(csetq auto-revert-verbose nil + global-auto-revert-non-file-buffers nil) +(require 'autorevert) +(global-auto-revert-mode 1) ;; time and battery in mode-line (csetq @@ -307,7 +321,7 @@ This sets each user option VAR's value to the corresponding VALUE. (require 'time) (display-time-mode) -(csetq battery-mode-line-format "%p%% %t") +(csetq battery-mode-line-format " %p%% %t") (require 'battery) (display-battery-mode) @@ -451,6 +465,7 @@ This sets each user option VAR's value to the corresponding VALUE. (require 'bandali-theme) ;; magit, *the* right way to do git +(comment (csetq transient-history-file (b/var "transient/history.el") transient-levels-file (b/etc "transient/levels.el") transient-values-file (b/etc "transient/values.el")) @@ -492,26 +507,27 @@ This sets each user option VAR's value to the corresponding VALUE. (global-set-key (kbd "C-c g b") #'magit-blame-addition) (global-set-key (kbd "C-c g l") #'magit-log-buffer-file) (global-set-key (kbd "C-c g y") #'magit-pop-revision-stack) +) ;; recently opened files +(csetq recentf-max-saved-items 2000 + recentf-save-file (b/var "recentf-save.el")) (run-with-idle-timer 0.2 nil #'require 'recentf) (with-eval-after-load 'recentf - (csetq recentf-max-saved-items 2000 - recentf-save-file (b/var "recentf-save.el")) - (add-to-list 'recentf-keep #'file-remote-p) + ;; (add-to-list 'recentf-keep #'file-remote-p) (recentf-mode)) ;; needed for history for counsel (csetq amx-save-file (b/var "amx-save.el")) +(add-to-list 'load-path (b/lisp "s")) +(add-to-list 'load-path (b/lisp "amx")) (run-with-idle-timer 0.3 nil #'require 'amx) (with-eval-after-load 'amx (amx-mode)) -;; (require 'bandali-ido) (require 'bandali-ivy) (require 'bandali-eshell) -;; (require 'bandali-multi-term) (require 'bandali-ibuffer) @@ -549,8 +565,9 @@ This sets each user option VAR's value to the corresponding VALUE. (with-eval-after-load 'help (temp-buffer-resize-mode) - (csetq help-window-select t) + (csetq help-window-select t)) +(with-eval-after-load 'help-mode ;; local key bindings (define-key help-mode-map (kbd "p") #'backward-button) (define-key help-mode-map (kbd "n") #'forward-button)) @@ -578,12 +595,15 @@ This sets each user option VAR's value to the corresponding VALUE. (require 'bandali-message) (require 'bandali-ebdb) -;; IRC (with ERC and ZNC) +;; IRC (with ERC) (require 'bandali-erc) +(add-to-list 'load-path (b/lisp "scpaste")) (with-eval-after-load 'scpaste (csetq scpaste-http-destination "https://p.bndl.org" scpaste-scp-destination "p:~")) +(autoload 'scpaste "scpaste" nil t) +(autoload 'scpaste-region "scpaste" nil t) (global-set-key (kbd "C-c a p p") #'scpaste) (global-set-key (kbd "C-c a p r") #'scpaste-region) @@ -593,7 +613,8 @@ This sets each user option VAR's value to the corresponding VALUE. ;; display Lisp objects at point in the echo area (when (version< "25" emacs-version) (with-eval-after-load 'eldoc - (global-eldoc-mode))) + (csetq eldoc-minor-mode-string " eldoc") + (global-eldoc-mode))) ;; highlight matching parens (require 'paren) @@ -609,7 +630,7 @@ This sets each user option VAR's value to the corresponding VALUE. ;; yanking (pasting) what I'd originally intended to. save-interprogram-paste-before-kill t) (with-eval-after-load 'simple - (column-number-mode)) + (column-number-mode 1)) ;; save minibuffer history (require 'savehist) @@ -628,7 +649,7 @@ This sets each user option VAR's value to the corresponding VALUE. (global-prettify-symbols-mode)) (add-hook 'prog-mode-hook #'indicate-buffer-boundaries-left) -(define-key text-mode-map (kbd "C-*") #'b/insert-asterism) +(define-key text-mode-map (kbd "C-<return>") #'b/insert-asterism) (add-hook 'text-mode-hook #'indicate-buffer-boundaries-left) (add-hook 'text-mode-hook #'flyspell-mode) @@ -636,6 +657,9 @@ This sets each user option VAR's value to the corresponding VALUE. (add-to-list 'auto-mode-alist '("\\.bashrc$" . sh-mode)) +(with-eval-after-load 'flyspell + (csetq flyspell-mode-line-string " fly")) + ;; flycheck ;; (run-with-idle-timer 0.6 nil #'require 'flycheck) ;; (with-eval-after-load 'flycheck @@ -676,7 +700,7 @@ This sets each user option VAR's value to the corresponding VALUE. ;; #'endless/replace-quote)) ;; abbrev -(csetq abbrev-file-name (b/var "abbrev.el")) +(csetq abbrev-file-name (b/etc "abbrev.el")) (add-hook 'text-mode-hook #'abbrev-mode) @@ -687,6 +711,9 @@ This sets each user option VAR's value to the corresponding VALUE. (setq indent-tabs-mode nil)) (add-hook 'lisp-interaction-mode-hook #'indent-spaces-mode)) +;; alloy +(add-to-list 'load-path (b/lisp "alloy-mode")) +(autoload 'alloy-mode "alloy-mode" nil t) (with-eval-after-load 'alloy-mode (csetq alloy-basic-offset 2) ;; (defun b/alloy-simple-indent (start end) @@ -744,57 +771,20 @@ This sets each user option VAR's value to the corresponding VALUE. (with-eval-after-load 'man (csetq Man-width 80)) -(run-with-idle-timer 0.4 nil #'require 'which-key) -(with-eval-after-load 'which-key - (csetq - which-key-add-column-padding 5 - which-key-idle-delay 10000 - which-key-idle-secondary-delay 0.05 - which-key-max-description-length 32 - which-key-show-early-on-C-h t) - (which-key-add-key-based-replacements - ;; prefixes for global prefixes and minor modes - "C-c !" "flycheck" - "C-x RET" "coding system" - "C-x 8" "unicode" - "C-x @" "event modifiers" - "C-x a" "abbrev/expand" - "C-x r" "rectangle/register/bookmark" - "C-x t" "tabs" - "C-x v" "version control" - "C-x X" "edebug" - "C-x C-a" "edebug" - "C-x C-k" "kmacro" - ;; prefixes for my personal bindings - "C-c &" "yasnippet" - "C-c a" "applications" - "C-c a e" "erc" - "C-c a o" "org" - "C-c a s" "shells" - "C-c b" "buffers" - "C-c c" "compile-and-comments" - "C-c e" "eval" - "C-c f" "files" - "C-c F" "frames" - "C-c g" "magit" - "C-S-h" "help(ful)" - "C-c q" "boxquote" - "C-c t" "themes") - ;; prefixes for major modes - (which-key-add-major-mode-key-based-replacements 'org-mode - "C-c C-v" "org-babel") - (which-key-mode)) - -;; (require 'bandali-projectile) - -(run-with-idle-timer 0.6 nil #'require 'unkillable-scratch) -(with-eval-after-load 'unkillable-scratch - (csetq unkillable-buffers '("^\\*scratch\\*$" "^\\*Messages\\*$")) - (unkillable-scratch 1)) +(defun b/*scratch* () + "Switch to `*scratch*' buffer, creating it if it does not exist." + (interactive) + (switch-to-buffer + (or (get-buffer "*scratch*") + (with-current-buffer (get-buffer-create "*scratch*") + (set-buffer-major-mode (current-buffer)) + (current-buffer))))) +(global-set-key (kbd "C-c s") #'b/*scratch*) ;; ,---- ;; | make pretty boxed quotes like this ;; `---- +(add-to-list 'load-path (b/lisp "boxquote")) (run-with-idle-timer 0.6 nil #'require 'boxquote) (with-eval-after-load 'boxquote (defvar b/boxquote-prefix-map) @@ -821,11 +811,13 @@ This sets each user option VAR's value to the corresponding VALUE. (define-key b/boxquote-prefix-map (kbd "M-q") #'boxquote-fill-paragraph) (define-key b/boxquote-prefix-map (kbd "M-w") #'boxquote-kill-ring-save)) +(add-to-list 'load-path (b/lisp "hl-todo")) (run-with-idle-timer 0.5 nil #'require 'hl-todo) (with-eval-after-load 'hl-todo ;; highlight TODOs in buffers (global-hl-todo-mode)) +(add-to-list 'load-path (b/lisp "page-break-lines")) (run-with-idle-timer 0.5 nil #'require 'page-break-lines) (with-eval-after-load 'page-break-lines (csetq page-break-lines-max-width fill-column) @@ -897,14 +889,12 @@ This sets each user option VAR's value to the corresponding VALUE. (getenv "XDG_DOWNLOAD_DIR"))) (global-set-key (kbd "C-c a e w") #'eww) -(comment - -;; org-ref -(csetq - reftex-default-bibliography '("~/usr/org/references.bib") - org-ref-default-bibliography '("~/usr/org/references.bib") - org-ref-bibliography-notes "~/usr/org/notes.org" - org-ref-pdf-directory "~/usr/org/bibtex-pdfs/") +;; ;; org-ref +;; (csetq +;; reftex-default-bibliography '("~/usr/org/references.bib") +;; org-ref-default-bibliography '("~/usr/org/references.bib") +;; org-ref-bibliography-notes "~/usr/org/notes.org" +;; org-ref-pdf-directory "~/usr/org/bibtex-pdfs/") ;; fill-column-indicator ? @@ -933,8 +923,8 @@ This sets each user option VAR's value to the corresponding VALUE. (global-set-key (kbd "C-c w L") #'windmove-swap-states-right) ;; pass -(global-set-key (kbd "C-c a p") #'pass) -(add-hook 'pass-mode-hook #'View-exit) +;; (global-set-key (kbd "C-c a p") #'pass) +;; (add-hook 'pass-mode-hook #'View-exit) ;; reftex ;; uncomment to disable reftex-cite's default choice of previous word @@ -950,16 +940,26 @@ This sets each user option VAR's value to the corresponding VALUE. (add-hook 'latex-mode-hook #'reftex-mode) ;; dmenu -(csetq - dmenu-prompt-string "run: " - dmenu-save-file (b/var "dmenu-items")) +;; (csetq +;; dmenu-prompt-string "run: " +;; dmenu-save-file (b/var "dmenu-items")) ;; eosd ? +;; delight +(run-with-idle-timer 0.5 nil #'require 'delight) +(with-eval-after-load 'delight + (delight 'auto-fill-function " f" "simple") + (delight 'abbrev-mode "" "abbrev") + (delight 'page-break-lines-mode "" "page-break-lines") + (delight 'ivy-mode "" "ivy") + (delight 'counsel-mode "" "counsel") + (delight 'mml-mode " mml" "mml") + (delight 'yas-minor-mode "" "yasnippet")) + ;;; Post initialization -) (message "Loading %s...done (%.3fs)" user-init-file (float-time (time-subtract (current-time) b/before-user-init-time))) |