home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 4 / FreshFish_May-June1994.bin / bbs / may94 / util / edit / jade.lha / Jade / lisp / add-log.jl next >
Lisp/Scheme  |  1994-04-16  |  2KB  |  37 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. (defun add-change-log-entry (&optional log-file &aux log-buffer)
  21.   (unless log-file
  22.     (if (setq log-file (prompt "Log file: " (path-name (file-name))))
  23.     (when (file-directory-p log-file)
  24.       (setq log-file (file-concat log-file "ChangeLog")))
  25.       (return)))
  26.   (when (setq log-buffer (open-file log-file))
  27.     (goto-buffer log-buffer)
  28.     (goto (pos 1 1))
  29.     (unless (log-in-same-day-p (copy-area (pos 1 1) (line-end (pos 1 1))))
  30.       (insert (concat (current-time-string) "  " (user-full-name) "  (" (user-login-name) ?@ (system-name) ")\n\n")))
  31.     (goto (pos 1 2))
  32.     (insert "\n\t* \n")
  33.     (goto (line-end (pos 1 3)))))
  34.  
  35. (defun log-in-same-day-p (old-header)
  36.   (regexp-match (concat (substr (current-time-string) 0 11) ".*  " (user-full-name) "  \\(" (user-login-name) ?@ (system-name) "\\)") old-header))
  37.