[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] svn-dev.el: automatic updating of Collab copyright years

From: Kamesh Jayachandran <kamesh_at_collab.net>
Date: 2006-11-17 08:25:09 CET

I never used emacs and elisp either.
I just added the following to ~/.emacs
(load-file "/home/kamesh/work/svn/pure_trunk/tools/dev/svn-dev.el")
(add-hook 'before-save-hook 'svn-update-copyright)

Could not see the copyright updated upon save and exit(I used the emacs
gui button and menuitem to save and exit).

Do I miss anything?

With regards
Kamesh Jayachandran

Erik Huelsmann wrote:
> As Kamesh pointed out, I forgot to update several copyright years in
> some files.
>
> Since I use emacs, I thought I'd extend svn-dev.el with a function to
> do it automatically.
>
> Add (add-hook 'before-save-hook 'svn-update-copyright) to your .emacs
> and apply this patch to your svn-dev.el and all should be automatic!
>
> bye,
>
> Erik.
>
> Index: ../trunk/tools/dev/svn-dev.el
> ===================================================================
> --- ../trunk/tools/dev/svn-dev.el (revision 22313)
> +++ ../trunk/tools/dev/svn-dev.el (working copy)
> @@ -6,6 +6,21 @@
> ;;
> ;; All this stuff should get folded into Emacs VC mode, really.
>
> +(defun svn-update-copyright ()
> + "Update the copyright at the top of the file."
> + (interactive)
> + (save-excursion
> + (goto-char (point-min))
> + (let ((start (point)))
> + (search-forward "*/")
> + (save-restriction
> + (narrow-to-region start (point))
> + (goto-char (point-min))
> + (replace-regexp "Copyright (c) \\([0-9]+\\)\\(-[0-9]+\\)?
> CollabNet"
> + (format "Copyright (c) \\1-%s CollabNet"
> + (format-time-string "%Y"
> (current-time))))))))
> +
> +
> (defun svn-revert ()
> "Revert the current buffer and its file to its svn base revision."
> (interactive)
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Nov 17 08:25:33 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.