Replace cl functions.
This commit is contained in:
parent
f2817e7c78
commit
326fff2823
1 changed files with 24 additions and 12 deletions
22
magit.el
22
magit.el
|
@ -4047,21 +4047,33 @@ With prefix force the removal even it it hasn't been merged."
|
||||||
|
|
||||||
(defun magit-list-buffers ()
|
(defun magit-list-buffers ()
|
||||||
"Returns a list of magit buffers."
|
"Returns a list of magit buffers."
|
||||||
(remove-if-not (lambda (b)
|
(delq nil (mapcar (lambda (b)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(set-buffer b)
|
(set-buffer b)
|
||||||
(eq major-mode 'magit-mode)))
|
(when (eq major-mode 'magit-mode)
|
||||||
(buffer-list)))
|
b)))
|
||||||
|
(buffer-list))))
|
||||||
|
|
||||||
|
(defun remove-dupes (list)
|
||||||
|
"Remove the duplicate items in a sorted list."
|
||||||
|
(let (tmp-list head)
|
||||||
|
(while list
|
||||||
|
(setq head (pop list))
|
||||||
|
(unless (equal head (car list))
|
||||||
|
(push head tmp-list)))
|
||||||
|
(reverse tmp-list)))
|
||||||
|
|
||||||
(defun magit-list-projects ()
|
(defun magit-list-projects ()
|
||||||
"Returns a list of directories with a magit representation."
|
"Returns a list of directories with a magit representation."
|
||||||
(remove-duplicates
|
(remove-dupes
|
||||||
|
(sort
|
||||||
(mapcar (lambda (b)
|
(mapcar (lambda (b)
|
||||||
(save-excursion
|
(save-excursion
|
||||||
(set-buffer b)
|
(set-buffer b)
|
||||||
(directory-file-name default-directory)))
|
(directory-file-name default-directory)))
|
||||||
(magit-list-buffers))
|
(magit-list-buffers))
|
||||||
:test 'string=))
|
'string=)))
|
||||||
|
|
||||||
|
|
||||||
(provide 'magit)
|
(provide 'magit)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue