[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ivy-hydra 0ce0bf1 123/395: counsel.el (counsel-evil-mar
From: |
Basil L. Contovounesios |
Subject: |
[elpa] externals/ivy-hydra 0ce0bf1 123/395: counsel.el (counsel-evil-marks): Add |
Date: |
Thu, 25 Feb 2021 08:31:45 -0500 (EST) |
branch: externals/ivy-hydra
commit 0ce0bf1b2e50a24ad03d2a19cd68081831a3c2ff
Author: MoHKale <mohkalsin@gmail.com>
Commit: Oleh Krehel <ohwoeowho@gmail.com>
counsel.el (counsel-evil-marks): Add
Fixes #2247
Re #2246
Re #2221
---
counsel.el | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git a/counsel.el b/counsel.el
index 22066e4..de02da1 100644
--- a/counsel.el
+++ b/counsel.el
@@ -3941,6 +3941,68 @@ Position of selected mark outside accessible part of
buffer")))
:unwind-fn #'counsel--mark-ring-unwind
:sort-fn #'ivy-string<)
+;;** `counsel-evil-marks'
+(defvar counsel--evil-marks-exclude-registers nil
+ "List of evil registers to not display in `counsel-evil-marks' by default.
+Each member of the list should be a character (stored as an integer).")
+
+(defun counsel-mark--get-evil-candidates ()
+ "Convert all evil MARKS in the current buffer to mark candidates.
+works like `counsel-mark--get-candidates' but also prepends the
+register tied to a mark in the message string."
+ ;; evil doesn't provide a standalone method to access the list of
+ ;; marks in the current buffer, as it does with registers.
+ (let* ((all-markers
+ (append
+ (cl-remove-if (lambda (m)
+ (or (evil-global-marker-p (car m))
+ (not (markerp (cdr m)))))
+ evil-markers-alist)
+ (cl-remove-if (lambda (m)
+ (or (not (evil-global-marker-p (car m)))
+ (not (markerp (cdr m)))))
+ (default-value 'evil-markers-alist))))
+
+ (all-markers
+ ;; with prefix, ignore register exclusion list.
+ (if prefix-arg
+ all-markers
+ (cl-remove-if-not
+ (lambda (x) (not (member (car x)
counsel--evil-marks-exclude-registers)))
+ all-markers)))
+ ;; seperate the markers from the evil registers
+ ;; for call to `counsel-mark--get-candidates'
+ (registers (mapcar #'car all-markers))
+ (markers (mapcar #'cdr all-markers))
+ (candidates (counsel-mark--get-candidates markers)))
+ (when candidates
+ (let (register candidate result)
+ (while (and (setq register (pop registers))
+ (setq candidate (pop candidates)))
+ (let ((point (get-text-property 0 'point candidate))
+ (evil-candidate
+ (format "[%s]: %s"
+ (propertize (char-to-string register)
+ 'face 'counsel-evil-register-face)
+ candidate)))
+ (push (propertize evil-candidate 'point point) result)))
+ result))))
+
+;;;###autoload
+(defun counsel-evil-marks ()
+ "Ivy replacement for `evil-show-marks'.
+By default, this function respects `counsel--evil-marks-exclude-registers'.
+Pass a prefix argument to display all active evil registers."
+ (interactive)
+ (if (and (boundp 'evil-markers-alist)
+ (fboundp 'evil-global-marker-p))
+ (let* ((counsel--mark-ring-calling-point (point))
+ (candidates (counsel-mark--get-evil-candidates)))
+ (if candidates
+ (counsel-mark--ivy-read candidates 'counsel-evil-marks)
+ (message "no evil marks are active")))
+ (user-error "Required feature `evil' not installed or not loaded.")))
+
;;** `counsel-package'
(defvar package--initialized)
(defvar package-alist)
- [elpa] externals/ivy-hydra 4894b65 329/395: ivy-avy.el: Don't overwrite existing ivy-minibuffer-map binding, (continued)
- [elpa] externals/ivy-hydra 4894b65 329/395: ivy-avy.el: Don't overwrite existing ivy-minibuffer-map binding, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 8783d92 321/395: ivy.el: Remove most minibuffer-only commands from the counsel-M-x list, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 40634b7 349/395: ivy.el (ivy--alist-set): Don't touch values set by customize, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 721a3b7 371/395: Make ivy-mode more careful when setting globals, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 5de2662 372/395: counsel.el (counsel-linux-app): Clean up env part of the cmd, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d2891aa 376/395: Percent-encode counsel-search query, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra f90c018 389/395: counsel.el (counsel-grep-like-occur): Use ivy-text as backup, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 3c53de1 390/395: * .elpaignore: New file., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 496a5e2 105/395: counsel.el: Fix ivy-occur ivy--regex-function bug, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 6b4f43a 111/395: ivy.el (ivy--update-minibuffer): Return string, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 0ce0bf1 123/395: counsel.el (counsel-evil-marks): Add,
Basil L. Contovounesios <=
- [elpa] externals/ivy-hydra e05bc45 108/395: ivy.el (ivy--recompute-index): Take one less argument, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 723e4d6 126/395: counsel.el: Point to evil-common for evil-global-marker-p declaration., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 04e7942 130/395: counsel-kmacro: Small improvements to functions and documentation strings., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 4d161cc 128/395: counsel-kmacro: Clarify copying of values for next macro user defines., Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 16298bc 137/395: ivy.el (ivy-read-action-format-function): Upgrade to defcustom, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 269583d 125/395: counsel.el (counsel-locate-cmd-es): Switch flags order, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 098f8fe 133/395: swiper.el (swiper-isearch-toggle): Fix up, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra b20a6db 135/395: counsel.el (counsel-recentf-candidates): Sort remote files better, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra d1c3613 140/395: Fix ivy-{next, previous}-line-or-history when input is empty, Basil L. Contovounesios, 2021/02/25
- [elpa] externals/ivy-hydra 2229801 142/395: counsel.el (counsel-M-x-action): Trim left ^, Basil L. Contovounesios, 2021/02/25