31
31
(declare-function meow-motion-mode " meow" )
32
32
(declare-function meow-insert-exit " meow-command" )
33
33
34
+ (defun meow--switch-to-motion (&rest _ignore )
35
+ " Switch to motion state, used for advice.
36
+ Optional argument IGNORE ignored."
37
+ (meow--switch-state 'motion ))
38
+
39
+ (defun meow--switch-to-normal (&rest _ignore )
40
+ " Switch to normal state, used for advice.
41
+ Optional argument IGNORE ignored."
42
+ (meow--switch-state 'normal ))
43
+
34
44
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
35
45
; ; undo-tree
36
46
@@ -95,22 +105,29 @@ Argument ENABLE non-nil means turn on."
95
105
(add-hook 'meow-insert-exit-hook #'meow--company-maybe-abort-advice )
96
106
(remove-hook 'meow-insert-exit-hook #'meow--company-maybe-abort-advice )))
97
107
108
+ ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
109
+ ; ; repeat-map
110
+
111
+ (defvar meow--diff-hl-setup nil
112
+ " Whether already setup diff-hl." )
113
+
114
+ (defun meow--setup-diff-hl (enable )
115
+ " Setup diff-hl."
116
+ (if enable
117
+ (progn
118
+ (advice-add 'diff-hl-show-hunk-inline-popup :before 'meow--switch-to-motion )
119
+ (advice-add 'diff-hl-show-hunk-posframe :before 'meow--switch-to-motion )
120
+ (advice-add 'diff-hl-show-hunk-hide :after 'meow--switch-to-normal ))
121
+ (advice-remove diff-hl-show-hunk-inline-popup 'meow--switch-to-motion )
122
+ (advice-remove diff-hl-show-hunk-posframe 'meow--switch-to-motion )
123
+ (advice-remove diff-hl-show-hunk-hide 'meow--switch-to-normal )))
124
+
98
125
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
99
126
; ; wgrep
100
127
101
128
(defvar meow--wgrep-setup nil
102
129
" Whether already setup wgrep." )
103
130
104
- (defun meow--wgrep-to-normal (&rest _ignore )
105
- " Switch to normal state, used in advice for wgrep.
106
- Optional argument IGNORE ignored."
107
- (meow--switch-state 'normal ))
108
-
109
- (defun meow--wgrep-to-motion (&rest _ignore )
110
- " Switch to motion state, used in advice for wgrep.
111
- Optional argument IGNORE ignored."
112
- (meow--switch-state 'motion ))
113
-
114
131
(defun meow--setup-wgrep (enable )
115
132
" Setup wgrep.
116
133
@@ -119,14 +136,14 @@ Argument ENABLE non-nil means turn on."
119
136
(setq meow--wgrep-setup enable)
120
137
(if enable
121
138
(progn
122
- (advice-add 'wgrep-change-to-wgrep-mode :after #'meow--wgrep -to-normal )
123
- (advice-add 'wgrep-exit :after #'meow--wgrep -to-motion )
124
- (advice-add 'wgrep-finish-edit :after #'meow--wgrep -to-motion )
125
- (advice-add 'wgrep-save-all-buffers :after #'meow--wgrep -to-motion ))
126
- (advice-remove 'wgrep-change-to-wgrep-mode #'meow--wgrep -to-normal )
127
- (advice-remove 'wgrep-exit #'meow--wgrep -to-motion )
128
- (advice-remove 'wgrep-finish-edit #'meow--wgrep -to-motion )
129
- (advice-remove 'wgrep-save-all-buffers #'meow--wgrep -to-motion )))
139
+ (advice-add 'wgrep-change-to-wgrep-mode :after #'meow--switch -to-normal )
140
+ (advice-add 'wgrep-exit :after #'meow--switch -to-motion )
141
+ (advice-add 'wgrep-finish-edit :after #'meow--switch -to-motion )
142
+ (advice-add 'wgrep-save-all-buffers :after #'meow--switch -to-motion ))
143
+ (advice-remove 'wgrep-change-to-wgrep-mode #'meow--switch -to-normal )
144
+ (advice-remove 'wgrep-exit #'meow--switch -to-motion )
145
+ (advice-remove 'wgrep-finish-edit #'meow--switch -to-motion )
146
+ (advice-remove 'wgrep-save-all-buffers #'meow--switch -to-motion )))
130
147
131
148
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
132
149
; ; wdired
@@ -140,31 +157,21 @@ Argument ENABLE non-nil means turn on."
140
157
(declare-function wdired-finish-edit " wgrep" )
141
158
(declare-function wdired-abort-changes " wgrep" )
142
159
143
- (defun meow--wdired-enter (&rest _ignore )
144
- " Switch to normal state, used in hook for wdired.
145
- Optional argument IGNORE ignored."
146
- (meow--switch-state 'normal ))
147
-
148
- (defun meow--wdired-exit (&rest _ignore )
149
- " Switch to motion state, used in advice for wdired.
150
- Optional argument IGNORE ignored."
151
- (meow--switch-state 'motion ))
152
-
153
160
(defun meow--setup-wdired (enable )
154
161
" Setup wdired.
155
162
156
163
Argument ENABLE non-nil means turn on."
157
164
(setq meow--wdired-setup enable)
158
165
(if enable
159
166
(progn
160
- (add-hook 'wdired-mode-hook #'meow--wdired-enter )
161
- (advice-add #'wdired-exit :after #'meow--wdired-exit )
162
- (advice-add #'wdired-abort-changes :after #'meow--wdired-exit )
163
- (advice-add #'wdired-finish-edit :after #'meow--wdired-exit ))
164
- (remove-hook 'wdired-mode-hook #'meow--wdired-enter )
165
- (advice-remove #'wdired-exit #'meow--wdired-exit )
166
- (advice-remove #'wdired-abort-changes #'meow--wdired-exit )
167
- (advice-remove #'wdired-finish-edit #'meow--wdired-exit )))
167
+ (add-hook 'wdired-mode-hook #'meow--switch-to-normal )
168
+ (advice-add #'wdired-exit :after #'meow--switch-to-motion )
169
+ (advice-add #'wdired-abort-changes :after #'meow--switch-to-motion )
170
+ (advice-add #'wdired-finish-edit :after #'meow--switch-to-motion ))
171
+ (remove-hook 'wdired-mode-hook #'meow--switch-to-normal )
172
+ (advice-remove #'wdired-exit #'meow--switch-to-motion )
173
+ (advice-remove #'wdired-abort-changes #'meow--switch-to-motion )
174
+ (advice-remove #'wdired-finish-edit #'meow--switch-to-motion )))
168
175
169
176
; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
170
177
; ; rectangle-mark-mode
@@ -194,8 +201,8 @@ Argument ENABLE non-nil means turn on."
194
201
(defun meow--edebug-hook-function ()
195
202
" Switch meow state when entering/leaving edebug."
196
203
(if (bound-and-true-p edebug-mode)
197
- (meow--switch-state ' motion )
198
- (meow--switch-state ' normal )))
204
+ (meow--switch-to- motion)
205
+ (meow--switch-to- normal)))
199
206
200
207
(defun meow--setup-edebug (enable )
201
208
" Setup edebug.
@@ -213,8 +220,8 @@ Argument ENABLE non-nil means turn on."
213
220
(defun meow--cider-debug-hook-function ()
214
221
" Switch meow state when entering/leaving cider debug."
215
222
(if (bound-and-true-p cider--debug-mode)
216
- (meow--switch-state ' motion )
217
- (meow--switch-state ' normal )))
223
+ (meow--switch-to- motion)
224
+ (meow--switch-to- normal)))
218
225
219
226
(defun meow--setup-cider (enable )
220
227
" Setup cider.
@@ -284,7 +291,8 @@ Argument ENABLE non-nil means turn on."
284
291
(eval-after-load " polymode" (lambda () (meow--setup-polymode t )))
285
292
(eval-after-load " cider" (lambda () (meow--setup-cider t )))
286
293
(eval-after-load " which-key" (lambda () (meow--setup-which-key t )))
287
- (eval-after-load " undo-tree" (lambda () (meow--setup-undo-tree t ))))
294
+ (eval-after-load " undo-tree" (lambda () (meow--setup-undo-tree t )))
295
+ (eval-after-load " diff-hl" (lambda () (meow--setup-diff-hl t ))))
288
296
289
297
(defun meow--disable-shims ()
290
298
" Remove shim setups."
@@ -297,7 +305,8 @@ Argument ENABLE non-nil means turn on."
297
305
(when meow--wgrep-setup (meow--setup-wgrep nil ))
298
306
(when meow--polymode-setup (meow--setup-polymode nil ))
299
307
(when meow--cider-setup (meow--setup-cider nil ))
300
- (when meow--which-key-setup (meow--setup-which-key nil )))
308
+ (when meow--which-key-setup (meow--setup-which-key nil ))
309
+ (when meow--diff-hl-setup (meow--setup-diff-hl nil )))
301
310
302
311
; ;; meow-shims.el ends here
303
312
(provide 'meow-shims )
0 commit comments