Merge branch 'am-from-wl'
This commit is contained in:
commit
dbbf2cf669
1 changed files with 41 additions and 0 deletions
41
magit.el
41
magit.el
|
@ -4045,6 +4045,47 @@ With prefix force the removal even it it hasn't been merged."
|
|||
((diff)
|
||||
(magit-interactive-resolve (cadr info)))))
|
||||
|
||||
(defun magit-list-buffers ()
|
||||
"Returns a list of magit buffers."
|
||||
(delq nil (mapcar (lambda (b)
|
||||
(save-excursion
|
||||
(set-buffer b)
|
||||
(when (eq major-mode 'magit-mode)
|
||||
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 ()
|
||||
"Returns a list of directories with a magit representation."
|
||||
(remove-dupes
|
||||
(sort
|
||||
(mapcar (lambda (b)
|
||||
(save-excursion
|
||||
(set-buffer b)
|
||||
(directory-file-name default-directory)))
|
||||
(magit-list-buffers))
|
||||
'string=)))
|
||||
|
||||
(defun magit-wl-pipe-to-am ()
|
||||
"Ask the user for a project in which to apply (via am) the
|
||||
current email in wl."
|
||||
(interactive)
|
||||
"Pipe a wanderlust message into git am."
|
||||
(let* ((proj (funcall magit-completing-read
|
||||
"Apply to project: "
|
||||
(magit-list-projects)
|
||||
nil t nil nil)))
|
||||
(wl-summary-pipe-message-subr
|
||||
nil (format "cd '%s' && git am" proj))))
|
||||
|
||||
(provide 'magit)
|
||||
|
||||
;;; magit.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue