[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 32911db 42/68: Start transition to `read-char'
From: |
Oleh Krehel |
Subject: |
[elpa] master 32911db 42/68: Start transition to `read-char' |
Date: |
Sat, 21 Mar 2015 19:07:02 +0000 |
branch: master
commit 32911dbc7ba8ec6e1e343f06663150d4e96f6114
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Start transition to `read-char'
* ace-window.el (aw--callback-body): Move most of `aw-callback' here.
(aw--doit): Only pass the char to `aw--callback-body'.
(aw--done): Repurpose from `ace-jump-done'.
(ace-select-window): Use `read-char' instead of `set-transient-map'.
---
ace-window.el | 63 +++++++++++++++++++++++++++++++++++++++++---------------
1 files changed, 46 insertions(+), 17 deletions(-)
diff --git a/ace-window.el b/ace-window.el
index 08ae5dd..9a86b76 100644
--- a/ace-window.el
+++ b/ace-window.el
@@ -116,16 +116,14 @@ This hook is set to nil with each call to `ace-window'.")
(defvar aw--current-op nil
"A function of one argument to call.")
-(defun aw--callback ()
- "Call `aw--current-op' for the window selected by ace-jump."
- (interactive)
- (let* ((index (or (cl-position (aref (this-command-keys) 0)
- aw-keys)
+(defun aw--callback-body (char)
+ (let* ((index (or (cl-position char aw-keys)
(length aw-keys)))
(node (nth index (cdr ace-jump-search-tree))))
(cond ((null node)
(message "No such position candidate.")
- (ace-jump-done))
+ ;; (ace-jump-done)
+ )
((eq (car node) 'branch)
(let ((old-tree ace-jump-search-tree))
@@ -150,6 +148,29 @@ This hook is set to nil with each call to `ace-window'.")
(ace-jump-done)
(error "[AceJump] Internal error: tree node type is invalid")))))
+(defun aw--callback ()
+ "Call `aw--current-op' for the window selected by ace-jump."
+ (interactive)
+ (aw--callback-body (aref (this-command-keys) 0)))
+
+(defun aw--done ()
+ (setq ace-jump-query-char nil)
+ (setq ace-jump-current-mode nil)
+
+ ;; clean the status line
+ (setq ace-jump-mode nil)
+ (force-mode-line-update)
+
+ ;; delete background overlay
+ (loop for ol in ace-jump-background-overlay-list
+ do (delete-overlay ol))
+ (setq ace-jump-background-overlay-list nil)
+
+ ;; delete overlays in search tree
+ (when ace-jump-search-tree
+ (ace-jump-delete-overlay-in-search-tree ace-jump-search-tree)
+ (setq ace-jump-search-tree nil)))
+
(defun aw--doit (mode-line)
"Select a window and eventually call `aw--current-op' for it.
Set mode line to MODE-LINE during the selection process."
@@ -172,7 +193,8 @@ Set mode line to MODE-LINE during the selection process."
(= 0 (buffer-size b))))))
visual-area-list))))
(cl-case (length visual-area-list)
- (0)
+ (0
+ (error "Nowhere to switch to"))
(1
(if (aw-ignored-p (selected-window))
(other-window 1)
@@ -231,17 +253,24 @@ Set mode line to MODE-LINE during the selection process."
(force-mode-line-update)
;; turn off helm transient map
(remove-hook 'post-command-hook 'helm--maybe-update-keymap)
+ (unwind-protect
+ (let ((char (read-char mode-line)))
+ (aw--callback-body char))
+ (aw--done))
+
+
;; override the local key map
- (let ((map (make-keymap)))
- (dolist (key-code aw-keys)
- (define-key map (make-string 1 key-code) 'aw--callback))
- (define-key map [t] 'ace-jump-done)
- (if (fboundp 'set-transient-map)
- (set-transient-map map)
- (set-temporary-overlay-map map)))
-
- (add-hook 'mouse-leave-buffer-hook 'ace-jump-done)
- (add-hook 'kbd-macro-termination-hook 'ace-jump-done))))))
+ ;; (let ((map (make-keymap)))
+ ;; (dolist (key-code aw-keys)
+ ;; (define-key map (make-string 1 key-code) 'aw--callback))
+ ;; (define-key map [t] 'ace-jump-done)
+ ;; (if (fboundp 'set-transient-map)
+ ;; (set-transient-map map)
+ ;; (set-temporary-overlay-map map)))
+
+ ;; (add-hook 'mouse-leave-buffer-hook 'ace-jump-done)
+ ;; (add-hook 'kbd-macro-termination-hook 'ace-jump-done)
+ )))))
;; ——— Interactive
—————————————————————————————————————————————————————————————
;;;###autoload
- [elpa] master 3a06c99 35/68: ace-window.el (aw--doit): fix conflict with helm, (continued)
- [elpa] master 3a06c99 35/68: ace-window.el (aw--doit): fix conflict with helm, Oleh Krehel, 2015/03/21
- [elpa] master db5763f 32/68: ace-window.el (aw-swap-window): improve, Oleh Krehel, 2015/03/21
- [elpa] master 22ebc3a 34/68: ace-window.el (aw--doit): use map with most priority, Oleh Krehel, 2015/03/21
- [elpa] master e03ceb9 30/68: ace-window.el: remove aw-generic macro, Oleh Krehel, 2015/03/21
- [elpa] master 8d40101 39/68: ace-window.el (ace-window-end-hook): add, Oleh Krehel, 2015/03/21
- [elpa] master 752c2cc 37/68: README.md: update, Oleh Krehel, 2015/03/21
- [elpa] master b86d163 40/68: ace-window.el (ace-window-end-once-hook): Add, Oleh Krehel, 2015/03/21
- [elpa] master 6becad8 38/68: ace-window.el: bump version, Oleh Krehel, 2015/03/21
- [elpa] master bb9da9c 44/68: Update `aw--doit' signature, Oleh Krehel, 2015/03/21
- [elpa] master 352c33a 43/68: Finalize transition to `read-char', Oleh Krehel, 2015/03/21
- [elpa] master 32911db 42/68: Start transition to `read-char',
Oleh Krehel <=
- [elpa] master 50fafc5 45/68: ace-window.el (aw--doit): don't show anything in echo area, Oleh Krehel, 2015/03/21
- [elpa] master 4291989 41/68: ace-window.el (ace-maximize-window): Add, Oleh Krehel, 2015/03/21
- [elpa] master 064c4fb 49/68: ace-window.el (aw-select): Rename from `aw--doit', Oleh Krehel, 2015/03/21
- [elpa] master b351b51 48/68: Clean up code, Oleh Krehel, 2015/03/21
- [elpa] master 4570578 46/68: ace-window.el (aw--doit): simplify, Oleh Krehel, 2015/03/21
- [elpa] master df86665 51/68: ace-window.el (aw-ignored-buffers): add "*LV*", Oleh Krehel, 2015/03/21
- [elpa] master fa7cb4d 47/68: `aw--doit' simply returns a window now, Oleh Krehel, 2015/03/21
- [elpa] master e1ae6ba 50/68: Try not to end in `aw-ignored-p' when ace method isn't invoked, Oleh Krehel, 2015/03/21
- [elpa] master 47bd115 52/68: Allow customizing the leading char face, Oleh Krehel, 2015/03/21
- [elpa] master c897759 55/68: Update avy interface, Oleh Krehel, 2015/03/21