From d2efe59b0690eb6d13bac55bf8b81436c0284110 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Sun, 1 Jul 2012 14:17:54 +0200 Subject: Rewrite and hopefully improve upon a big chunk of the site --- site/projects/git-auto-commit-mode.org | 116 ++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 53 deletions(-) (limited to 'site/projects/git-auto-commit-mode.org') diff --git a/site/projects/git-auto-commit-mode.org b/site/projects/git-auto-commit-mode.org index 3542217..c7b0b99 100644 --- a/site/projects/git-auto-commit-mode.org +++ b/site/projects/git-auto-commit-mode.org @@ -1,90 +1,100 @@ #+TITLE: git-auto-commit-mode #+STYLE: #+LINK_UP: ../index.html -#+LINK_HOME: ../index.html +#+LINK_HOME: http://ryuslash.org #+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 +#+STARTUP: showall + +#+begin_html + + +#+end_html -#+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 + ~git-auto-commit-mode~ is a minor mode for GNU + Emacs[fn::http://gnu.org/software/emacs/] that, when enabled, tries + to commit changes to a file after every save. It can also try to + push to the default upstream. - 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 +** Features - ~git-auto-commit-mode~ blindly calls + - Automatically commit changes to a file after each save. - #+BEGIN_SRC bash - git add FILE - git commit -m "RELATIVE-FILE-PATH" - #+END_SRC + - The commit message will contain the file name relative to the + repository root. - setting up the git repository correctly is the responsibility of - the user. + - Optionally, automatically push commits to the default upstream. -** Features +** Requirements - ~git-auto-commit-mode~ only really has one feature: + These should be mostly obvious. - - Automatically commit file to current git repository after saving. + - [[http://gnu.org/software/emacs][GNU Emacs]] + - [[http://git-scm.com][git]] * 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 + #+begin_src emacs-lisp + (add-to-list 'load-path "~/path/to/git-auto-commit-mode.el") + (auto load 'git-auto-commit-mode "git-auto-commit-mode") + #+end_src + +** Automatically commit + + There are a few ways this could be used: + +*** As file-local variable - There are a few ways this could be used: + 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: -** As file-local variable + #+BEGIN_SRC emacs-lisp + ;; -*- eval: (git-auto-commit-mode 1) -*- + #+END_SRC - 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: + Or, if you're in anything older than emacs 24: - #+BEGIN_SRC emacs-lisp - ;; -*- eval: (git-auto-commit-mode 1) -*- - #+END_SRC + #+BEGIN_SRC emacs-lisp + ;; -*- mode: git-auto-commit -*- + #+END_SRC - Or, if you're in anything older than emacs 24: +*** As a directory-local variable - #+BEGIN_SRC emacs-lisp - ;; -*- mode: git-auto-commit -*- - #+END_SRC + Put the following in a ~.dir-locals.el~ file in any directory where + you want to enable ~git-auto-commit-mode~ for *all* files: -** As a directory-local variable + #+BEGIN_SRC emacs-lisp + ((nil . ((git-auto-commit-mode . t)))) + #+END_SRC - Put the following in a ~.dir-locals.el~ file in any directory where - you want to enable ~git-auto-commit-mode~ for *all* files: +*** As a hook - #+BEGIN_SRC emacs-lisp - ((nil . ((git-auto-commit-mode . t)))) - #+END_SRC + I doubt this will ever really be useful, but it is possible: -** As a hook + #+BEGIN_SRC emacs-lisp + (add-hook 'some-hook 'git-auto-commit-mode) + #+END_SRC - I doubt this will ever really be useful, but it is possible: +** Automatically push - #+BEGIN_SRC emacs-lisp - (add-hook 'some-hook 'git-auto-commit-mode) - #+END_SRC + 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: -#+INCLUDE: "../header.org" :lines "5-8" + #+begin_src emacs-lisp + (setq-default gac-automatically-push-p t) + #+end_src -- cgit v1.2.3-54-g00ecf