about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2023-05-22 14:33:04 -0500
committerCase Duckworth2023-05-22 14:33:04 -0500
commit13622da22705d0b41dd9743e7733bd1e1f1435f1 (patch)
tree92ea452249576549e0ab8a30b70b086556e08724
parentRip off use-package's `autoload-keymap' thing (diff)
downloadetc-13622da22705d0b41dd9743e7733bd1e1f1435f1.tar.gz
etc-13622da22705d0b41dd9743e7733bd1e1f1435f1.zip
Make changes and stuff
- Add inhibit-messages macro
- Add delete-window-or-bury-buffer
- Move stuff around
- Add comments
- Add persist-settings-mode
- Random other shit
-rw-r--r--emacs.el285
1 files changed, 216 insertions, 69 deletions
diff --git a/emacs.el b/emacs.el index e9e658c..6a2e13b 100644 --- a/emacs.el +++ b/emacs.el
@@ -22,24 +22,50 @@
22 22
23;;; Definitions: 23;;; Definitions:
24 24
25(defmacro autoload-keymap (keymap library &optional parent-keymap) 25(defmacro inhibit-messages (&rest body)
26 "Require LIBRARY to load KEYMAP-SYMBOL, then press the buttons again. 26 "Inhibit all messages in BODY."
27This rips off `use-package-autoload-keymap' basically." 27 (declare (indent defun))
28 `(defun ,(intern (format "autoload-keymap-" keymap)) () 28 `(cl-letf (((symbol-function 'message) #'ignore))
29 (interactive) 29 ,@body))
30 (unless (featurep ',library) 30
31 (require ',(cond 31(defmacro comment (message &rest _ignore)
32 ((symbolp library) 32 "Comment out lisp forms.
33 library) 33MESSAGE is for documentation purposes."
34 ((stringp library) 34 (declare (indent defun))
35 (intern library)) 35 t)
36 (t (user-error "LIBRARY should be a symbol or string: %s" 36
37 library)))) 37(defmacro uncomment (message &rest body)
38 (let ((kv (this-command-keys-vector))) 38 "Uncomment a commented form."
39 (define-key ,(or parent-keymap (current-global-map)) kv ,keymap) 39 (declare (indent defun))
40 (setq unread-command-events 40 `(progn ,@body))
41 (mapcar (lambda (ev) (cons t ev)) 41
42 (listify-key-sequence kv))))))) 42(comment
43 (defun autoload-keymap (keymap library &optional parent-keymap)
44 "Require LIBRARY to load KEYMAP-SYMBOL, then press the buttons again.
45If PARENT-KEYMAP is given, map KEYMAP within it; otherwise, use
46`current-global-map'. This rips off `use-package-autoload-keymap'
47basically."
48 (lambda () (interactive)
49 (unless (featurep library)
50 (require (cond ((symbolp library) library)
51 ((stringp library) (intern library))
52 (t (user-error "LIBRARY should be a symbol or string: %s"
53 library)))))
54 (let ((kv (this-command-keys-vector)))
55 (define-key (or parent-keymap (current-global-map))
56 kv
57 (symbol-value keymap))
58 (setq unread-command-events
59 (mapcar (lambda (ev) (cons t ev))
60 (listify-key-sequence kv)))))))
61
62(defun autoload-keymap (keymap-symbol package)
63 (require package)
64 (let ((kv (this-command-keys-vector)))
65 (global-set-key kv (symbol-value keymap-symbol))
66 (setq unread-command-events
67 (mapcar (lambda (ev) (cons t ev))
68 (listify-key-sequence kv)))))
43 69
44(defun renz/sort-by-alpha-length (elems) 70(defun renz/sort-by-alpha-length (elems)
45 "Sort ELEMS first alphabetically, then by length." 71 "Sort ELEMS first alphabetically, then by length."
@@ -166,6 +192,14 @@ run with \\[universal-argument], unconditionally switch buffer."
166 (switch-to-buffer (other-buffer) nil t) 192 (switch-to-buffer (other-buffer) nil t)
167 (other-window 1))) 193 (other-window 1)))
168 194
195(defun delete-window-or-bury-buffer ()
196 "Delete the current window or bury its buffer.
197If the current window is the only window in the frame, bury its
198buffer instead."
199 (interactive)
200 (unless (ignore-errors (delete-window) t)
201 (bury-buffer)))
202
169(defun cycle-spacing@ (&optional n) 203(defun cycle-spacing@ (&optional n)
170 ;; `cycle-spacing' is wildly different in 29.1 over 28. 204 ;; `cycle-spacing' is wildly different in 29.1 over 28.
171 "Negate N argument on `cycle-spacing'. 205 "Negate N argument on `cycle-spacing'.
@@ -309,17 +343,6 @@ With prefix ARG, toggle the value of
309(put 'browse-url-browser-function 'safe-local-variable 343(put 'browse-url-browser-function 'safe-local-variable
310 'browse-url-browser-function-safe-p) 344 'browse-url-browser-function-safe-p)
311 345
312(defmacro comment (message &rest _ignore)
313 "Comment out lisp forms.
314MESSAGE is for documentation purposes."
315 (declare (indent 1))
316 t)
317
318(defmacro uncomment (message &rest body)
319 "Uncomment a commented form."
320 (declare (indent 1))
321 `(progn ,@body))
322
323 346
324;;; Packages: 347;;; Packages:
325 348
@@ -359,9 +382,6 @@ If REQUIRE is a non-nil value, require the package after adding it."
359(ensure-package 'marginalia nil t) 382(ensure-package 'marginalia nil t)
360(ensure-package 'visual-fill-column) 383(ensure-package 'visual-fill-column)
361(ensure-package 'adaptive-wrap) 384(ensure-package 'adaptive-wrap)
362(ensure-package 'geiser)
363(when (executable-find "csi")
364 (ensure-package 'geiser-chicken))
365(ensure-package 'avy) 385(ensure-package 'avy)
366(ensure-package 'zzz-to-char) 386(ensure-package 'zzz-to-char)
367(ensure-package 'hungry-delete) 387(ensure-package 'hungry-delete)
@@ -373,17 +393,11 @@ If REQUIRE is a non-nil value, require the package after adding it."
373;; Local packages 393;; Local packages
374(ensure-package 'scule t) 394(ensure-package 'scule t)
375(ensure-package 'frowny t) 395(ensure-package 'frowny t)
376(ensure-package 'hippie-completing-read t)
377(ensure-package 'mode-line-bell t) 396(ensure-package 'mode-line-bell t)
378(ensure-package 'titlecase t) 397(ensure-package 'titlecase t)
379(ensure-package 'jabber t)
380 398
381;;; Jabber 399;;; Jabber
382 400(ensure-package 'jabber t t)
383(ensure-package 'jabber t)
384(add-to-list 'load-path
385 (expand-file-name "jabber-fallback-lib"
386 "~/src/jabber.el/"))
387 401
388(setopt jabber-chat-buffer-format "*%n*") 402(setopt jabber-chat-buffer-format "*%n*")
389(setopt jabber-browse-buffer-format "*%n*") 403(setopt jabber-browse-buffer-format "*%n*")
@@ -433,6 +447,15 @@ If REQUIRE is a non-nil value, require the package after adding it."
433(setopt jabber-chat-foreign-prompt-format "%n. ") 447(setopt jabber-chat-foreign-prompt-format "%n. ")
434(setopt jabber-muc-private-foreign-prompt-format "%g/%n. ") 448(setopt jabber-muc-private-foreign-prompt-format "%g/%n. ")
435 449
450(defun jabber-connect-all* (&optional arg)
451 "Connect to all defined jabber accounts.
452If called with ARG non-nil, or with \\[universal-argument],
453disconnect first."
454 (interactive "P")
455 (when arg (jabber-disconnect))
456 (jabber-connect-all))
457(keymap-global-set "C-c j c" #'jabber-connect-all*)
458
436(keymap-global-set "C-c C-SPC" #'jabber-activity-switch-to) 459(keymap-global-set "C-c C-SPC" #'jabber-activity-switch-to)
437(with-eval-after-load 'jabber 460(with-eval-after-load 'jabber
438 (require 'jabber-httpupload nil t) 461 (require 'jabber-httpupload nil t)
@@ -440,13 +463,16 @@ If REQUIRE is a non-nil value, require the package after adding it."
440 (define-key jabber-global-keymap (vector (+ key #x60)) command)) 463 (define-key jabber-global-keymap (vector (+ key #x60)) command))
441 jabber-global-keymap) 464 jabber-global-keymap)
442 (keymap-global-set "C-x C-j" #'dired-jump)) 465 (keymap-global-set "C-x C-j" #'dired-jump))
443
444(keymap-global-set "C-c j" (autoload-keymap jabber-global-keymap jabber))
445(keymap-global-set "C-x C-j" #'dired-jump) 466(keymap-global-set "C-x C-j" #'dired-jump)
446 467
447(add-hook 'jabber-post-connect-hooks #'jabber-enable-carbons) 468(with-eval-after-load 'dired
469 (keymap-set dired-mode-map "C-j" #'dired-up-directory))
470
471(keymap-global-set "C-c j" jabber-global-keymap)
472
448(remove-hook 'jabber-alert-muc-hooks 'jabber-muc-echo) 473(remove-hook 'jabber-alert-muc-hooks 'jabber-muc-echo)
449(remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo) 474(remove-hook 'jabber-alert-presence-hooks 'jabber-presence-echo)
475(add-hook 'jabber-post-connect-hooks #'jabber-enable-carbons)
450(add-hook 'jabber-chat-mode-hook 'visual-line-mode) 476(add-hook 'jabber-chat-mode-hook 'visual-line-mode)
451 477
452(add-hook 'jabber-chat-mode-hook 478(add-hook 'jabber-chat-mode-hook
@@ -479,6 +505,7 @@ If REQUIRE is a non-nil value, require the package after adding it."
479;;; General keybinding changes 505;;; General keybinding changes
480 506
481(keymap-global-set "M-o" #'other-window-or-switch-buffer) 507(keymap-global-set "M-o" #'other-window-or-switch-buffer)
508(keymap-global-set "C-x 0" #'delete-window-or-bury-buffer)
482(keymap-global-set "M-SPC" #'cycle-spacing@) 509(keymap-global-set "M-SPC" #'cycle-spacing@)
483(keymap-global-set "M-u" #'universal-argument) 510(keymap-global-set "M-u" #'universal-argument)
484(keymap-set universal-argument-map "M-u" #'universal-argument-more) 511(keymap-set universal-argument-map "M-u" #'universal-argument-more)
@@ -494,6 +521,7 @@ If REQUIRE is a non-nil value, require the package after adding it."
494(setopt modus-themes-bold-constructs nil) 521(setopt modus-themes-bold-constructs nil)
495(setopt modus-themes-italic-constructs t) 522(setopt modus-themes-italic-constructs t)
496(setopt modus-themes-variable-pitch-ui t) 523(setopt modus-themes-variable-pitch-ui t)
524(setopt modus-themes-disable-other-themes t)
497 525
498(add-hook 'modus-themes-after-load-theme-hook #'reset-faces) 526(add-hook 'modus-themes-after-load-theme-hook #'reset-faces)
499(add-hook 'after-init-hook #'reset-faces) 527(add-hook 'after-init-hook #'reset-faces)
@@ -555,13 +583,17 @@ mouse-3: Toggle minor modes"
555 mode-line-end-spaces))) 583 mode-line-end-spaces)))
556 584
557;; Remove modes from mode-line 585;; Remove modes from mode-line
558(dolist (minor-mode '(frowny-mode 586(defun hide-minor (mode &optional hook)
559 whitespace-mode 587 "Hide MODE from the mode line.
560 hungry-delete-mode)) 588HOOK defaults to MODE-hook, and is used to trigger the hiding."
561 (setf (alist-get minor-mode minor-mode-alist) (list "")) 589 (setf (alist-get mode minor-mode-alist) (list ""))
562 (add-hook (intern (format "%s-hook" minor-mode)) 590 (add-hook (intern (or hook (format "%s-hook" mode)))
563 (lambda () 591 (lambda ()
564 (setf (alist-get minor-mode minor-mode-alist) (list ""))))) 592 (setf (alist-get mode minor-mode-alist) (list "")))))
593
594(hide-minor 'frowny-mode)
595(hide-minor 'whitespace-mode)
596(hide-minor 'hungry-delete-mode)
565 597
566(scroll-bar-mode -1) 598(scroll-bar-mode -1)
567(menu-bar-mode -1) 599(menu-bar-mode -1)
@@ -584,16 +616,31 @@ mouse-3: Toggle minor modes"
584 616
585(keymap-global-set "M-=" #'count-words) 617(keymap-global-set "M-=" #'count-words)
586 618
619;;; Geiser & Scheme
620
621(ensure-package 'geiser)
622(when (executable-find "csi")
623 (ensure-package 'geiser-chicken))
624(setopt scheme-program-name (or (executable-find "csi")
625 "scheme"))
587(with-eval-after-load 'scheme 626(with-eval-after-load 'scheme
588 (keymap-unset scheme-mode-map "M-o" t) 627 (keymap-unset scheme-mode-map "M-o" t)
589 ;; Comparse "keywords" --- CHICKEN (http://wiki.call-cc.org/eggref/5/comparse) 628 ;; Comparse "keywords" --- CHICKEN (http://wiki.call-cc.org/eggref/5/comparse)
590 (put 'sequence* 'scheme-indent-function 1) 629 (put 'sequence* 'scheme-indent-function 1)
591 (put 'satisfies 'scheme-indent-function 1) 630 (put 'satisfies 'scheme-indent-function 1)
592 (add-hook 'scheme-mode-hook #'geiser-mode)) 631 (add-hook 'scheme-mode-hook #'geiser-mode))
632
633(setopt gieser-autodoc-delay 0.1)
634
635
593(with-eval-after-load 'geiser-mode 636(with-eval-after-load 'geiser-mode
594 (keymap-set geiser-mode-map "C-c C-k" #'geiser-eval-buffer-and-go) 637 (keymap-set geiser-mode-map "C-c C-k" #'geiser-eval-buffer-and-go)
595 (keymap-unset geiser-mode-map "C-." t)) 638 (keymap-unset geiser-mode-map "C-." t)
639 (add-hook 'geiser-repl-startup-hook
640 (defun geiser-add-default-directory-to-load-path ()
641 (geiser-add-to-load-path default-directory))))
596 642
643;;; Visual fill column
597 644
598(with-eval-after-load 'visual-fill-column 645(with-eval-after-load 'visual-fill-column
599 (setopt visual-fill-column-center-text t) 646 (setopt visual-fill-column-center-text t)
@@ -602,6 +649,8 @@ mouse-3: Toggle minor modes"
602(add-hook 'visual-line-mode-hook #'visual-fill-column-mode) 649(add-hook 'visual-line-mode-hook #'visual-fill-column-mode)
603(add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode) 650(add-hook 'visual-line-mode-hook #'adaptive-wrap-prefix-mode)
604 651
652;;; Set major mode for non-file buffers
653
605(setopt major-mode 654(setopt major-mode
606 (lambda () ; guess major mode from buffer name 655 (lambda () ; guess major mode from buffer name
607 (unless buffer-file-name 656 (unless buffer-file-name
@@ -688,6 +737,10 @@ mouse-3: Toggle minor modes"
688 (set-selection-coding-system 'utf-8) 737 (set-selection-coding-system 'utf-8)
689 (set-clipboard-coding-system 'utf-8))) 738 (set-clipboard-coding-system 'utf-8)))
690 739
740(setopt x-underline-at-descent-line t)
741(setopt blink-cursor-delay 0.25)
742(setopt blink-cursor-interval 0.25)
743(setopt blink-cursor-blinks 1)
691 744
692;; Files 745;; Files
693(setopt auto-revert-verbose nil) 746(setopt auto-revert-verbose nil)
@@ -765,6 +818,28 @@ mouse-3: Toggle minor modes"
765(winner-mode) 818(winner-mode)
766 819
767;;; Hooks 820;;; Hooks
821
822(defcustom persist-settings-hook nil
823 "Functions to run in order to persist settings."
824 :type 'hook)
825
826(defun persist-settings ()
827 (inhibit-messages
828 (run-with-idle-timer 5 nil #'run-hooks 'persist-settings-hook)))
829
830(defvar persist-timer
831 (run-with-timer nil 60 #'persist-settings)
832 "Timer running `persist-settings-hook'.")
833
834(add-hook 'persist-settings-hook #'save-place-kill-emacs-hook)
835(add-hook 'persist-settings-hook #'recentf-save-list)
836(add-hook 'persist-settings-hook #'savehist-autosave)
837(add-hook 'persist-settings-hook #'bookmark-exit-hook-internal)
838(with-eval-after-load 'em-hist
839 (add-hook 'persist-settings-hook #'eshell-save-some-history))
840(with-eval-after-load 'prescient
841 (add-hook 'persist-settings-hook #'prescient--save))
842
768(add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p) 843(add-hook 'after-save-hook #'executable-make-buffer-file-executable-if-script-p)
769(add-hook 'find-file-not-found-functions #'create-missing-directories) 844(add-hook 'find-file-not-found-functions #'create-missing-directories)
770(add-hook 'find-file-hook #'vc-remote-off) 845(add-hook 'find-file-hook #'vc-remote-off)
@@ -784,12 +859,41 @@ mouse-3: Toggle minor modes"
784 859
785(keymap-global-set "C-c a" #'org-agenda) 860(keymap-global-set "C-c a" #'org-agenda)
786(keymap-global-set "C-c c" #'org-capture) 861(keymap-global-set "C-c c" #'org-capture)
787(setopt org-clock-clocked-in-display nil) 862
863(setopt org-clock-clocked-in-display 'mode-line)
788(setopt org-clock-out-remove-zero-time-clocks t) 864(setopt org-clock-out-remove-zero-time-clocks t)
789(setopt org-clock-frame-title-format '("%b" " - " (t org-mode-line-string))) 865(setopt org-clock-frame-title-format '("%b" " - " (t org-mode-line-string)))
790(setopt org-tags-column (- (- fill-column 3))) 866(setopt org-tags-column (- (- fill-column 3)))
791(setopt org-log-into-drawer t) 867(setopt org-log-into-drawer t)
792(setopt org-clock-into-drawer t) 868(setopt org-clock-into-drawer t)
869(setopt org-special-ctrl-a/e t)
870
871(defmacro org-insert-or-surround (character)
872 (let ((c (gensym)))
873 `(defun ,(intern (format "org-insert-or-surround-%s" character)) (arg)
874 ,(format "Insert %s or surround the region with it." character)
875 (interactive "p")
876 (let ((,c ,(if (stringp character)
877 (string-to-char character)
878 character)))
879 (if (org-region-active-p)
880 (let ((begin (region-beginning))
881 (end (region-end)))
882 (save-mark-and-excursion
883 (deactivate-mark)
884 (goto-char begin)
885 (self-insert-command arg ,c)
886 (goto-char (+ 1 end))
887 (self-insert-command arg ,c)))
888 (self-insert-command arg ,c))))))
889
890(with-eval-after-load 'org
891 (keymap-set org-mode-map "*" (org-insert-or-surround "*"))
892 (keymap-set org-mode-map "/" (org-insert-or-surround "/"))
893 (keymap-set org-mode-map "_" (org-insert-or-surround "_"))
894 (keymap-set org-mode-map "=" (org-insert-or-surround "="))
895 (keymap-set org-mode-map "~" (org-insert-or-surround "~"))
896 (keymap-set org-mode-map "+" (org-insert-or-surround "+")))
793 897
794;; Fix braindead behavior 898;; Fix braindead behavior
795(with-eval-after-load 'org-mouse 899(with-eval-after-load 'org-mouse
@@ -919,7 +1023,7 @@ itself. Other values of ARG will call `newline' with that ARG."
919 1023
920(with-eval-after-load 'org 1024(with-eval-after-load 'org
921 (keymap-set org-mode-map "RET" #'org-return-dwim) 1025 (keymap-set org-mode-map "RET" #'org-return-dwim)
922 (keymap-set org-mode-map "S-RET" #'org-table-copy-down|org-return-dwim)) 1026 (keymap-set org-mode-map "S-<return>" #'org-table-copy-down|org-return-dwim))
923 1027
924;;; Copy rich text to the keyboard 1028;;; Copy rich text to the keyboard
925 1029
@@ -1054,8 +1158,7 @@ ORG-EXPORT-ARGS are passed to `org-export-to-buffer'."
1054(add-hook 'jabber-chat-mode-hook #'frowny-mode) 1158(add-hook 'jabber-chat-mode-hook #'frowny-mode)
1055(add-hook 'jabber-chat-mode-hook #'electric-pair-local-mode-disable) 1159(add-hook 'jabber-chat-mode-hook #'electric-pair-local-mode-disable)
1056 1160
1057(autoload 'hippie-completing-read "hippie-completing-read" nil t) 1161(keymap-global-set "M-/" #'hippie-expand)
1058(keymap-global-set "M-/" #'hippie-completing-read)
1059 1162
1060(setopt mode-line-bell-flash-time 0.25) 1163(setopt mode-line-bell-flash-time 0.25)
1061(autoload 'mode-line-bell-mode "mode-line-bell" nil t) 1164(autoload 'mode-line-bell-mode "mode-line-bell" nil t)
@@ -1083,7 +1186,6 @@ ORG-EXPORT-ARGS are passed to `org-export-to-buffer'."
1083(file-name-shadow-mode) 1186(file-name-shadow-mode)
1084(minibuffer-electric-default-mode) 1187(minibuffer-electric-default-mode)
1085 1188
1086(setopt completion-styles '(flex basic partial-completion emacs22))
1087(setopt completion-ignore-case t) 1189(setopt completion-ignore-case t)
1088(setopt read-buffer-completion-ignore-case t) 1190(setopt read-buffer-completion-ignore-case t)
1089(setopt read-file-name-completion-ignore-case t) 1191(setopt read-file-name-completion-ignore-case t)
@@ -1099,14 +1201,22 @@ ORG-EXPORT-ARGS are passed to `org-export-to-buffer'."
1099(add-hook 'completion-list-mode-hook #'truncate-lines-mode) 1201(add-hook 'completion-list-mode-hook #'truncate-lines-mode)
1100(add-hook 'minibuffer-setup-hook #'truncate-lines-mode) 1202(add-hook 'minibuffer-setup-hook #'truncate-lines-mode)
1101 1203
1204(ensure-package 'prescient nil t)
1205(setopt completion-styles '(prescient basic))
1206(setopt completion-category-overrides
1207 '((file (styles basic partial-completion))))
1208(prescient-persist-mode)
1209(add-hook 'persist-settings-hook #'prescient--save)
1210
1102(define-minor-mode good-completions-mode 1211(define-minor-mode good-completions-mode
1103 "A mode for completing good." 1212 "A mode for completing good."
1104 :lighter "" 1213 :lighter ""
1105 :global t 1214 :global t
1106 (setq completion-auto-help (when good-completions-mode 'always) 1215 (setq completion-auto-help (when good-completions-mode 'always))
1107 completion-auto-select (when good-completions-mode 'second-tab) 1216 (setq completion-auto-select (when good-completions-mode 'second-tab))
1108 completions-format 'one-column 1217 (setq completions-format (if good-completions-mode 'one-column 'horizontal))
1109 completions-header-format nil) 1218 (setq completions-header-format nil)
1219 (setq completions-max-height 16)
1110 (cond 1220 (cond
1111 (good-completions-mode 1221 (good-completions-mode
1112 ;; Turn off other completion frameworks 1222 ;; Turn off other completion frameworks
@@ -1115,17 +1225,18 @@ ORG-EXPORT-ARGS are passed to `org-export-to-buffer'."
1115 (fido-mode -1) 1225 (fido-mode -1)
1116 (fido-vertical-mode -1) 1226 (fido-vertical-mode -1)
1117 ;; Up/down when completing in the minibuffer 1227 ;; Up/down when completing in the minibuffer
1118 (define-key minibuffer-local-map (kbd "C-p") 1228 (keymap-set minibuffer-local-map "C-p"
1119 #'minibuffer-previous-completion) 1229 #'minibuffer-previous-completion)
1120 (define-key minibuffer-local-map (kbd "C-n") 1230 (keymap-set minibuffer-local-map "C-n"
1121 #'minibuffer-next-completion) 1231 #'minibuffer-next-completion)
1122 ;; Up/down when competing in a normal buffer 1232 ;; Up/down when competing in a normal buffer
1123 (define-key completion-in-region-mode-map (kbd "C-p") 1233 (keymap-set completion-in-region-mode-map "C-p"
1124 #'minibuffer-previous-completion) 1234 #'minibuffer-previous-completion)
1125 (define-key completion-in-region-mode-map (kbd "C-n") 1235 (keymap-set completion-in-region-mode-map "C-n"
1126 #'minibuffer-next-completion)) 1236 #'minibuffer-next-completion)
1127 (setq completions-sort #'renz/sort-multi-category 1237 (keymap-set completion-in-region-mode-map "RET"
1128 completion-in-region-function #'completion--in-region) 1238 #'minibuffer-choose-completion)
1239 (setq completion-in-region-function #'completion--in-region))
1129 (t))) 1240 (t)))
1130 1241
1131(good-completions-mode) 1242(good-completions-mode)
@@ -1175,7 +1286,43 @@ ORG-EXPORT-ARGS are passed to `org-export-to-buffer'."
1175 1286
1176(setq global-mode-string 1287(setq global-mode-string
1177 '((jabber-activity-mode jabber-activity-mode-string) 1288 '((jabber-activity-mode jabber-activity-mode-string)
1178 (:eval (when (and (fboundp 'org-clocking-p) 1289 " "))
1179 (org-clocking-p)) 1290
1180 (concat " " (truncate-string-to-width org-mode-line-string 1291(add-hook 'prog-mode-hook #'prettify-symbols-mode)
1181 24 nil nil t)))))) 1292
1293(require 'autoinsert)
1294(setf (alist-get "\\.scm" auto-insert-alist nil nil #'equal)
1295 '(nil
1296 "#!/bin/sh" \n
1297 "#| -*- scheme -*-" \n
1298 "exec csi -R r7rs -ss \"$0\" \"$@\"" \n
1299 _ \n
1300 "|#" \n \n))
1301
1302(ensure-package 'embark nil t)
1303(when (package-installed-p 'consult)
1304 (ensure-package 'embark-consult nil t))
1305
1306(keymap-global-set "C-." #'embark-act)
1307(keymap-global-set "M-." #'embark-dwim)
1308(keymap-global-set "C-h B" #'embark-bindings)
1309
1310(setopt eldoc-documentation-strategy #'eldoc-documentation-compose-eagerly)
1311(setopt eldoc-idle-delay 0.01)
1312
1313(setf (alist-get "\\`\\*Embark Collect \\(Live\\|Completions\\)\\*"
1314 display-buffer-alist
1315 nil nil #'equal)
1316 '(nil (window-parameters (mode-line-format . none))))
1317
1318(add-hook 'embark-collect-mode-hook #'consult-preview-at-point-mode)
1319
1320(global-goto-address-mode)
1321
1322(ensure-package 'pulse-location t t)
1323(pulse-location-mode)
1324(hide-minor 'pulse-location-mode)
1325
1326(define-advice eval-region (:around (orig start end &rest args) pulse)
1327 (apply orig start end args)
1328 (pulse-momentary-highlight-region start end))