Repeat-key ... stuff

... A frustrating, confusing bug
This commit is contained in:
Case Duckworth 2021-09-06 23:48:32 -05:00
parent 9353e7d571
commit f4ec66ca04
1 changed files with 58 additions and 54 deletions

112
init.el
View File

@ -62,7 +62,10 @@ AKA, DO NOT USE THIS FUNCTION!!!"
(car feature)
feature))
(car name))
name))))))))
name)))))))
(:global "C-x o" #'acdw/other-window-or-switch-buffer
"C-x O" #'acdw/other-window-or-switch-buffer-backward))
(setup (:straight-if affe
(and (or (executable-find "fd")
@ -382,27 +385,11 @@ AKA, DO NOT USE THIS FUNCTION!!!"
"TAB" #'vertico-exit))))
(setup (:straight crux)
(:global "C-x o" #'acdw/other-window-or-switch-buffer
"C-o" #'crux-smart-open-line
(:global "C-o" #'crux-smart-open-line
"M-o" #'crux-smart-open-line-above
"C-M-\\" #'crux-cleanup-buffer-or-region
"C-x 4 t" #'crux-transpose-windows)
(when (fboundp 'repeat-mode)
(defvar other-window-repeat-map (make-sparse-keymap)
"A map for repeating `other-window' keys.")
(define-key other-window-repeat-map "o"
#'acdw/other-window-or-switch-buffer)
(define-key other-window-repeat-map "O"
(defun acdw/other-window-or-switch-buffer-backward ()
(interactive)
(setq repeat-map 'other-window-repeat-map)
(acdw/other-window-or-switch-buffer -1)))
(put 'acdw/other-window-or-switch-buffer
'repeat-map 'other-window-repeat-map))
(crux-reopen-as-root-mode +1))
(setup cursor
@ -453,6 +440,49 @@ AKA, DO NOT USE THIS FUNCTION!!!"
(setup debugger
(:hook visual-line-mode))
;; (setup (:straight (define-repeat-map
;; :host nil
;; :repo "https://tildegit.org/acdw/define-repeat-map.el"))
;; (defun acdw/other-window-or-switch-buffer-backward ()
;; (interactive)
;; (setq repeat-map 'other-window-repeat-map)
;; (acdw/other-window-or-switch-buffer -1))
;; (define-repeat-map other-window
;; ("o" acdw/other-window-or-switch-buffer
;; "O" acdw/other-window-or-switch-buffer-backward))
;; (define-repeat-map case
;; ("c" capitalize-word
;; "u" upcase-dwim
;; "l" downcase-dwim)
;; (:continue "f" forward-word
;; "b" backward-word)
;; (:enter capitalize-dwim
;; upcase-dwim
;; downcase-dwim))
;; (define-repeat-map page-navigation
;; ("]" forward-page
;; "[" backward-page))
;; (define-repeat-map windmove
;; (;; moving
;; [left] windmove-left
;; [right] windmove-right
;; [up] windmove-up
;; [down] windmove-down
;; ;; swapping
;; [S-left] windmove-swap-states-left
;; [S-right] windmove-swap-states-right
;; [S-up] windmove-swap-states-up
;; [S-down] windmove-swap-states-down))
;; (define-repeat-map winner-mode
;; ("/" winner-undo
;; "?" winner-redo)))
(setup dired
(:also-load dired-x)
(:straight dired-subtree
@ -673,7 +703,6 @@ AKA, DO NOT USE THIS FUNCTION!!!"
native-comp-async-report-warnings-errors nil
password-cache t
password-cache-expiry 3600 ; 5 minutes
read-extended-command-predicate ; emacs 28
set-mark-command-repeat-pop t)
(when (fboundp 'command-completion-default-include-p)
@ -687,52 +716,27 @@ AKA, DO NOT USE THIS FUNCTION!!!"
(defvar lookup-map (make-sparse-keymap)
"A keymap for looking up things.")
(global-set-key (kbd "C-c l") lookup-map)
(:global "M-=" #'count-words
"C-w" #'kill-region-or-backward-word
"C-c c c" #'capitalize-dwim
"C-c c t" #'titlecase-dwim
"C-c c u" #'upcase-dwim
"C-c c l" #'downcase-dwim
"C-c d" #'acdw/insert-iso-date
"M-`" nil)
;; toggle bindings
(defvar toggle-map (make-sparse-keymap)
"A keymap for toggling!")
(global-set-key (kbd "C-c t") toggle-map)
(:global "M-=" #'count-words
"C-w" #'kill-region-or-backward-word
"C-c d" #'acdw/insert-iso-date
"M-`" nil)
(:with-map toggle-map
(:bind "c" #'column-number-mode
"l" #'display-line-numbers-mode
"d" #'toggle-debug-on-error))
(defalias 'forward-word-with-case 'forward-word
"Alias for `forward-word' for use in `case-repeat-map'.")
(defalias 'backward-word-with-case 'backward-word
"Alias for `backward-word for use in `case-repeat-map'.")
(defvar case-repeat-map
(let ((map (make-sparse-keymap)))
(define-key map "c" #'capitalize-word)
(define-key map "u" #'upcase-word)
(define-key map "l" #'downcase-word)
;; movement
(define-key map "f" #'forward-word-with-case)
(define-key map "b" #'backward-word-with-case)
map)
"A map to repeat word-casing commands. For use with `repeat-mode'.")
(:with-map case-map
(:bind "c" #'capitalize-dwim
"t" #'titlecase-dwim
"u" #'upcase-dwim
"l" #'downcase-dwim))
(dolist (command '(capitalize-word
capitalize-dwim
upcase-word
upcase-dwim
downcase-word
downcase-dwim
forward-word-with-case
backward-word-with-case))
(put command 'repeat-map 'case-repeat-map))
(add-hook 'after-make-frame-functions
(defun after-make-frame@maximize (frame)
(unless (bound-and-true-p edit-server-frame-p)