[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 7cfe11e 074/110: Added ability to display avy candidates f
From: |
Oleh Krehel |
Subject: |
[elpa] master 7cfe11e 074/110: Added ability to display avy candidates from bottom to top |
Date: |
Sat, 11 May 2019 10:15:47 -0400 (EDT) |
branch: master
commit 7cfe11e3c15f22a7f8745608c82ab673374976ce
Author: Sebastian Wålinder <address@hidden>
Commit: Oleh Krehel <address@hidden>
Added ability to display avy candidates from bottom to top
And made scope limitation possible with avy-goto-line-above and below.
Fixes #236
---
avy.el | 48 ++++++++++++++++++++++++++++++++----------------
1 file changed, 32 insertions(+), 16 deletions(-)
diff --git a/avy.el b/avy.el
index df4ad49..38ca4f8 100644
--- a/avy.el
+++ b/avy.el
@@ -1349,12 +1349,12 @@ This variable is used by `avy-goto-subword-0' and
`avy-goto-subword-1'."
;;;###autoload
(defun avy-goto-subword-0 (&optional arg predicate beg end)
"Jump to a word or subword start.
-
The window scope is determined by `avy-all-windows' (ARG negates it).
-BEG and END narrow the scope where candidates are searched.
When PREDICATE is non-nil it's a function of zero parameters that
-should return true."
+should return true.
+
+BEG and END narrow the scope where candidates are searched."
(interactive "P")
(require 'subword)
(avy-with avy-goto-subword-0
@@ -1411,11 +1411,12 @@ Which one depends on variable `subword-mode'."
(defvar visual-line-mode)
-(defun avy--line-cands (&optional arg beg end)
+(defun avy--line-cands (&optional arg beg end bottom-up)
"Get candidates for selecting a line.
The window scope is determined by `avy-all-windows'.
When ARG is non-nil, do the opposite of `avy-all-windows'.
-BEG and END narrow the scope where candidates are searched."
+BEG and END narrow the scope where candidates are searched.
+When BOTTOM-UP is non-nil, display avy candidates from top to bottom"
(let (candidates)
(avy-dowindows arg
(let ((ws (or beg (window-start))))
@@ -1436,7 +1437,9 @@ BEG and END narrow the scope where candidates are
searched."
(setq temporary-goal-column 0)
(line-move-visual 1 t))
(forward-line 1)))))))
- (nreverse candidates)))
+ (if bottom-up
+ candidates
+ (nreverse candidates))))
(defun avy--linum-strings ()
"Get strings for `avy-linum-mode'."
@@ -1521,14 +1524,15 @@ BEG and END narrow the scope where candidates are
searched."
(frame-char-width)))))
(set-window-margins win width (cdr (window-margins win)))))
-(defun avy--line (&optional arg beg end)
+(defun avy--line (&optional arg beg end bottom-up)
"Select a line.
The window scope is determined by `avy-all-windows'.
When ARG is non-nil, do the opposite of `avy-all-windows'.
-BEG and END narrow the scope where candidates are searched."
+BEG and END narrow the scope where candidates are searched.
+When BOTTOM-UP is non-nil, display avy candidates from top to bottom"
(let ((avy-action #'identity))
(avy--process
- (avy--line-cands arg beg end)
+ (avy--line-cands arg beg end bottom-up)
(if avy-linum-mode
(progn (message "Goto line:")
'ignore)
@@ -1572,23 +1576,35 @@ Otherwise, forward to `goto-line' with ARG."
(avy-action-goto r))))))
;;;###autoload
-(defun avy-goto-line-above ()
- "Goto visible line above the cursor."
+(defun avy-goto-line-above (&optional offset bottom-up)
+ "Goto visible line above the cursor.
+OFFSET changes the distance between the closest key to the cursor and
+the cursor
+When BOTTOM-UP is non-nil, display avy candidates from top to bottom"
(interactive)
+ (if offset
+ (setq offset (+ 2 (- offset))))
(let* ((avy-all-windows nil)
(r (avy--line nil (window-start)
- (line-beginning-position))))
+ (line-beginning-position (or offset 1))
+ bottom-up)))
(unless (eq r t)
(avy-action-goto r))))
;;;###autoload
-(defun avy-goto-line-below ()
- "Goto visible line below the cursor."
+(defun avy-goto-line-below (&optional offset bottom-up)
+ "Goto visible line below the cursor.
+OFFSET changes the distance between the closest key to the cursor and
+the cursor
+When BOTTOM-UP is non-nil, display avy candidates from top to bottom"
(interactive)
+ (if offset
+ (setq offset (+ offset 1)))
(let* ((avy-all-windows nil)
(r (avy--line
- nil (line-beginning-position 2)
- (window-end (selected-window) t))))
+ nil (line-beginning-position (or offset 2))
+ (window-end (selected-window) t)
+ bottom-up)))
(unless (eq r t)
(avy-action-goto r))))
- [elpa] master e9f4d85 092/110: avy.el (avy-goto-char-timer): Obey avy-background for initial search, (continued)
- [elpa] master e9f4d85 092/110: avy.el (avy-goto-char-timer): Obey avy-background for initial search, Oleh Krehel, 2019/05/11
- [elpa] master 9124022 097/110: avy.el (avy--generic-jump): Update docstring about removed arg, Oleh Krehel, 2019/05/11
- [elpa] master b19a23a 096/110: avy.el (avy--visible-p): buffer-invisibility-spec can be t, Oleh Krehel, 2019/05/11
- [elpa] master 118a3d6 093/110: Update readme.md: add melpa badges, Oleh Krehel, 2019/05/11
- [elpa] master 9a15d1f 103/110: avy.el (avy-show-dispatch-help): Add and bind to "?", Oleh Krehel, 2019/05/11
- [elpa] master 74501e1 094/110: avy.el: More fixes to org-toggle-link-display, Oleh Krehel, 2019/05/11
- [elpa] master 8db2759 099/110: Change avy--process to accept cleanup function, Oleh Krehel, 2019/05/11
- [elpa] master 7d73cee 100/110: avy.el: Use avy-process instead of avy--process, Oleh Krehel, 2019/05/11
- [elpa] master fd0101e 101/110: avy.el (avy-push-mark): Turn off message, Oleh Krehel, 2019/05/11
- [elpa] master e802510 098/110: avy.el (avy-jump): New API, don't use avy--generic-jump, Oleh Krehel, 2019/05/11
- [elpa] master 7cfe11e 074/110: Added ability to display avy candidates from bottom to top,
Oleh Krehel <=
- [elpa] master 8606a89 072/110: avy.el (avy--process): Remove redundant copy-sequence, Oleh Krehel, 2019/05/11
- [elpa] master 002b8f3 091/110: avy.el (avy--visible-p): Add to fix org-toggle-link-display, Oleh Krehel, 2019/05/11
- [elpa] master 16482e0 089/110: avy.el (avy--generic-jump): Remove `style' arg, Oleh Krehel, 2019/05/11
- [elpa] master 909483e 090/110: avy.el (avy--process): Make `overlay-fn' arg optional, Oleh Krehel, 2019/05/11
- [elpa] master 24b5137 087/110: Ignore mistyping when no candidates available, Oleh Krehel, 2019/05/11
- [elpa] master c4e2d50 077/110: avy.el: avy-goto-char will now display shortest overlays for cands near point, Oleh Krehel, 2019/05/11
- [elpa] master 1de6233 076/110: Add avy-goto-end-of-line, Oleh Krehel, 2019/05/11
- [elpa] master c2e2a4a 083/110: avy.el (avy--read-candidates): Custom keys for deleting last read char, Oleh Krehel, 2019/05/11
- [elpa] master 4f1b8a1 086/110: avy.el: Fix compiler warnings, Oleh Krehel, 2019/05/11
- [elpa] master e7c0fc0 088/110: avy.el (avy-pre-action): New defvar, Oleh Krehel, 2019/05/11