home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 8 / FreshFishVol8-CD1.bin / new / util / edit / jade / lisp / add-log.jl next >
Lisp/Scheme  |  1994-09-18  |  2KB  |  58 lines

  1. ;;;; add-log.jl -- Making ChangeLog files
  2. ;;;  Copyright (C) 1993, 1994 John Harper <jsh@ukc.ac.uk>
  3.  
  4. ;;; This file is part of Jade.
  5.  
  6. ;;; Jade is free software; you can redistribute it and/or modify it
  7. ;;; under the terms of the GNU General Public License as published by
  8. ;;; the Free Software Foundation; either version 2, or (at your option)
  9. ;;; any later version.
  10.  
  11. ;;; Jade is distributed in the hope that it will be useful, but
  12. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ;;; GNU General Public License for more details.
  15.  
  16. ;;; You should have received a copy of the GNU General Public License
  17. ;;; along with Jade; see the file COPYING.  If not, write to
  18. ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  
  20. (defvar change-log-address (concat (user-login-name) ?@ (system-name))
  21.   "Email address for use in change logs")
  22.  
  23. (defvar change-log-name (user-full-name)
  24.   "User's proper name, for change logs")
  25.  
  26. (defvar change-log-file "ChangeLog"
  27.   "File name of change logs")
  28.  
  29. ;;;###autoload
  30. (defun add-change-log-entry (&optional log-file)
  31.   (interactive "FLog file:")
  32.   (setq log-file (expand-file-name (unless log-file "")))
  33.   (when (or (file-directory-p log-file) (equal log-file ""))
  34.     (setq log-file (file-name-concat log-file change-log-file)))
  35.   (let
  36.       ((log-buffer (open-file log-file)))
  37.     (when log-buffer
  38.       (goto-buffer log-buffer)
  39.       (goto-buffer-start)
  40.       (unless (log-in-same-day-p (copy-area (buffer-start)
  41.                         (line-end (buffer-start))))
  42.     (insert (concat (current-time-string) "  "
  43.             change-log-name "  (" change-log-address ")\n\n")))
  44.       (goto-char (pos 0 1))
  45.       (insert "\n\t* \n")
  46.       (goto-char (line-end (pos 0 2)))
  47.       (unless major-mode
  48.     (indented-text-mode)))))
  49.  
  50. (defun log-in-same-day-p (old-header)
  51.   (regexp-match (concat (regexp-quote (substring (current-time-string) 0 11))
  52.             ".*  "
  53.             (regexp-quote change-log-name)
  54.             "  \\("
  55.             (regexp-quote change-log-address)
  56.             "\\)")
  57.         old-header))
  58.