public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: "David Kågedal" <davidk@lysator•liu.se>
To: git@vger•kernel.org
Subject: [PATCH 2/7] git-blame: Change installation instructions
Date: Fri, 09 Feb 2007 09:19:59 +0100	[thread overview]
Message-ID: <87zm7npwsw.fsf@morpheus.local> (raw)

From: Jakub Narebski <jnareb@gmail•com>

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>
---
 contrib/emacs/git-blame.el |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el
index ba9d8a6..56a548b 100644
--- a/contrib/emacs/git-blame.el
+++ b/contrib/emacs/git-blame.el
@@ -44,9 +44,20 @@
 
 ;;; Installation:
 ;;
-;;  1) Load into emacs: M-x load-file RET git-blame.el RET
-;;  2) Open a git-controlled file
-;;  3) Blame: M-x git-blame-mode
+;; To use this package, put it somewhere in `load-path' (or add
+;; directory with git-blame.el to `load-path'), and add the following
+;; line to your .emacs:
+;;
+;;    (require 'git-blame)
+;;
+;; If you do not want to load this package before it is necessary, you
+;; can make use of the `autoload' feature, e.g. by adding to your .emacs
+;; the following lines
+;;
+;;    (autoload 'git-blame-mode "git-blame"
+;;              "Minor mode for incremental blame for Git." t)
+;;
+;; Then first use of `M-x git-blame-mode' would load the package.
 
 ;;; Compatibility:
 ;;
@@ -102,8 +113,12 @@
 
 (defvar git-blame-mode nil)
 (make-variable-buffer-local 'git-blame-mode)
-(push (list 'git-blame-mode " blame") minor-mode-alist)
+(unless (assq 'git-blame-mode minor-mode-alist)
+  (setq minor-mode-alist
+	(cons (list 'git-blame-mode " blame")
+	      minor-mode-alist)))
 
+;;;###autoload
 (defun git-blame-mode (&optional arg)
   (interactive "P")
   (if arg
-- 
1.5.0.rc3.204.g93c76


-- 
David Kågedal

                 reply	other threads:[~2007-02-09  8:40 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zm7npwsw.fsf@morpheus.local \
    --to=davidk@lysator$(echo .)liu.se \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox