[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 352c33a 43/68: Finalize transition to `read-char'
From: |
Oleh Krehel |
Subject: |
[elpa] master 352c33a 43/68: Finalize transition to `read-char' |
Date: |
Sat, 21 Mar 2015 19:07:02 +0000 |
branch: master
commit 352c33ae12fd0860350defb10d59c4713f039570
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Finalize transition to `read-char'
* ace-window.el (aw--callback-body): Remove.
(aw--callback): Remove.
(aw--doit): Do a `read-char' loop, in case there's more than one
level. Don't run the hooks any more - they're not necessary.
---
ace-window.el | 84 ++++++++++++++++++++------------------------------------
1 files changed, 30 insertions(+), 54 deletions(-)
diff --git a/ace-window.el b/ace-window.el
index 9a86b76..4076495 100644
--- a/ace-window.el
+++ b/ace-window.el
@@ -116,43 +116,6 @@ 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-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)
- )
-
- ((eq (car node) 'branch)
- (let ((old-tree ace-jump-search-tree))
- (setq ace-jump-search-tree (cons 'branch (cdr node)))
- (ace-jump-update-overlay-in-search-tree
- ace-jump-search-tree aw-keys)
- (setf (cdr node) nil)
- (ace-jump-delete-overlay-in-search-tree old-tree)))
-
- ((eq (car node) 'leaf)
- (let ((aj-data (overlay-get (cdr node) 'aj-data)))
- (ace-jump-done)
- (ace-jump-push-mark)
- (run-hooks 'ace-jump-mode-before-jump-hook)
- (funcall aw--current-op aj-data))
- (run-hooks 'ace-window-end-hook)
- (run-hooks 'ace-window-end-once-hook)
- (setq ace-window-end-once-hook)
- (run-hooks 'ace-jump-mode-end-hook))
-
- (t
- (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)
@@ -254,23 +217,36 @@ Set mode line to MODE-LINE during the selection process."
;; 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 (char node)
+ (catch 'done
+ (while t
+ (setq char (read-char mode-line))
+ (setq node (nth (or (cl-position char aw-keys) (length
aw-keys))
+ (cdr ace-jump-search-tree)))
+ (cond ((null node)
+ (message "No such position candidate.")
+ (throw 'done nil))
+
+ ((eq (car node) 'branch)
+ (let ((old-tree ace-jump-search-tree))
+ (setq ace-jump-search-tree (cons 'branch (cdr
node)))
+ (ace-jump-update-overlay-in-search-tree
+ ace-jump-search-tree aw-keys)
+ (setf (cdr node)
+ nil)
+ (ace-jump-delete-overlay-in-search-tree
old-tree)))
+
+ ((eq (car node) 'leaf)
+ (let ((aj-data (overlay-get (cdr node) 'aj-data)))
+ (ace-jump-done)
+ (ace-jump-push-mark)
+ (run-hooks 'ace-jump-mode-before-jump-hook)
+ (funcall aw--current-op aj-data))
+ (throw 'done t))
+
+ (t
+ (error "[AceJump] Internal error: tree node type is
invalid"))))))
+ (aw--done)))))))
;; ——— Interactive
—————————————————————————————————————————————————————————————
;;;###autoload
- [elpa] master 5fb2caf 36/68: ace-window.el: mark two customs as boolean, (continued)
- [elpa] master 5fb2caf 36/68: ace-window.el: mark two customs as boolean, Oleh Krehel, 2015/03/21
- [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 <=
- [elpa] master 32911db 42/68: Start transition to `read-char', Oleh Krehel, 2015/03/21
- [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