]> 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 ae135b2bfb33fd205a186395b841332b316fe35d..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)
 
@@ -248,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.")
 
@@ -779,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)