[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 574b3bd 57/68: Add `aw-leading-char-style' extra-awesome c
From: |
Oleh Krehel |
Subject: |
[elpa] master 574b3bd 57/68: Add `aw-leading-char-style' extra-awesome custom var |
Date: |
Sat, 21 Mar 2015 19:07:08 +0000 |
branch: master
commit 574b3bddfcb893e52de7503f7317965397e4b514
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add `aw-leading-char-style' extra-awesome custom var
* ace-window.el (aw-leading-char-style): When this is `char', the old
style is used. When this is `path', each window will display the full
path that can be used to get there. This is a great advantage, since
you don't need to scan your screen twice, instead reading two (or
more) chars at once.
(aw--lead-overlay): Update.
* avy.el (avy-traverse): Pass the whole path to WALKER, not just the
starting point.
---
ace-window.el | 38 +++++++++++++++++++++++++-------------
avy.el | 8 +++-----
2 files changed, 28 insertions(+), 18 deletions(-)
diff --git a/ace-window.el b/ace-window.el
index 0697ded..86f910c 100644
--- a/ace-window.el
+++ b/ace-window.el
@@ -85,6 +85,12 @@ Use M-0 `ace-window' to toggle this value."
"When t, `ace-window' will dim out all buffers temporarily when used.'."
:type 'boolean)
+(defcustom aw-leading-char-style 'char
+ "Style of the leading char overlay."
+ :type '(choice
+ (const :tag "single char" 'char)
+ (const :tag "full path" 'path)))
+
(defface aw-leading-char-face
'((((class color)) (:foreground "red"))
(((background dark)) (:foreground "gray100"))
@@ -150,8 +156,8 @@ Use M-0 `ace-window' to toggle this value."
(setq aw-overlays-back nil)
(aw--remove-leading-chars))
-(defun aw--lead-overlay (char leaf)
- "Create an overlay with CHAR at LEAF.
+(defun aw--lead-overlay (path leaf)
+ "Create an overlay using PATH at LEAF.
LEAF is (PT . WND)."
(let* ((pt (car leaf))
(wnd (cdr leaf))
@@ -159,17 +165,23 @@ LEAF is (PT . WND)."
(old-str (with-selected-window wnd
(buffer-substring pt (1+ pt))))
(new-str
- (format "%c%s"
- char
- (cond
- ((string-equal old-str "\t")
- (make-string (1- tab-width) ?\ ))
- ((string-equal old-str "\n")
- "\n")
- (t
- (make-string
- (max 0 (1- (string-width old-str)))
- ?\ ))))))
+ (concat
+ (cl-case aw-leading-char-style
+ (char
+ (apply #'string (last path)))
+ (path
+ (apply #'string (reverse path)))
+ (t
+ (error "Bad `aw-leading-char-style': %S"
+ aw-leading-char-style)))
+ (cond ((string-equal old-str "\t")
+ (make-string (1- tab-width) ?\ ))
+ ((string-equal old-str "\n")
+ "\n")
+ (t
+ (make-string
+ (max 0 (1- (string-width old-str)))
+ ?\ ))))))
(overlay-put ol 'face 'aw-leading-char-face)
(overlay-put ol 'window wnd)
(overlay-put ol 'display new-str)
diff --git a/avy.el b/avy.el
index b572c45..0098b6b 100644
--- a/avy.el
+++ b/avy.el
@@ -80,16 +80,15 @@ KEYS are placed appropriately on internal nodes."
(defun avy-traverse (tree walker &optional recur-key)
"Traverse TREE generated by `avy-tree'.
-WALKER is a function that takes KEY and LEAF.
+WALKER is a function that takes KEYS and LEAF.
RECUR-KEY is used in recursion.
LEAF is a member of LST argument of `avy-tree'.
-KEY is a member of KEYS argument of `avy-tree'. It corresponds
-to the key of the highest branch of TREE that contains LEAF."
+KEYS is the path from the root of `avy-tree' to LEAF."
(dolist (br tree)
- (let ((key (or recur-key (car br))))
+ (let ((key (cons (car br) recur-key)))
(if (eq (cadr br) 'leaf)
(funcall walker key (cddr br))
(avy-traverse (cdr br) walker key)))))
@@ -103,7 +102,6 @@ commonly done by adding a CHAR overlay at LEAF position.
CLEANUP-FN should take no arguments and remove the effects of
multiple DISPLAY-FN invokations."
-
(catch 'done
(while tree
(avy-traverse tree display-fn)
- [elpa] master 50fafc5 45/68: ace-window.el (aw--doit): don't show anything in echo area, (continued)
- [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
- [elpa] master 574b3bd 57/68: Add `aw-leading-char-style' extra-awesome custom var,
Oleh Krehel <=
- [elpa] master 8b5f10a 53/68: Update outlines, Oleh Krehel, 2015/03/21
- [elpa] master d7cafcb 56/68: avy-jump.el: add example commands using avy, Oleh Krehel, 2015/03/21
- [elpa] master fcc64ab 59/68: avy-jump.el (avi--regex-candidates): Add optional bounds, Oleh Krehel, 2015/03/21
- [elpa] master d932090 60/68: avy-jump.el (avi--overlay): Fix bug, Oleh Krehel, 2015/03/21
- [elpa] master f0050fb 62/68: avy.el (avy-read): Give a more precise error, Oleh Krehel, 2015/03/21
- [elpa] master 4e5ca87 58/68: avy-jump.el: Major update, Oleh Krehel, 2015/03/21
- [elpa] master ee0fa60 64/68: Add show keys on mode line feature., Oleh Krehel, 2015/03/21
- [elpa] master 30abc92 61/68: avy-jump.el (avi-goto-word-0): Simplify, Oleh Krehel, 2015/03/21
- [elpa] master a3d4817 63/68: Allow switching to the previous window, Oleh Krehel, 2015/03/21
- [elpa] master b83b941 65/68: Add `ace-window-display-mode' minor mode, Oleh Krehel, 2015/03/21