[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master ca1ca04 14/17: Add avy-goto-subword-1
From: |
Oleh Krehel |
Subject: |
[elpa] master ca1ca04 14/17: Add avy-goto-subword-1 |
Date: |
Fri, 08 May 2015 13:42:14 +0000 |
branch: master
commit ca1ca0464796de5cf31be7ff31f4bca45d8cd02f
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add avy-goto-subword-1
Fixes #8
---
avy-jump.el | 22 +++++++++++++++++++---
1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/avy-jump.el b/avy-jump.el
index 520011a..60b9160 100644
--- a/avy-jump.el
+++ b/avy-jump.el
@@ -329,9 +329,13 @@ The window scope is determined by `avy-all-windows' (ARG
negates it)."
(declare-function subword-backward "subword")
;;;###autoload
-(defun avy-goto-subword-0 (&optional arg)
+(defun avy-goto-subword-0 (&optional arg predicate)
"Jump to a word or subword start.
-The window scope is determined by `avy-all-windows' (ARG negates it)."
+
+The window scope is determined by `avy-all-windows' (ARG negates it).
+
+When PREDICATE is non-nil it's a function of zero parameters that
+should return true."
(interactive "P")
(require 'subword)
(let ((avy-keys (number-sequence ?a ?z))
@@ -343,11 +347,23 @@ The window scope is determined by `avy-all-windows' (ARG
negates it)."
(goto-char (window-end (selected-window) t))
(subword-backward)
(while (> (point) ws)
- (push (cons (point) (selected-window)) candidates)
+ (when (or (null predicate)
+ (and predicate (funcall predicate)))
+ (push (cons (point) (selected-window)) candidates))
(subword-backward)))))
(avy--goto
(avy--process candidates (avy--style-fn avy-goto-word-style)))))
+;;;###autoload
+(defun avy-goto-subword-1 (&optional arg)
+ "Prompt for a subword start char and jump there.
+The window scope is determined by `avy-all-windows' (ARG negates it).
+The case is ignored."
+ (interactive "P")
+ (let ((char (downcase (read-char "char: "))))
+ (avy-goto-subword-0
+ arg (lambda () (eq (downcase (char-after)) char)))))
+
(defun avy--line (&optional arg)
"Select line in current window."
(let ((avy-background nil)
- [elpa] master 1d184b0 05/17: Regexp-quote strings of avy-goto-char* functions., (continued)
- [elpa] master 1d184b0 05/17: Regexp-quote strings of avy-goto-char* functions., Oleh Krehel, 2015/05/08
- [elpa] master 33546b6 06/17: Fix avy-goto-subword-0, Oleh Krehel, 2015/05/08
- [elpa] master 5677270 04/17: Move obsoletes to one place, Oleh Krehel, 2015/05/08
- [elpa] master 18cf1ef 07/17: README.md: add, Oleh Krehel, 2015/05/08
- [elpa] master 6c1f2f6 02/17: Move from "avi-" to "avy-", leave old stuff obsolete, Oleh Krehel, 2015/05/08
- [elpa] master 974e55b 09/17: avy-jump.el (avy--line): Avoid image-mode and doc-view-mode, Oleh Krehel, 2015/05/08
- [elpa] master 5d2979b 01/17: Initial import, Oleh Krehel, 2015/05/08
- [elpa] master e9d2e60 08/17: Customize the leading char style for chars and words, Oleh Krehel, 2015/05/08
- [elpa] master 903e172 12/17: Special-case char RET to allow for jumping to end-of-lines., Oleh Krehel, 2015/05/08
- [elpa] master 487d5ea 11/17: Abstract windows and rely on subword, Oleh Krehel, 2015/05/08
- [elpa] master ca1ca04 14/17: Add avy-goto-subword-1,
Oleh Krehel <=
- [elpa] master e4f493e 10/17: README.md: Add command descriptions, Oleh Krehel, 2015/05/08
- [elpa] master 3200351 16/17: avy-jump.el (avy-setup-default): Setup some bindings, Oleh Krehel, 2015/05/08
- [elpa] master b2112e0 13/17: avy-jump.el (avy-goto-word-1): Fix for ".", Oleh Krehel, 2015/05/08
- [elpa] master f2290f2 15/17: avy.el: Update commentary, Oleh Krehel, 2015/05/08
- [elpa] master 876d210 17/17: Add 'packages/avy/' from commit '32003515c8efa2cf38b62c45499dae30bc7cacb8', Oleh Krehel, 2015/05/08