90 lines
2.4 KiB
Org Mode
90 lines
2.4 KiB
Org Mode
#+TITLE: git-auto-commit-mode
|
|
#+STYLE: <link rel="stylesheet" type="text/css" href="../../stylesheet.css" />
|
|
#+LINK_UP: ../index.html
|
|
#+LINK_HOME: ../index.html
|
|
#+LINK: src https://github.com/ryuslash/git-auto-commit-mode
|
|
#+LINK: tar_gz https://github.com/ryuslash/git-auto-commit-mode/tarball/master
|
|
#+LINK: zip https://github.com/ryuslash/git-auto-commit-mode/zipball/master
|
|
|
|
#+INCLUDE: "../header.org" :lines "1-4"
|
|
#+INCLUDE: "dlmenu.inc"
|
|
|
|
* About
|
|
|
|
~git-auto-commit-mode~ is a minor mode for GNU Emacs[fn::
|
|
http://gnu.org/software/emacs/] that, when enabled, adds and commits
|
|
a file after every save.
|
|
|
|
** Why
|
|
|
|
I thought of it when I was editing my configuration files. Most of
|
|
my changes in my configuration files are fairly simple and I would
|
|
like them immediately committed, I don't want to have to sift
|
|
through all the changes at a later point to figure out what I want
|
|
to commit when.
|
|
|
|
** How
|
|
|
|
~git-auto-commit-mode~ blindly calls
|
|
|
|
#+BEGIN_SRC bash
|
|
git add FILE
|
|
git commit -m "RELATIVE-FILE-PATH"
|
|
#+END_SRC
|
|
|
|
setting up the git repository correctly is the responsibility of
|
|
the user.
|
|
|
|
** Features
|
|
|
|
~git-auto-commit-mode~ only really has one feature:
|
|
|
|
- Automatically commit file to current git repository after saving.
|
|
|
|
* Usage
|
|
|
|
To be able to use it you need to put it somewhere in your
|
|
~load-path~ and load it, for example:
|
|
|
|
#+NAME: .emacs.d
|
|
#+BEGIN_SRC emacs-lisp
|
|
(add-to-list 'load-path "~/path/to/git-auto-commit-mode.el")
|
|
(autoload 'git-auto-commit-mode "git-auto-commit-mode")
|
|
#+END_SRC
|
|
|
|
There are a few ways this could be used:
|
|
|
|
** As file-local variable
|
|
|
|
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:
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
;; -*- eval: (git-auto-commit-mode 1) -*-
|
|
#+END_SRC
|
|
|
|
Or, if you're in anything older than emacs 24:
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
;; -*- mode: git-auto-commit -*-
|
|
#+END_SRC
|
|
|
|
** As a directory-local variable
|
|
|
|
Put the following in a ~.dir-locals.el~ file in any directory where
|
|
you want to enable ~git-auto-commit-mode~ for *all* files:
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
((nil . ((git-auto-commit-mode . t))))
|
|
#+END_SRC
|
|
|
|
** As a hook
|
|
|
|
I doubt this will ever really be useful, but it is possible:
|
|
|
|
#+BEGIN_SRC emacs-lisp
|
|
(add-hook 'some-hook 'git-auto-commit-mode)
|
|
#+END_SRC
|
|
|
|
#+INCLUDE: "../header.org" :lines "5-8"
|