Skip to content

Instantly share code, notes, and snippets.

@k0f1sh
Last active August 10, 2017 07:27
Show Gist options
  • Save k0f1sh/f76008ea9145e525f43114b27e4027aa to your computer and use it in GitHub Desktop.
Save k0f1sh/f76008ea9145e525f43114b27e4027aa to your computer and use it in GitHub Desktop.
magit-log-allのhelm(未完成)
(defun magit-mode-setup-return-buffer (mode &rest args)
"Setup up a MODE buffer using ARGS to generate its content."
(let ((buffer (magit-mode-get-buffer mode t))
(section (magit-current-section)))
(with-current-buffer buffer
(setq magit-previous-section section)
(setq magit-refresh-args args)
(funcall mode))
(magit-display-buffer buffer)
(with-current-buffer buffer
(run-hooks 'magit-mode-setup-hook)
(magit-refresh-buffer))
buffer))
(defun helm-magit-log (revs args files)
(require 'magit)
(magit-mode-setup-return-buffer #'magit-log-mode revs args files))
(defun helm-magit-log-all-candidate-buffer ()
(interactive)
(helm-magit-log (if (magit-get-current-branch)
(list "--all")
(list "HEAD" "--all"))
nil nil))
(setq helm-magit-log-all--source
(helm-build-in-buffer-source "magit-log-all"
;;:data #'helm-magit-log-all-candidate-buffer
:init (lambda ()
(helm-init-candidates-in-buffer 'global
;; ここで名前や時間が入らない
(with-current-buffer (helm-magit-log-all-candidate-buffer)
(buffer-string))))
:action (helm-make-actions
"Copy" (lambda (line) (kill-new line)))))
(defun helm-magit-log-all ()
(interactive)
(helm
:sources '(helm-magit-log-all--source)
:buffer "*helm-magit-log-all*"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment