Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort helm-multi-swoop buffer candidate list #193

Merged
merged 11 commits into from
Aug 14, 2020
30 changes: 13 additions & 17 deletions helm-swoop.el
Original file line number Diff line number Diff line change
Expand Up @@ -1078,23 +1078,19 @@ If LINUM is number, lines are separated by LINUM."
(defun helm-multi-swoop--get-marked-buffers ()
"Get marked buffers."
(let ((buf (get-buffer helm-multi-swoop-buffer-list))
list)
(when buf
(with-current-buffer (get-buffer helm-multi-swoop-buffer-list)
(mapc (lambda (ov)
(when (eq 'helm-visible-mark (overlay-get ov 'face))
(setq list (cons
(let ((word (buffer-substring-no-properties
(overlay-start ov) (overlay-end ov))))
(mapc (lambda (r)
(setq word (replace-regexp-in-string
(car r) (cdr r) word)))
(list '("\\`[ \t\n\r]+" . "")
'("[ \t\n\r]+\\'" . "")))
word)
list))))
(overlays-in (point-min) (point-max))))
(delete "" list))))
lst)
(when (buffer-live-p buf)
(with-current-buffer buf
(dolist (ov (cl-delete-if-not
(lambda (o)
(eq 'helm-visible-mark (overlay-get o 'face)))
(overlays-in (point-min) (point-max))))
(let ((word (string-trim
(buffer-substring-no-properties
(overlay-start ov) (overlay-end ov)))))
(unless (string-empty-p word)
(push word lst)))))
(nreverse (sort lst #'string<)))))

;; core --------------------------------------------------------

Expand Down