;;; add-log.el --- change log maintenance commands for Emacs
-;; Copyright (C) 1985, 86, 88, 93, 94, 97, 98, 2000, 2003
+;; Copyright (C) 1985, 86, 88, 93, 94, 97, 98, 2000, 03, 2004
;; Free Software Foundation, Inc.
;; Maintainer: FSF
;; Possibly further names in a list:
("\\=, \\([^ ,:([\n]+\\)" nil nil (1 'change-log-file-face))
;; Possibly a parenthesized list of names:
- ("\\= (\\([^) ,:\n]+\\)" nil nil (1 'change-log-list-face))
- ("\\=, *\\([^) ,:\n]+\\)" nil nil (1 'change-log-list-face)))
+ ("\\= (\\([^() ,\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)"
+ nil nil (1 'change-log-list-face))
+ ("\\=, *\\([^() ,\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)"
+ nil nil (1 'change-log-list-face)))
;;
;; Function or variable names.
- ("^\t(\\([^) ,:\n]+\\)"
+ ("^\t(\\([^() ,\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)"
(1 'change-log-list-face)
- ("\\=, *\\([^) ,:\n]+\\)" nil nil (1 'change-log-list-face)))
+ ("\\=, *\\([^() ,\n]+\\|(\\(setf\\|SETF\\) [^() ,\n]+)\\)" nil nil
+ (1 'change-log-list-face)))
;;
;; Conditionals.
("\\[!?\\([^]\n]+\\)\\]\\(:\\| (\\)" (1 'change-log-conditionals-face))
(defun add-change-log-entry (&optional whoami file-name other-window new-entry)
"Find change log file, and add an entry for today and an item for this file.
Optional arg WHOAMI (interactive prefix) non-nil means prompt for user
-name and site.
+name and email (stored in `add-log-full-name' and `add-log-mailing-address').
Second arg FILE-NAME is file name of the change log.
If nil, use the value of `change-log-default-name'.
non-nil, otherwise in local time."
(interactive (list current-prefix-arg
(prompt-for-change-log-name)))
- (or add-log-full-name
- (setq add-log-full-name (user-full-name)))
- (or add-log-mailing-address
- (setq add-log-mailing-address user-mail-address))
- (if whoami
- (progn
- (setq add-log-full-name (read-input "Full name: " add-log-full-name))
- ;; Note that some sites have room and phone number fields in
- ;; full name which look silly when inserted. Rather than do
- ;; anything about that here, let user give prefix argument so that
- ;; s/he can edit the full name field in prompter if s/he wants.
- (setq add-log-mailing-address
- (read-input "Mailing address: " add-log-mailing-address))))
-
(let* ((defun (add-log-current-defun))
(version (and change-log-version-info-enabled
(change-log-version-number-search)))
(funcall add-log-buffer-file-name-function)
buffer-file-name))
(buffer-file (if buf-file-name (expand-file-name buf-file-name)))
- (file-name (expand-file-name
- (or file-name (find-change-log file-name buffer-file))))
+ (file-name (expand-file-name (find-change-log file-name buffer-file)))
;; Set ITEM to the file name to use in the new item.
(item (add-log-file-name buffer-file file-name))
- bound)
+ bound
+ (full-name (or add-log-full-name (user-full-name)))
+ (mailing-address (or add-log-mailing-address user-mail-address)))
+
+ (if whoami
+ (progn
+ (setq full-name (read-input "Full name: " full-name))
+ ;; Note that some sites have room and phone number fields in
+ ;; full name which look silly when inserted. Rather than do
+ ;; anything about that here, let user give prefix argument so that
+ ;; s/he can edit the full name field in prompter if s/he wants.
+ (setq mailing-address
+ (read-input "Mailing address: " mailing-address))))
(unless (equal file-name buffer-file-name)
(if (or other-window (window-dedicated-p (selected-window)))
;; Advance into first entry if it is usable; else make new one.
(let ((new-entries (mapcar (lambda (addr)
(concat (funcall add-log-time-format)
- " " add-log-full-name
+ " " full-name
" <" addr ">"))
- (if (consp add-log-mailing-address)
- add-log-mailing-address
- (list add-log-mailing-address)))))
+ (if (consp mailing-address)
+ mailing-address
+ (list mailing-address)))))
(if (and (not add-log-always-start-new-record)
(let ((hit nil))
(dolist (entry new-entries hit)
(forward-line 1))
(or (eobp)
(forward-char 1))
- (beginning-of-defun)
- (when (progn (end-of-defun)
- (< location (point)))
+ (let (maybe-beg)
+ ;; Try to find the containing defun.
+ (beginning-of-defun)
+ (end-of-defun)
+ ;; If the defun we found ends before the desired position,
+ ;; see if there's a DEFUN construct
+ ;; between that end and the desired position.
+ (when (save-excursion
+ (and (> location (point))
+ (re-search-forward "^DEFUN"
+ (save-excursion
+ (goto-char location)
+ (line-end-position))
+ t)
+ (re-search-forward "^{" nil t)
+ (setq maybe-beg (point))))
+ ;; If so, go to the end of that instead.
+ (goto-char maybe-beg)
+ (end-of-defun)))
+ ;; If the desired position is within the defun we found,
+ ;; find the function name.
+ (when (< location (point))
(backward-sexp 1)
(let (beg tem)