All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] git-blame: Add Emacs Lisp file headers and GNU GPL boilerplate
@ 2007-02-07 12:56 Jakub Narebski
  2007-02-07 12:59 ` [PATCH 2/2] git-blame: Change installation instructions Jakub Narebski
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Narebski @ 2007-02-07 12:56 UTC (permalink / raw)
  To: git; +Cc: David Kågedal

Add Emacs Lisp file headers, according to "Coding Conventions" chapter
in Emacs Lisp Reference Manual and Elisp Area Convetions for
EmacsWiki:
  http://www.emacswiki.org/cgi-bin/wiki/ElispAreaConventions
Those include: copyright notice, GNU GPL boilerplate, description and
instalation instructions as provided in email and in commit message
introducing git-blame.el, compatibility notes from another email by
David Kågedal about what to change to use it in GNU Emacs 20, and
"git-blame ends here" to detect if file was truncated.  First line
includes setting file encoding via first line local variable values
(file variables).

Added comment to "(require 'cl)" to note why it is needed; "Coding
Conventions" advises to avoid require the `cl' package of Common Lisp
extensions at run time.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
---
David Kågedal agreed on GPLv2 or later for git-blame.el
in Message-ID: <87veifzkyg.fsf@morpheus.local>

If you have better idea for git-blame.el description, feel
free to correct it.

 contrib/emacs/git-blame.el |   73 ++++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 70 insertions(+), 3 deletions(-)

diff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el
index 62cf24c..cca0a77 100644
--- a/contrib/emacs/git-blame.el
+++ b/contrib/emacs/git-blame.el
@@ -1,8 +1,73 @@
-;;; git-blame.el
-;; David Kågedal <davidk@lysator.liu.se>
+;;; git-blame.el --- Minor mode for incremental blame for Git  -*- coding: utf-8 -*-
+;;
+;; Copyright (C) 2007  David Kågedal
+;;
+;; Authors:    David Kågedal <davidk@lysator.liu.se>
+;; Created:    31 Jan 2007
 ;; Message-ID: <87iren2vqx.fsf@morpheus.local>
+;; License:    GPL
+;; Keywords:   git, version control, release management
+;;
+;; Compatibility: Emacs21
+
+
+;; This file is *NOT* part of GNU Emacs.
+;; This file is distributed under the same terms as GNU Emacs.
+
+;; This program is free software; you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation; either version 2 of
+;; the License, or (at your option) any later version.
+
+;; This program is distributed in the hope that it will be
+;; useful, but WITHOUT ANY WARRANTY; without even the implied
+;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+;; PURPOSE.  See the GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public
+;; License along with this program; if not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+;; MA 02111-1307 USA
+
+;; http://www.fsf.org/copyleft/gpl.html
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Commentary:
+;;
+;; Here is an Emacs implementation of incremental git-blame.  When you
+;; turn it on while viewing a file, the editor buffer will be updated by
+;; setting the background of individual lines to a color that reflects
+;; which commit it comes from.  And when you move around the buffer, a
+;; one-line summary will be shown in the echo area.
+
+;;; 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
+
+;;; Compatibility:
+;;
+;; It requires GNU Emacs 21.  If you'are using Emacs 20, try
+;; changing this:
+;;
+;;            (overlay-put ovl 'face (list :background
+;;                                         (cdr (assq 'color (cddddr info)))))
+;;
+;; to
+;;
+;;            (overlay-put ovl 'face (cons 'background-color
+;;                                         (cdr (assq 'color (cddddr info)))))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;;
+;;; Code:
+
+(require 'cl)			      ; to use `cddddr', `push', `pop'
 
-(require 'cl)
 (defun color-scale (l)
   (let* ((colors ())
          r g b)
@@ -178,3 +243,5 @@
   (shell-command
    (format "git log -1 --pretty=oneline %s" (or hash
                                                 (git-blame-current-commit)))))
+
+;;; git-blame.el ends here
-- 
1.4.4.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [PATCH 2/2] git-blame: Change installation instructions
  2007-02-07 12:56 [PATCH 1/2] git-blame: Add Emacs Lisp file headers and GNU GPL boilerplate Jakub Narebski
@ 2007-02-07 12:59 ` Jakub Narebski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Narebski @ 2007-02-07 12:59 UTC (permalink / raw)
  To: git; +Cc: David Kågedal

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 |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/contrib/emacs/git-blame.el b/contrib/emacs/git-blame.el
index cca0a77..7beeece 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,9 +113,14 @@
 
 (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)
+  "Minor mode for incremental blame for Git."
   (interactive "P")
   (if arg
       (setq git-blame-mode (eq arg 1))
@@ -244,4 +260,6 @@
    (format "git log -1 --pretty=oneline %s" (or hash
                                                 (git-blame-current-commit)))))
 
+(provide 'git-blame)
+
 ;;; git-blame.el ends here
-- 
1.4.4.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-07 12:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-07 12:56 [PATCH 1/2] git-blame: Add Emacs Lisp file headers and GNU GPL boilerplate Jakub Narebski
2007-02-07 12:59 ` [PATCH 2/2] git-blame: Change installation instructions Jakub Narebski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.