changeset 12551:572a8ef6b1f4

(add-log-current-defun): Handle C struct definitions. (add-change-log-entry): Use case-sensitive search for file name. Find first blank line correctly.
author Karl Heuer <kwzh@gnu.org>
date Mon, 17 Jul 1995 22:44:40 +0000
parents c33dd1c62d72
children 176c42cc7eeb
files lisp/add-log.el
diffstat 1 files changed, 47 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/add-log.el	Mon Jul 17 22:44:06 1995 +0000
+++ b/lisp/add-log.el	Mon Jul 17 22:44:40 1995 +0000
@@ -208,15 +208,17 @@
 	   (if entry
 	       (insert entry)))
 	  ((and (not new-entry)
-		(re-search-forward
-		 (concat (regexp-quote (concat "* " entry))
-			 ;; Don't accept `foo.bar' when
-			 ;; looking for `foo':
-			 "\\(\\s \\|[(),:]\\)")
-		 paragraph-end t))
+		(let (case-fold-search)
+		  (re-search-forward
+		   (concat (regexp-quote (concat "* " entry))
+			   ;; Don't accept `foo.bar' when
+			   ;; looking for `foo':
+			   "\\(\\s \\|[(),:]\\)")
+		   paragraph-end t)))
 	   ;; Add to the existing entry for the same file.
 	   (re-search-forward "^\\s *$\\|^\\s \\*")
-	   (beginning-of-line)
+	   (goto-char (match-beginning 0))
+	   ;; Delete excess empty lines; make just 2.
 	   (while (and (not (eobp)) (looking-at "^\\s *$"))
 	     (delete-region (point) (save-excursion (forward-line 1) (point))))
 	   (insert "\n\n")
@@ -405,34 +407,47 @@
                                (get-method-definition)
                              ;; Ordinary C function syntax.
                              (setq beg (point))
-                             (if (condition-case nil
-                                     ;; Protect against "Unbalanced parens" error.
-                                     (progn
-                                       (down-list 1) ; into arglist
-                                       (backward-up-list 1)
-                                       (skip-chars-backward " \t")
-                                       t)
-                                   (error nil))
-                                 ;; Verify initial pos was after
-                                 ;; real start of function.
-                                 (if (and (save-excursion
-                                            (goto-char beg)
-                                            ;; For this purpose, include the line
-                                            ;; that has the decl keywords.  This
-                                            ;; may also include some of the
-                                            ;; comments before the function.
-                                            (while (and (not (bobp))
-                                                        (save-excursion
-                                                          (forward-line -1)
-                                                          (looking-at "[^\n\f]")))
-                                              (forward-line -1))
-                                            (>= location (point)))
+                             (if (and (condition-case nil
+					  ;; Protect against "Unbalanced parens" error.
+					  (progn
+					    (down-list 1) ; into arglist
+					    (backward-up-list 1)
+					    (skip-chars-backward " \t")
+					    t)
+					(error nil))
+				      ;; Verify initial pos was after
+				      ;; real start of function.
+				      (save-excursion
+					(goto-char beg)
+					;; For this purpose, include the line
+					;; that has the decl keywords.  This
+					;; may also include some of the
+					;; comments before the function.
+					(while (and (not (bobp))
+						    (save-excursion
+						      (forward-line -1)
+						      (looking-at "[^\n\f]")))
+					  (forward-line -1))
+					(>= location (point)))
                                           ;; Consistency check: going down and up
                                           ;; shouldn't take us back before BEG.
                                           (> (point) beg))
-                                     (buffer-substring (point)
-                                                       (progn (backward-sexp 1)
-                                                              (point)))))))))))
+				 (let (end middle)
+				   ;; Don't include any final newline
+				   ;; in the name we use.
+				   (if (= (preceding-char) ?\n)
+				       (forward-char -1))
+				   (setq end (point))
+				   (backward-sexp 1)
+				   ;; Now find the right beginning of the name.
+				   ;; Include certain keywords if they
+				   ;; precede the name.
+				   (setq middle (point))
+				   (forward-word -1)
+				   (and (bolp)
+					(looking-at "struct \\|union \\|class ")
+					(setq middle (point)))
+				   (buffer-substring middle end)))))))))
 		((memq major-mode
 		       '(TeX-mode plain-TeX-mode LaTeX-mode;; tex-mode.el
 				  plain-tex-mode latex-mode;; cmutex.el