From 910c5df512d11bf86e1a506c7a0cc6e7833e0c38 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 6 Sep 2021 23:57:01 -0500 Subject: Use `define-repeat-map` --- init.el | 174 ++++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 88 insertions(+), 86 deletions(-) diff --git a/init.el b/init.el index fd3581a..09a4239 100644 --- a/init.el +++ b/init.el @@ -440,48 +440,48 @@ 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 (: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 + "" windmove-left + "" windmove-right + "" windmove-up + "" windmove-down + ;; swapping + "" windmove-swap-states-left + "" windmove-swap-states-right + "" windmove-swap-states-up + "" windmove-swap-states-down)) + + (define-repeat-map winner-mode + ("/" winner-undo + "?" winner-redo))) (setup dired (:also-load dired-x) @@ -1431,15 +1431,16 @@ browser defined in `browse-url-secondary-browser-function'." backward-page :after #'recenter-to-top) ;; I'm not sure where this is in /my/ version of Emacs - (defvar page-navigation-repeat-map - (let ((map (make-sparse-keymap))) - (define-key map "]" #'forward-page) - (define-key map "[" #'backward-page) - map) - "Keymap to repeat page navigation key sequences. Used in `repeat-mode'.") - - (put 'forward-page 'repeat-map 'page-navigation-repeat-map) - (put 'backward-page 'repeat-map 'page-navigation-repeat-map)) + ;; (defvar page-navigation-repeat-map + ;; (let ((map (make-sparse-keymap))) + ;; (define-key map "]" #'forward-page) + ;; (define-key map "[" #'backward-page) + ;; map) + ;; "Keymap to repeat page navigation key sequences. Used in `repeat-mode'.") + + ;; (put 'forward-page 'repeat-map 'page-navigation-repeat-map) + ;; (put 'backward-page 'repeat-map 'page-navigation-repeat-map) + ) (setup (:straight page-break-lines) (global-page-break-lines-mode +1)) @@ -1941,31 +1942,32 @@ If used with a numeric prefix argument N, N backticks will be inserted." "C-x 4 S-" #'windmove-swap-states-up "C-x 4 S-" #'windmove-swap-states-down) - (when (fboundp 'repeat-mode) - (defvar windmove-repeat-map - (let ((map (make-sparse-keymap))) - ;; moving - (define-key map [left] #'windmove-left) - (define-key map [right] #'windmove-right) - (define-key map [up] #'windmove-up) - (define-key map [down] #'windmove-down) - ;; swapping - (define-key map [S-left] #'windmove-swap-states-left) - (define-key map [S-right] #'windmove-swap-states-right) - (define-key map [S-up] #'windmove-swap-states-up) - (define-key map [S-down] #'windmove-swap-states-down) - map) - "Keymap to repeat various `windmove' sequences. Used in `repeat-mode'.") - - (dolist (sym '(windmove-left - windmove-right - windmove-up - windmove-down - windmove-swap-states-left - windmove-swap-states-right - windmove-swap-states-up - windmove-swap-states-down)) - (put sym 'repeat-map 'windmove-repeat-map)))) + ;; (when (fboundp 'repeat-mode) + ;; (defvar windmove-repeat-map + ;; (let ((map (make-sparse-keymap))) + ;; ;; moving + ;; (define-key map [left] #'windmove-left) + ;; (define-key map [right] #'windmove-right) + ;; (define-key map [up] #'windmove-up) + ;; (define-key map [down] #'windmove-down) + ;; ;; swapping + ;; (define-key map [S-left] #'windmove-swap-states-left) + ;; (define-key map [S-right] #'windmove-swap-states-right) + ;; (define-key map [S-up] #'windmove-swap-states-up) + ;; (define-key map [S-down] #'windmove-swap-states-down) + ;; map) + ;; "Keymap to repeat various `windmove' sequences. Used in `repeat-mode'.") + + ;; (dolist (sym '(windmove-left + ;; windmove-right + ;; windmove-up + ;; windmove-down + ;; windmove-swap-states-left + ;; windmove-swap-states-right + ;; windmove-swap-states-up + ;; windmove-swap-states-down)) + ;; (put sym 'repeat-map 'windmove-repeat-map))) + ) (setup window (require 'acdw-bell) @@ -1994,16 +1996,16 @@ If used with a numeric prefix argument N, N backticks will be inserted." "C-x 4 ?" #'winner-redo) ;; add `winner-undo' and `winner-redo' to `repeat-mode' - (when (fboundp 'repeat-mode) - (defvar winner-mode-repeat-map - (let ((map (make-sparse-keymap))) - (define-key map "/" #'winner-undo) - (define-key map "?" #'winner-redo) - map) - "Keymap to repeat `winner-mode' sequences. Used in `repeat-mode'.") - - (put 'winner-undo 'repeat-map 'winner-mode-repeat-map) - (put 'winner-redo 'repeat-map 'winner-mode-repeat-map)) + ;; (when (fboundp 'repeat-mode) + ;; (defvar winner-mode-repeat-map + ;; (let ((map (make-sparse-keymap))) + ;; (define-key map "/" #'winner-undo) + ;; (define-key map "?" #'winner-redo) + ;; map) + ;; "Keymap to repeat `winner-mode' sequences. Used in `repeat-mode'.") + + ;; (put 'winner-undo 'repeat-map 'winner-mode-repeat-map) + ;; (put 'winner-redo 'repeat-map 'winner-mode-repeat-map)) (winner-mode +1)) -- cgit 1.4.1-21-gabe81