|
|
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 distributed in the hope that it will be useful,
7: ;; but WITHOUT ANY WARRANTY. No author or distributor
8: ;; accepts responsibility to anyone for the consequences of using it
9: ;; or for whether it serves any particular purpose or works at all,
10: ;; unless he says so in writing. Refer to the GNU Emacs General Public
11: ;; License for full details.
12:
13: ;; Everyone is granted permission to copy, modify and redistribute
14: ;; GNU Emacs, but only under the conditions described in the
15: ;; GNU Emacs General Public License. A copy of this license is
16: ;; supposed to have been given to you along with GNU Emacs so you
17: ;; can know your rights and responsibilities. It should be in a
18: ;; file named COPYING. Among other things, the copyright notice
19: ;; and this notice must be preserved on all copies.
20:
21:
22: (defun add-change-log-entry (whoami file-name &optional other-window)
23: "Find change log file and add an entry for today.
24: First arg (interactive prefix) non-nil means prompt for user name and site.
25: Second arg is file name of change log.
26: Optional third arg OTHER-WINDOW non-nil means visit in other window."
27: (interactive
28: (list current-prefix-arg
29: (let ((default
30: (if (eq system-type 'vax-vms) "$CHANGE_LOG$.TXT" "ChangeLog")))
31: (expand-file-name
32: (read-file-name (format "Log file (default %s): " default)
33: nil default)))))
34: (let* ((default
35: (if (eq system-type 'vax-vms) "$CHANGE_LOG$.TXT" "ChangeLog"))
36: (full-name (if whoami
37: (read-input "Full name: " (user-full-name))
38: (user-full-name)))
39: ;; Note that some sites have room and phone number fields in
40: ;; full name which look silly when inserted. Rather than do
41: ;; anything about that here, let user give prefix argument so that
42: ;; s/he can edit the full name field in prompter if s/he wants.
43: (login-name (if whoami
44: (read-input "Login name: " (user-login-name))
45: (user-login-name)))
46: (site-name (if whoami
47: (read-input "Site name: " (system-name))
48: (system-name))))
49: (if (file-directory-p file-name)
50: (setq file-name (concat (file-name-as-directory file-name)
51: default)))
52: (if other-window (find-file-other-window file-name) (find-file file-name))
53: (or (eq major-mode 'indented-text-mode)
54: (progn
55: (indented-text-mode)
56: (setq left-margin 8)
57: (setq fill-column 74)))
58: (auto-fill-mode 1)
59: (undo-boundary)
60: (goto-char (point-min))
61: (if (not (and (looking-at (substring (current-time-string) 0 10))
62: (save-excursion (re-search-forward "(.* at")
63: (skip-chars-backward "^(")
64: (looking-at login-name))))
65: (progn (insert (current-time-string)
66: " " full-name
67: " (" login-name
68: " at " site-name ")\n\n")))
69: (goto-char (point-min))
70: (forward-line 1)
71: (while (looking-at "\\sW")
72: (forward-line 1))
73: (delete-region (point)
74: (progn
75: (skip-chars-backward "\n")
76: (point)))
77: (open-line 3)
78: (forward-line 2)
79: (indent-to left-margin)
80: (insert "* ")))
81:
82: (defun add-change-log-entry-other-window ()
83: "Find change log file in other window, and add an entry for today."
84: (interactive)
85: (add-change-log-entry nil default-directory t))
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.