@matheusbsbs / matheus-bagliano / commits / f6f125fbaa
Fork 0

git-blame: Change installation instructions

Change installation instructions to using either "(require 'git-blame)" or appropriate autoload instruction in GNU Emacs init file, .emacs This required adding "(provide 'git-blame)" at the end of git-blame.el and adding [preliminary] docstring to `git-blame-mode' function for consistency (to mark function as interactive in `autoload' we have to provide docstring as DOCSTRING is third arg, and INTERACTIVE fourth, and both are optional). `git-blame-mode' is marked to autoload. While at it ensure that we add `git-blame-mode' to `minor-mode-alist' only once (in a way that does not depend on `cl' package). Signed-off-by: Jakub Narebski <jnareb@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>

Jakub Narebski committed Feb 9, 2007 at 09:19 UTC f6f125fbaa79c097f10afdbd7103ec068df10397
1 file changed +19 -4
contrib/emacs/git-blame.el
+19 -4
@@ -44,9 +44,20 @@
44
45 ;;; Installation:
46 ;;
47 -;; 1) Load into emacs: M-x load-file RET git-blame.el RET
48 -;; 2) Open a git-controlled file
49 -;; 3) Blame: M-x git-blame-mode
47 +;; To use this package, put it somewhere in `load-path' (or add
48 +;; directory with git-blame.el to `load-path'), and add the following
49 +;; line to your .emacs:
50 +;;
51 +;; (require 'git-blame)
52 +;;
53 +;; If you do not want to load this package before it is necessary, you
54 +;; can make use of the `autoload' feature, e.g. by adding to your .emacs
55 +;; the following lines
56 +;;
57 +;; (autoload 'git-blame-mode "git-blame"
58 +;; "Minor mode for incremental blame for Git." t)
59 +;;
60 +;; Then first use of `M-x git-blame-mode' would load the package.
61
62 ;;; Compatibility:
63 ;;
@@ -102,8 +113,12 @@
113
114 (defvar git-blame-mode nil)
115 (make-variable-buffer-local 'git-blame-mode)
105 -(push (list 'git-blame-mode " blame") minor-mode-alist)
116 +(unless (assq 'git-blame-mode minor-mode-alist)
117 + (setq minor-mode-alist
118 + (cons (list 'git-blame-mode " blame")
119 + minor-mode-alist)))
120
121 +;;;###autoload
122 (defun git-blame-mode (&optional arg)
123 (interactive "P")
124 (if arg