comparison lisp/add-log.el @ 4741:c0ea0009268a

add-log-full-name, add-log-mailing-address: new varialbes
author Brian Fox <bfox@gnu.org>
date Sun, 19 Sep 1993 01:54:48 +0000
parents 0c7aefc58e0f
children 61c4250fb760
comparison
equal deleted inserted replaced
4740:f82d7536df7c 4741:c0ea0009268a
34 (defvar add-log-current-defun-function nil 34 (defvar add-log-current-defun-function nil
35 "\ 35 "\
36 *If non-nil, function to guess name of current function from surrounding text. 36 *If non-nil, function to guess name of current function from surrounding text.
37 \\[add-change-log-entry] calls this function (if nil, `add-log-current-defun' 37 \\[add-change-log-entry] calls this function (if nil, `add-log-current-defun'
38 instead) with no arguments. It returns a string or nil if it cannot guess.") 38 instead) with no arguments. It returns a string or nil if it cannot guess.")
39
40 ;;;###autoload
41 (defvar add-log-full-name (user-full-name)
42 "*Full name of user, for inclusion in ChangeLog daily headers.
43 This defaults to the value returned by the `user-full-name' function.")
44
45 ;;;###autoload
46 (defvar add-log-mailing-address (concat (user-login-name) "@" (system-name))
47 "*Electronic mail address of user, for inclusion in ChangeLog daily headers.
48 This defaults to the value returned by `user-login-name', followed by
49 an `@' character, followed by the value returned by `system-name'.")
39 50
40 (defun change-log-name () 51 (defun change-log-name ()
41 (or change-log-default-name 52 (or change-log-default-name
42 (if (eq system-type 'vax-vms) "$CHANGE_LOG$.TXT" "ChangeLog"))) 53 (if (eq system-type 'vax-vms) "$CHANGE_LOG$.TXT" "ChangeLog")))
43 54
108 Third arg OTHER-WINDOW non-nil means visit in other window. 119 Third arg OTHER-WINDOW non-nil means visit in other window.
109 Fourth arg NEW-ENTRY non-nil means always create a new entry at the front; 120 Fourth arg NEW-ENTRY non-nil means always create a new entry at the front;
110 never append to an existing entry." 121 never append to an existing entry."
111 (interactive (list current-prefix-arg 122 (interactive (list current-prefix-arg
112 (prompt-for-change-log-name))) 123 (prompt-for-change-log-name)))
113 (let* ((full-name (if whoami 124 (if whoami
114 (read-input "Full name: " (user-full-name)) 125 (progn
115 (user-full-name))) 126 (setq add-log-full-name (read-input "Full name: " add-log-full-name))
116 ;; Note that some sites have room and phone number fields in 127 ;; Note that some sites have room and phone number fields in
117 ;; full name which look silly when inserted. Rather than do 128 ;; full name which look silly when inserted. Rather than do
118 ;; anything about that here, let user give prefix argument so that 129 ;; anything about that here, let user give prefix argument so that
119 ;; s/he can edit the full name field in prompter if s/he wants. 130 ;; s/he can edit the full name field in prompter if s/he wants.
120 (login-name (if whoami 131 (setq add-log-mailing-address
121 (read-input "Login name: " (user-login-name)) 132 (read-input "Mailing address: " add-log-mailing-address))))
122 (user-login-name))) 133 (let ((defun (funcall (or add-log-current-defun-function
123 (site-name (if whoami 134 'add-log-current-defun)))
124 (read-input "Site name: " (system-name)) 135 paragraph-end entry)
125 (system-name)))
126 (defun (funcall (or add-log-current-defun-function
127 'add-log-current-defun)))
128 paragraph-end entry)
129 136
130 (setq file-name (find-change-log file-name)) 137 (setq file-name (find-change-log file-name))
131 138
132 ;; Set ENTRY to the file name to use in the new entry. 139 ;; Set ENTRY to the file name to use in the new entry.
133 (and buffer-file-name 140 (and buffer-file-name
145 (find-file file-name)) 152 (find-file file-name))
146 (undo-boundary) 153 (undo-boundary)
147 (goto-char (point-min)) 154 (goto-char (point-min))
148 (if (looking-at (concat (regexp-quote (substring (current-time-string) 155 (if (looking-at (concat (regexp-quote (substring (current-time-string)
149 0 10)) 156 0 10))
150 ".* " (regexp-quote full-name) 157 ".* " (regexp-quote add-log-full-name)
151 " (" (regexp-quote login-name) "@")) 158 " (" (regexp-quote add-log-mailing-address)))
152 (forward-line 1) 159 (forward-line 1)
153 (insert (current-time-string) 160 (insert (current-time-string)
154 " " full-name 161 " " add-log-full-name
155 " (" login-name "@" site-name ")\n\n")) 162 " (" add-log-mailing-address ")\n\n"))
156 163
157 ;; Search only within the first paragraph. 164 ;; Search only within the first paragraph.
158 (if (looking-at "\n*[^\n* \t]") 165 (if (looking-at "\n*[^\n* \t]")
159 (skip-chars-forward "\n") 166 (skip-chars-forward "\n")
160 (forward-paragraph 1)) 167 (forward-paragraph 1))