Some other interesting things when working with emacs+git:
--8<---------------cut here---------------start------------->8---
(defun git-branches-list ()
  "list the current branches"
  (remove "*" (split-string (shell-command-to-string "git branch"))))

(defun git-change-branch ()
  "change the actual git branch asking with completion"
  (interactive)
  (let
      ((branches (git-branches-list)))
    (if
        (> (length branches) 1)
        (let
            ((branch (completing-read "checkout to: " branches)))
          (shell-command (concat "git checkout " branch)))
      (message "no other branches, sorry"))))
--8<---------------cut here---------------end--------------->8---

And this is also quite handy
--8<---------------cut here---------------start------------->8---
(defun is-version-control-file ()
  "Return nil unless the file is in the git files"
  (if (vc-working-revision (buffer-file-name))
      (auto-revert-mode t)))

(add-hook 'find-file-hook 'is-version-control-file)
--8<---------------cut here---------------end--------------->8---

Every file under revision control is auto-reverted when switching
branches for example.

Much more stuff can be found here:
https://github.com/AndreaCrotti/Emacs-configuration/

And now I quit the emacs-evangelism-mode ;)
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to