Annotation of GNUtools/emacs/lisp/add-log.el, revision 1.1

1.1     ! root        1: ;; Change log maintenance commands for Emacs
        !             2: ;; Copyright (C) 1985 Free Software Foundation, Inc.
        !             3: 
        !             4: ;; This file is part of GNU Emacs.
        !             5: 
        !             6: ;; GNU Emacs is free software; you can redistribute it and/or modify
        !             7: ;; it under the terms of the GNU General Public License as published by
        !             8: ;; the Free Software Foundation; either version 1, or (at your option)
        !             9: ;; any later version.
        !            10: 
        !            11: ;; GNU Emacs is distributed in the hope that it will be useful,
        !            12: ;; but 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 GNU Emacs; see the file COPYING.  If not, write to
        !            18: ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
        !            19: 
        !            20: 
        !            21: (defun add-change-log-entry (whoami file-name &optional other-window)
        !            22:   "Find change log file and add an entry for today.
        !            23: First arg (interactive prefix) non-nil means prompt for user name and site.
        !            24: Second arg is file name of change log.
        !            25: Optional third arg OTHER-WINDOW non-nil means visit in other window."
        !            26:   (interactive
        !            27:    (list current-prefix-arg
        !            28:         (let ((default
        !            29:                 (if (eq system-type 'vax-vms) "$CHANGE_LOG$.TXT" "ChangeLog")))
        !            30:           (expand-file-name
        !            31:            (read-file-name (format "Log file (default %s): " default)
        !            32:                            nil default)))))
        !            33:   (let* ((default
        !            34:           (if (eq system-type 'vax-vms) "$CHANGE_LOG$.TXT" "ChangeLog"))
        !            35:         (full-name (if whoami
        !            36:                        (read-input "Full name: " (user-full-name))
        !            37:                      (user-full-name)))
        !            38:         ;; Note that some sites have room and phone number fields in
        !            39:         ;; full name which look silly when inserted.  Rather than do
        !            40:         ;; anything about that here, let user give prefix argument so that
        !            41:         ;; s/he can edit the full name field in prompter if s/he wants.
        !            42:         (login-name (if whoami
        !            43:                         (read-input "Login name: " (user-login-name))
        !            44:                       (user-login-name)))
        !            45:         (site-name (if whoami
        !            46:                        (read-input "Site name: " (system-name))
        !            47:                      (system-name))))
        !            48:     (if (file-directory-p file-name)
        !            49:        (setq file-name (concat (file-name-as-directory file-name)
        !            50:                                default)))
        !            51:     (if other-window (find-file-other-window file-name) (find-file file-name))
        !            52:     (or (eq major-mode 'indented-text-mode)
        !            53:        (progn
        !            54:          (indented-text-mode)
        !            55:          (setq left-margin 8)
        !            56:          (setq fill-column 74)))
        !            57:     (auto-fill-mode 1)
        !            58:     (undo-boundary)
        !            59:     (goto-char (point-min))
        !            60:     (if (not (and (looking-at (substring (current-time-string) 0 10))
        !            61:                  (save-excursion (re-search-forward "(.*@"
        !            62:                                                     (save-excursion
        !            63:                                                       (end-of-line) (point))
        !            64:                                                     t)
        !            65:                                  (skip-chars-backward "^(")
        !            66:                                  (looking-at login-name))))
        !            67:        (progn (insert (current-time-string)
        !            68:                       "  " full-name
        !            69:                       "  (" login-name
        !            70:                       "@" site-name ")\n\n")))
        !            71:     (goto-char (point-min))
        !            72:     (forward-line 1)
        !            73:     (while (looking-at "\\sW")
        !            74:       (forward-line 1))
        !            75:     (delete-region (point)
        !            76:                   (progn
        !            77:                     (skip-chars-backward "\n")
        !            78:                     (point)))
        !            79:     (open-line 3)
        !            80:     (forward-line 2)
        !            81:     (indent-to left-margin)
        !            82:     (insert "* ")))
        !            83: 
        !            84: (defun add-change-log-entry-other-window ()
        !            85:   "Find change log file in other window, and add an entry for today."
        !            86:   (interactive)
        !            87:   (add-change-log-entry nil default-directory t))

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.