[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] master 464875a 103/184: counsel.el (counsel-mark-ring): Refactor
From: |
Oleh Krehel |
Subject: |
[elpa] master 464875a 103/184: counsel.el (counsel-mark-ring): Refactor for reducing nested let |
Date: |
Wed, 16 Oct 2019 13:15:00 -0400 (EDT) |
branch: master
commit 464875a58a113db32c1902fb6cab8db015b95542
Author: SAITOU Keita <address@hidden>
Commit: Oleh Krehel <address@hidden>
counsel.el (counsel-mark-ring): Refactor for reducing nested let
Fixes #2237
---
counsel.el | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)
diff --git a/counsel.el b/counsel.el
index 2d653ab..74114b4 100644
--- a/counsel.el
+++ b/counsel.el
@@ -3758,24 +3758,24 @@ This variable has no effect unless
"Browse `mark-ring' interactively.
Obeys `widen-automatically', which see."
(interactive)
- (let ((counsel--mark-ring-calling-point (point))
- (cands
- (save-excursion
- (save-restriction
- ;; Widen, both to save `line-number-at-pos' the trouble
- ;; and for `buffer-substring' to work.
- (widen)
- (let ((fmt (format "%%%dd %%s"
- (length (number-to-string
- (line-number-at-pos (point-max)))))))
- (mapcar (lambda (mark)
- (goto-char (marker-position mark))
- (let ((linum (line-number-at-pos))
- (line (buffer-substring
- (line-beginning-position)
- (line-end-position))))
- (cons (format fmt linum line) (point))))
- (sort (delete-dups (copy-sequence mark-ring)) #'<)))))))
+ (let* ((counsel--mark-ring-calling-point (point))
+ (width (length (number-to-string (line-number-at-pos (point-max)))))
+ (fmt (format "%%%dd %%s" width))
+ (make-candidate
+ (lambda (mark)
+ (goto-char (marker-position mark))
+ (let ((linum (line-number-at-pos))
+ (line (buffer-substring
+ (line-beginning-position) (line-end-position))))
+ (cons (format fmt linum line) (point)))))
+ (marks (sort (delete-dups (copy-sequence mark-ring)) #'<))
+ (cands
+ ;; Widen, both to save `line-number-at-pos' the trouble
+ ;; and for `buffer-substring' to work.
+ (save-excursion
+ (save-restriction
+ (widen)
+ (mapcar make-candidate marks)))))
(if cands
(ivy-read "Mark: " cands
:require-match t
- [elpa] master 0be5b58 067/184: ivy.el (ivy-partial): Don't rely on subr-x, (continued)
- [elpa] master 0be5b58 067/184: ivy.el (ivy-partial): Don't rely on subr-x, Oleh Krehel, 2019/10/16
- [elpa] master a986e4e 071/184: ivy.el (ivy--yank-handle-case-fold): Add, Oleh Krehel, 2019/10/16
- [elpa] master e41cbec 073/184: ivy.el (ivy-immediate-done): Fix parent dirs for read-directory-name, Oleh Krehel, 2019/10/16
- [elpa] master 3256447 076/184: ivy.el (ivy--partial-cd-for-single-directory): Extract, Oleh Krehel, 2019/10/16
- [elpa] master 03b3f82 075/184: ivy.el (ivy-partial): Use ivy--filter in place of all-completions, Oleh Krehel, 2019/10/16
- [elpa] master daf4683 081/184: ivy.el (ivy--directory-done): Inhibit distracting TRAMP message for /sudo::, Oleh Krehel, 2019/10/16
- [elpa] master 9e03f36 095/184: ivy-test.el: Turn two tests back on, Oleh Krehel, 2019/10/16
- [elpa] master 4b7b075 093/184: ivy-test.el (ivy-test-inhibit-message): Add, Oleh Krehel, 2019/10/16
- [elpa] master 967d046 091/184: ivy-test.el (counsel-yank-pop): Fix on Windows, Oleh Krehel, 2019/10/16
- [elpa] master cfbf481 089/184: Lazy load ffap, Oleh Krehel, 2019/10/16
- [elpa] master 464875a 103/184: counsel.el (counsel-mark-ring): Refactor for reducing nested let,
Oleh Krehel <=
- [elpa] master 0c1901e 100/184: ivy.el (ivy--regex-ignore-order): Fix docstring, Oleh Krehel, 2019/10/16
- [elpa] master 6905e6c 097/184: counsel.el (counsel--rg-targets): Adjust for ivy-occur buffers, Oleh Krehel, 2019/10/16
- [elpa] master e6171e2 098/184: ivy-hydra.el (ivy-dispatching-done-hydra): Fix for ivy-resume, Oleh Krehel, 2019/10/16
- [elpa] master 943eb01 108/184: counsel.el (counsel-mark-ring): Goto actual point instead of line, Oleh Krehel, 2019/10/16
- [elpa] master 36045f7 003/184: doc/Changelog.org: Fixup, Oleh Krehel, 2019/10/16
- [elpa] master 4389a26 056/184: ivy-overlay.el (ivy-overlay-show-after): Check window height better, Oleh Krehel, 2019/10/16
- [elpa] master 1332ab0 068/184: counsel.el (counsel-compile-env-pattern): Fix regex typo, Oleh Krehel, 2019/10/16
- [elpa] master beb3aee 080/184: ivy.el (ivy--directory-done): Handle "/ C-j" on remote, Oleh Krehel, 2019/10/16
- [elpa] master e62e7de 090/184: ivy-test.el (ivy-test-run-tests): Fix, Oleh Krehel, 2019/10/16
- [elpa] master 73d9f4a 083/184: Place cursor at the begging of matches (for grep), Oleh Krehel, 2019/10/16