]> code.delx.au - gnu-emacs/blobdiff - lisp/add-log.el
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-24
[gnu-emacs] / lisp / add-log.el
index ead1fe679d6ebc7094702f2f9e760661e096ca33..ce98760222d1fef94b7a9668e4c4f0d4ab0d4140 100644 (file)
@@ -126,7 +126,7 @@ this variable."
 
 (defcustom add-log-always-start-new-record nil
   "*If non-nil, `add-change-log-entry' will always start a new record."
-  :version "21.4"
+  :version "22.1"
   :type 'boolean
   :group 'change-log)
 
@@ -230,13 +230,16 @@ Note: The search is conducted only within 10%, at the beginning of the file."
      ;; 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))
@@ -245,7 +248,9 @@ Note: The search is conducted only within 10%, at the beginning of the file."
     ("<\\([^>\n]+\\)>\\(:\\| (\\)" (1 'change-log-function-face))
     ;;
     ;; Acknowledgements.
-    ("\\(^\t\\|  \\)\\(From\\|Patch\\(es\\)? by\\|Report\\(ed by\\| from\\)\\|Suggest\\(ed by\\|ion from\\)\\)"
+    ;; Don't include plain "From" because that is vague;
+    ;; we want to encourage people to say something more specific.
+    ("\\(^\t\\|  \\)\\(Patch\\(es\\)? by\\|Report\\(ed by\\| from\\)\\|Suggest\\(ed by\\|ion from\\)\\)"
      2 'change-log-acknowledgement-face))
   "Additional expressions to highlight in Change Log mode.")
 
@@ -468,20 +473,6 @@ Today's date is calculated according to `change-log-time-zone-rule' if
 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)))
@@ -492,7 +483,19 @@ non-nil, otherwise in local time."
         (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)))
@@ -512,11 +515,11 @@ non-nil, otherwise in local time."
     ;; 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)
@@ -778,9 +781,28 @@ Has a preference of looking backwards."
                   (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)