[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 3b6c898 303/399: counsel.el (counsel-mark-ring): Add previ
From: |
Oleh Krehel |
Subject: |
[elpa] master 3b6c898 303/399: counsel.el (counsel-mark-ring): Add preview by candidate |
Date: |
Sat, 20 Jul 2019 14:57:45 -0400 (EDT) |
branch: master
commit 3b6c898354d4b8c8e4f5ed555ae0f722b04facba
Author: SAITOU Keita <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-mark-ring): Add preview by candidate
---
counsel.el | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/counsel.el b/counsel.el
index 08e7868..fca4d4b 100644
--- a/counsel.el
+++ b/counsel.el
@@ -3555,11 +3555,26 @@ This variable has no effect unless
;;* Misc. Emacs
;;** `counsel-mark-ring'
+(defvar counsel--mark-ring-calling-point 0
+ "Internal variable to remember calling position.")
+
+(defun counsel--mark-ring-unwind ()
+ "Return back to calling position of `counsel-mark-ring'."
+ (goto-char counsel--mark-ring-calling-point))
+
+(defun counsel--mark-ring-update-fn ()
+ "Show preview by candidate."
+ (let ((linenum (string-to-number (ivy-state-current ivy-last))))
+ (unless (= linenum 0)
+ (with-ivy-window
+ (forward-line (- linenum (line-number-at-pos)))))))
+
(defun counsel-mark-ring ()
"Browse `mark-ring' interactively.
Obeys `widen-automatically', which see."
(interactive)
- (let ((cands
+ (let ((counsel--mark-ring-calling-point (point))
+ (cands
(save-excursion
(save-restriction
;; Widen, both to save `line-number-at-pos' the trouble
@@ -3579,6 +3594,7 @@ Obeys `widen-automatically', which see."
(if cands
(ivy-read "Mark: " cands
:require-match t
+ :update-fn #'counsel--mark-ring-update-fn
:action (lambda (cand)
(let ((pos (cdr-safe cand)))
(when pos
@@ -3588,6 +3604,7 @@ Obeys `widen-automatically', which see."
(error "\
Position of selected mark outside accessible part of buffer")))
(goto-char pos))))
+ :unwind #'counsel--mark-ring-unwind
:caller 'counsel-mark-ring)
(message "Mark ring is empty"))))
- [elpa] master 7feb14f 289/399: ivy.el (ivy-format-functions-alist): New defcustom, obsoletes ivy-format-function, (continued)
- [elpa] master 7feb14f 289/399: ivy.el (ivy-format-functions-alist): New defcustom, obsoletes ivy-format-function, Oleh Krehel, 2019/07/20
- [elpa] master b528f0f 299/399: ivy-overlay.el (ivy-display-function-overlay): Fix org-indent-mode once more, Oleh Krehel, 2019/07/20
- [elpa] master ef1e8d5 294/399: ivy.el (ivy-read): Don't use ivy-display-function, Oleh Krehel, 2019/07/20
- [elpa] master 57a57d1 302/399: swiper.el (swiper--multi-candidates): Simplify, Oleh Krehel, 2019/07/20
- [elpa] master 44b2d7d 300/399: ivy.el (ivy-insert-current-full): Add and bind to "C-M-y", Oleh Krehel, 2019/07/20
- [elpa] master d39f82b 307/399: counsel-yank-pop-height is obselete and doesn't do anything, Oleh Krehel, 2019/07/20
- [elpa] master c11797a 290/399: swiper.el (swiper--line-at-point): Fix swiper-isearch in compilation buffers, Oleh Krehel, 2019/07/20
- [elpa] master 94f107b 304/399: counsel.el (counsel-mark-ring): Add highlight by candidate, Oleh Krehel, 2019/07/20
- [elpa] master 034f3af 306/399: swiper.el (swiper-isearch): Allow char-fold-to-regexp, Oleh Krehel, 2019/07/20
- [elpa] master 5cc1e5c 298/399: swiper.el (swiper-isearch-thing-at-point): Improve, Oleh Krehel, 2019/07/20
- [elpa] master 3b6c898 303/399: counsel.el (counsel-mark-ring): Add preview by candidate,
Oleh Krehel <=
- [elpa] master 93616f7 296/399: ivy.el (ivy--regex): Match initial dot in the input as a literal dot, Oleh Krehel, 2019/07/20
- [elpa] master ac1e07c 305/399: ivy.el (ivy--reset-state): Modify prompt for multi-isearch-buffers, Oleh Krehel, 2019/07/20
- [elpa] master 4078eb9 308/399: counsel.el (counsel-yank-pop-height): Remove, Oleh Krehel, 2019/07/20
- [elpa] master 895906e 309/399: counsel.el (counsel-descbinds-function): Add, Oleh Krehel, 2019/07/20
- [elpa] master 4a37e1e 314/399: swiper.el (swiper-query-replace): Make eval-style replacement more accessible, Oleh Krehel, 2019/07/20
- [elpa] master dd2d495 312/399: swiper.el (swiper-all-thing-at-point): Add, Oleh Krehel, 2019/07/20
- [elpa] master 0576b61 315/399: .github/FUNDING.yml: Add, Oleh Krehel, 2019/07/20
- [elpa] master d060eea 313/399: swiper.el (swiper-query-replace): Add query-replace-compile-replacement, Oleh Krehel, 2019/07/20
- [elpa] master 09b9508 321/399: ivy.el (ivy--find-file-action): Fix for virtual buffers, Oleh Krehel, 2019/07/20
- [elpa] master 7d46450 311/399: Add more information about the collection argument in `ivy-read`., Oleh Krehel, 2019/07/20