[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 58372db 281/348: Add command `counsel-mark-ring'
From: |
Oleh Krehel |
Subject: |
[elpa] master 58372db 281/348: Add command `counsel-mark-ring' |
Date: |
Sat, 8 Apr 2017 11:04:15 -0400 (EDT) |
branch: master
commit 58372dbae45d28b9c955aab2d9f1fd520c00e07f
Author: Lukas Fürmetz <address@hidden>
Commit: Oleh Krehel <address@hidden>
Add command `counsel-mark-ring'
Fixes #834
---
counsel.el | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/counsel.el b/counsel.el
index 108c4e0..4829515 100644
--- a/counsel.el
+++ b/counsel.el
@@ -2166,6 +2166,33 @@ INITIAL-INPUT can be given as the initial minibuffer
input."
(org-agenda-set-tags nil nil))
(fset 'org-set-tags store))))
+;;** `counsel-mark-ring'
+(defun counsel--pad (string length)
+ "Pad string to length with spaces."
+ (let ((padding (max 0 (- length (length string)))))
+ (concat string (make-string padding ?\s))))
+
+(defun counsel-mark-ring ()
+ "Browse `mark-ring' interactively."
+ (interactive)
+ (let ((candidates
+ (with-current-buffer (current-buffer)
+ (let ((padding (length (format "%s: " (line-number-at-pos
(eobp))))))
+ (save-mark-and-excursion
+ (goto-char (point-min))
+ (mapcar (lambda (mark)
+ (let* ((position (marker-position mark))
+ (line-number (line-number-at-pos position))
+ (line-marker (counsel--pad (format "%s:"
line-number) padding))
+ (bol (point-at-bol line-number))
+ (eol (point-at-eol line-number))
+ (line (buffer-substring bol eol)))
+ (cons (format "%s%s" line-marker line) position)))
+ (cl-remove-duplicates mark-ring :test #'equal)))))))
+ (ivy-read "Marks: " candidates
+ :action (lambda (elem)
+ (goto-char (cdr elem))))))
+
;;** `counsel-tmm'
(defvar tmm-km-list nil)
(declare-function tmm-get-keymap "tmm")
@@ -3133,7 +3160,8 @@ candidate."
(load-library . counsel-load-library)
(load-theme . counsel-load-theme)
(yank-pop . counsel-yank-pop)
- (info-lookup-symbol . counsel-info-lookup-symbol)))
+ (info-lookup-symbol . counsel-info-lookup-symbol)
+ (pop-mark . counsel-mark-ring)))
(define-key map (vector 'remap (car binding)) (cdr binding)))
map)
"Map for `counsel-mode'. Remaps built-in functions to counsel
- [elpa] master 50bb6b3 250/348: ivy.el (ivy-call): Call the action in ivy-state-buffer, (continued)
- [elpa] master 50bb6b3 250/348: ivy.el (ivy-call): Call the action in ivy-state-buffer, Oleh Krehel, 2017/04/08
- [elpa] master f9f2c8c 251/348: counsel.el (counsel-bookmark-avoid-dired): Add, Oleh Krehel, 2017/04/08
- [elpa] master 123f9e1 258/348: swiper-all should consider magit stash buffers too, Oleh Krehel, 2017/04/08
- [elpa] master 4dd650c 257/348: Make counsel-ag prompt for extra args when using prefix arg., Oleh Krehel, 2017/04/08
- [elpa] master a77a265 263/348: Set `outline-regexp' directory local, Oleh Krehel, 2017/04/08
- [elpa] master 109170b 264/348: Remap `backward-delete-char-untabify' to `ivy-backward-delete-char', Oleh Krehel, 2017/04/08
- [elpa] master 039c58a 254/348: counsel.el: added three new counsel commands., Oleh Krehel, 2017/04/08
- [elpa] master 5b66c18 267/348: Update copyright year, Oleh Krehel, 2017/04/08
- [elpa] master 1870f41 272/348: counsel.el: Fix counsel-command-history, Oleh Krehel, 2017/04/08
- [elpa] master c2b0d30 284/348: Add missing parameter for ag, Oleh Krehel, 2017/04/08
- [elpa] master 58372db 281/348: Add command `counsel-mark-ring',
Oleh Krehel <=
- [elpa] master 5f732cd 297/348: Add compatibility with evil-ex-search., Oleh Krehel, 2017/04/08
- [elpa] master d23d1fe 296/348: swiper.el (swiper-font-lock-exclude): Add nix-mode, Oleh Krehel, 2017/04/08
- [elpa] master 4dcd315 292/348: counsel.el: Improve counsel-package, Oleh Krehel, 2017/04/08
- [elpa] master 2b8d324 299/348: counsel.el (counsel-org-tag-action): Fix "C-M-m", Oleh Krehel, 2017/04/08
- [elpa] master c5fa8c2 308/348: Run wgrep-setup when entering ivy-occur-grep-mode, Oleh Krehel, 2017/04/08
- [elpa] master 90aaf8b 307/348: ivy.el (ivy-completing-read): Set :caller to this-command, Oleh Krehel, 2017/04/08
- [elpa] master e9219e7 313/348: ivy-hydra.el: Use ivy-minibuffer-map, Oleh Krehel, 2017/04/08
- [elpa] master 7f5b268 311/348: ivy-hydra.el: Add an alternative "M-o" using hydra, Oleh Krehel, 2017/04/08
- [elpa] master beffa78 323/348: counsel.el (counsel-grep-base-command): Single quote regex, Oleh Krehel, 2017/04/08
- [elpa] master 7b453c8 329/348: ivy.el (ivy-completion-in-region-action): Work for cons cells, Oleh Krehel, 2017/04/08