Skip to content

Commit b351b51

Browse files
committed
Clean up code
* ace-window.el (aw--done): Simplify. (aw--doit): Simplify. (aw-switch-to-window): Update. (aw-delete-window): Update.
1 parent fa7cb4d commit b351b51

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

ace-window.el

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,8 @@ This hook is set to nil with each call to `ace-window'.")
121121

122122
(defun aw--done ()
123123
"Clean up ace-jump overlays."
124-
(setq ace-jump-query-char nil)
124+
;; clean up mode line
125125
(setq ace-jump-current-mode nil)
126-
127-
;; clean the status line
128126
(setq ace-jump-mode nil)
129127
(force-mode-line-update)
130128

@@ -160,7 +158,6 @@ Amend MODE-LINE to the mode line for the duration of the selection."
160158
(cl-case (length visual-area-list)
161159
(0)
162160
(1
163-
;; don't get stuck in an empty read-only buffer
164161
(select-window (aj-visual-area-window (car visual-area-list))))
165162
(2
166163
(select-window
@@ -203,11 +200,10 @@ Amend MODE-LINE to the mode line for the duration of the selection."
203200
;; turn off helm transient map
204201
(remove-hook 'post-command-hook 'helm--maybe-update-keymap)
205202
(unwind-protect
206-
(let (char node)
203+
(let (node)
207204
(catch 'done
208205
(while t
209-
(setq char (read-char))
210-
(setq node (cl-position char aw-keys))
206+
(setq node (cl-position (read-char) aw-keys))
211207
(when node
212208
(setq node (nth node (cdr ace-jump-search-tree))))
213209
(cond ((null node)
@@ -225,9 +221,6 @@ Amend MODE-LINE to the mode line for the duration of the selection."
225221

226222
((eq (car node) 'leaf)
227223
(let ((aj-data (overlay-get (cdr node) 'aj-data)))
228-
(ace-jump-done)
229-
(ace-jump-push-mark)
230-
(run-hooks 'ace-jump-mode-before-jump-hook)
231224
(select-window (aj-position-window aj-data)))
232225
(throw 'done t))
233226

@@ -318,7 +311,7 @@ Windows are numbered top down, left to right."
318311
(select-frame-set-input-focus frame))
319312
(if (window-live-p window)
320313
(select-window window)
321-
(error "Bad aj-data, aw-delete-window: %S" aj-data))))
314+
(error "Got a dead window %S" window))))
322315

323316
(defun aw-delete-window (window)
324317
"Delete window WINDOW."
@@ -330,7 +323,7 @@ Windows are numbered top down, left to right."
330323
(delete-frame frame)
331324
(if (window-live-p window)
332325
(delete-window window)
333-
(error "Bad aj-data, aw-delete-window: %S" aj-data)))))
326+
(error "Got a dead window %S" window)))))
334327

335328
(defun aw-swap-window (window)
336329
"Swap buffers of current window and WINDOW."

0 commit comments

Comments
 (0)