[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master a86bdee6 16/78: avy.el (avy-pop-mark): use own history for
From: |
Oleh Krehel |
Subject: |
[elpa] master a86bdee6 16/78: avy.el (avy-pop-mark): use own history for points and windows |
Date: |
Sat, 23 Jan 2016 13:59:43 +0000 |
branch: master
commit a86bdee66c4b58469bd2c6308ce67fada9539d94
Author: Oleh Krehel <address@hidden>
Commit: Oleh Krehel <address@hidden>
avy.el (avy-pop-mark): use own history for points and windows
* avy.el (avy-action-goto): Don't save mark here, since the window was
already changed.
(avy--process): Set mark here.
(avy-ring): New defvar.
(avy-push-mark): New defun.
(avy-pop-mark): Use `avy-ring' unless it's empty. Then use the mark ring.
Fixes #88
Re #69
Re #81
---
avy.el | 27 +++++++++++++++++++++------
1 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/avy.el b/avy.el
index 0057396..4f09aea 100644
--- a/avy.el
+++ b/avy.el
@@ -47,6 +47,7 @@
;;; Code:
(require 'cl-lib)
+(require 'ring)
;;* Customization
(defgroup avy nil
@@ -452,9 +453,6 @@ Set `avy-style' according to COMMMAND as well."
(defun avy-action-goto (pt)
"Goto PT."
- (unless (or (= pt (point))
- (region-active-p))
- (push-mark))
(goto-char pt))
(defun avy-action-mark (pt)
@@ -506,6 +504,7 @@ Use OVERLAY-FN to visualize the decision overlay."
;; ignore exit from `avy-handler-function'
((eq res 'exit))
(t
+ (avy-push-mark)
(when (and (consp res)
(windowp (cdr res)))
(let* ((window (cdr res))
@@ -944,7 +943,7 @@ The window scope is determined by `avy-all-windows' (ARG
negates it)."
(let ((line (read-from-minibuffer
"Goto line: " (string char))))
(when line
- (push-mark)
+ (avy-push-mark)
(goto-char (point-min))
(forward-line (1- (string-to-number line)))
(throw 'done 'exit))))))
@@ -1028,10 +1027,26 @@ The window scope is determined by `avy-all-windows'
(ARG negates it)."
arg
avy-style))))
+(defvar avy-ring (make-ring 20)
+ "Hold the window and point history.")
+
+(defun avy-push-mark ()
+ "Store the current point and window."
+ (ring-insert avy-ring
+ (cons (point) (selected-window))))
+
(defun avy-pop-mark ()
- "Jump back to the last location of `push-mark'."
+ "Jump back to the last location of `avy-push-mark'."
(interactive)
- (set-mark-command 4))
+ (let (res)
+ (condition-case nil
+ (progn
+ (while (not (window-live-p
+ (cdr (setq res (ring-remove avy-ring 0))))))
+ (select-window (cdr res))
+ (goto-char (car res)))
+ (error
+ (set-mark-command 4)))))
(define-obsolete-function-alias
'avy--goto 'identity "0.3.0"
- [elpa] master 492ac49 11/78: avy.el (avy-pop-mark): Add, (continued)
- [elpa] master 492ac49 11/78: avy.el (avy-pop-mark): Add, Oleh Krehel, 2016/01/23
- [elpa] master 3b9a60a 09/78: avy.el (avy-dispatch-alist): Upgrade to defcustom, Oleh Krehel, 2016/01/23
- [elpa] master d22493c 12/78: Autload avy-goto-word-or-subword-1, Oleh Krehel, 2016/01/23
- [elpa] master 1d1e4b6 06/78: Allow to switch action midway from goto to kill/mark/copy, Oleh Krehel, 2016/01/23
- [elpa] master 30067dd 14/78: avy.el (avy-action-goto): Don't push mark when region is active, Oleh Krehel, 2016/01/23
- [elpa] master a6db8a3 08/78: Rename avy--with-avy-keys to avy-with, Oleh Krehel, 2016/01/23
- [elpa] master 1e578a1 15/78: Considers letter case only if given Upcase letter, Oleh Krehel, 2016/01/23
- [elpa] master e8cebf1 13/78: Make arg optional in avy-goto-subword-1, Oleh Krehel, 2016/01/23
- [elpa] master 36b296c 20/78: avy.el (subword-backward-regexp): Fix declaration, Oleh Krehel, 2016/01/23
- [elpa] master dbd2d20 17/78: avy.el (avy-pop-mark): Handle multiple frames, Oleh Krehel, 2016/01/23
- [elpa] master a86bdee6 16/78: avy.el (avy-pop-mark): use own history for points and windows,
Oleh Krehel <=
- [elpa] master ed120ea 19/78: avy.el (avy-goto-line): Allow numeric prefix arg, Oleh Krehel, 2016/01/23
- [elpa] master 53d457c 18/78: Add misc punctuation to subword commands, Oleh Krehel, 2016/01/23
- [elpa] master 2c74d01 21/78: avy.el (avy--generic-jump): Add beg and end optional args, Oleh Krehel, 2016/01/23
- [elpa] master 009c0bc 22/78: avy.el (avy--line): Work for visual-line-mode, Oleh Krehel, 2016/01/23
- [elpa] master 53decea 24/78: avy.el (avy--line): Don't error on end of buffer, Oleh Krehel, 2016/01/23
- [elpa] master a6cfeda 23/78: avy.el (avy-goto-subword-0): Don't offer invisible chars, Oleh Krehel, 2016/01/23
- [elpa] master 72afecb 25/78: avy.el (avy-push-mark): Bring back push-mark, Oleh Krehel, 2016/01/23
- [elpa] master b1ef1f8 26/78: avy.el (avy--line): Obey avy-background, Oleh Krehel, 2016/01/23
- [elpa] master 48aa2cd 28/78: Improve avy-goto-char-timer so that it may read 1 or many chars, Oleh Krehel, 2016/01/23
- [elpa] master ac16227 27/78: Add padding for wide-width character, Oleh Krehel, 2016/01/23