2012-06-21 21:24:54 +02:00
|
|
|
#+TITLE: git-auto-commit-mode
|
2013-01-11 01:16:41 +01:00
|
|
|
#+LINK: src http://code.ryuslash.org/cgit.cgi/emacs/git-auto-commit-mode/
|
|
|
|
#+LINK: tar_gz http://code.ryuslash.org/cgit.cgi/emacs/git-auto-commit-mode/snapshot/git-auto-commit-mode-master.tar.gz
|
|
|
|
#+LINK: zip http://code.ryuslash.org/cgit.cgi/emacs/git-auto-commit-mode/snapshot/git-auto-commit-mode-master.zip
|
2012-07-01 14:17:54 +02:00
|
|
|
#+STARTUP: showall
|
|
|
|
|
|
|
|
#+begin_html
|
|
|
|
<script src="/keyjs.js" type="text/javascript"></script>
|
|
|
|
<script type="text/javascript">
|
|
|
|
keyjs_initialize({ "u": [ "keyjs_goto", "../index.html" ],
|
|
|
|
"h": [ "keyjs_goto", "http://ryuslash.org" ] });
|
|
|
|
</script>
|
|
|
|
#+end_html
|
2012-06-21 21:24:54 +02:00
|
|
|
|
|
|
|
#+INCLUDE: "dlmenu.inc"
|
|
|
|
|
|
|
|
* About
|
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
~git-auto-commit-mode~ is a minor mode for GNU Emacs that, when
|
|
|
|
enabled, tries to commit changes to a file after every save. It can
|
|
|
|
also try to push to the default upstream.
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
| Status | On-hold |
|
|
|
|
| Language | Emacs Lisp |
|
|
|
|
| Licennse | GPLv3 |
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
* Features
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
- Automatically commit changes to a file after each save.
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
- The commit message will contain the file name relative to the
|
|
|
|
repository root.
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
- Optionally, automatically push commits to the default upstream.
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
* Requirements
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
- [[http://gnu.org/software/emacs][GNU Emacs]]
|
|
|
|
- [[http://git-scm.com][git]]
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
* Download
|
|
|
|
|
|
|
|
There are download links for a ~tar.gz~ and a ~zip~ file of the latest
|
|
|
|
development version at the top of this page.
|
|
|
|
|
|
|
|
~git-auto-commit-mode~ is in the [[http://marmalade-repo.org/][Marmalade]] repo.
|
|
|
|
|
|
|
|
* Install
|
|
|
|
|
|
|
|
Once you have [[Download][downloaded]] ~git-auto-commit-mode~ you have at least 2
|
|
|
|
choices for installation.
|
|
|
|
|
|
|
|
** package.el
|
|
|
|
|
|
|
|
If you have Emacs v24+ or [[http://tromey.com/elpa/install.html][package.el]] and Marmalade configured, you
|
|
|
|
can just:
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(package-install "git-auto-commit-mode")
|
|
|
|
#+END_SRC
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
** manual
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
Otherwise you have to [[Download][dowload]] it and then put it somewhere in your
|
|
|
|
=load-path=, or add that location to your =load-path=:
|
2012-07-01 14:17:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(add-to-list 'load-path "~/location/of/git-auto-commit-mode")
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
After which you can either ~require~ the package in your Emacs init
|
|
|
|
file:
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(require 'git-auto-commit-mode)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
Or set-up some autoloads:
|
|
|
|
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(autoload 'git-auto-commit-mode "git-auto-commit-mode" nil t)
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
* Usage
|
2012-07-01 14:17:54 +02:00
|
|
|
|
|
|
|
There are a few ways this could be used:
|
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
** As file-local variable
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
This is the way I use it and I wanted to use it. Any file that you
|
|
|
|
would like to have automatically committed upon saving gets this
|
|
|
|
prop-line:
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
;; -*- eval: (git-auto-commit-mode 1) -*-
|
|
|
|
#+END_SRC
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
Or, if you're in anything older than emacs 24:
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
;; -*- mode: git-auto-commit -*-
|
|
|
|
#+END_SRC
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
** As a directory-local variable
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
Put the following in a ~.dir-locals.el~ file in any directory where
|
|
|
|
you want to enable ~git-auto-commit-mode~ for *all* files:
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
((nil . ((git-auto-commit-mode . t))))
|
|
|
|
#+END_SRC
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
** As a hook
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
I doubt this will ever really be useful, but it is possible:
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2013-01-11 01:16:41 +01:00
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
|
|
(add-hook 'some-hook 'git-auto-commit-mode)
|
|
|
|
#+END_SRC
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2012-07-01 14:17:54 +02:00
|
|
|
** Automatically push
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2012-07-01 14:17:54 +02:00
|
|
|
If you wish to push your changes each time the file is saved you
|
|
|
|
should set =gac-automatically-push-p= to =t=. This is a buffer local
|
|
|
|
variable, so you will have to put it in your dir-local or
|
|
|
|
file-local variables. Alternatively, if you're sure you can also
|
|
|
|
set the default value to =t=, like so:
|
2012-06-21 21:24:54 +02:00
|
|
|
|
2012-07-01 14:17:54 +02:00
|
|
|
#+begin_src emacs-lisp
|
|
|
|
(setq-default gac-automatically-push-p t)
|
|
|
|
#+end_src
|