強引すぎるが、モードラインに現在のbranchを表示するための。もっといい方法は絶対ある。elisp 忘れたからもうこれでいい。これは tramp 上でも動いたし。
magit-post-command-hook ってのは名前から想像するフックじゃないのかな。
(remove-hook 'find-file-hooks 'vc-find-file-hook)

(setenv "PATH" "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin")

(add-to-list 'load-path "~/emacs/lisp/magit/")
(require 'magit)

(setq magit-git-executable "/usr/local/bin/git")

(defun my-show-git-current-branch ()
  (interactive)
  (message (magit-get-current-branch))
  (my-set-git-current-branch))
(define-key esc-map "B" 'my-show-git-current-branch)
(defun my-set-git-current-branch ()
  (setq mode-line-frame-identification (format "(%s)" (magit-get-current-branch))))

;; (set-default 'mode-line-frame-identification '(my-set-git-current-branch))

(add-hook 'magit-post-command-hook 'my-set-git-current-branch)
(add-hook 'dired-mode-hook 'my-set-git-current-branch)
(add-hook 'find-file-hook  'my-set-git-current-branch)