comparison lisp/add-log.el @ 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 f4a8265756e7
children 1bc6075184d7
comparison
equal deleted inserted replaced
12550:c33dd1c62d72 12551:572a8ef6b1f4
206 (cond ((re-search-forward "^\\s *\\*\\s *$" paragraph-end t) 206 (cond ((re-search-forward "^\\s *\\*\\s *$" paragraph-end t)
207 ;; Put this file name into the existing empty entry. 207 ;; Put this file name into the existing empty entry.
208 (if entry 208 (if entry
209 (insert entry))) 209 (insert entry)))
210 ((and (not new-entry) 210 ((and (not new-entry)
211 (re-search-forward 211 (let (case-fold-search)
212 (concat (regexp-quote (concat "* " entry)) 212 (re-search-forward
213 ;; Don't accept `foo.bar' when 213 (concat (regexp-quote (concat "* " entry))
214 ;; looking for `foo': 214 ;; Don't accept `foo.bar' when
215 "\\(\\s \\|[(),:]\\)") 215 ;; looking for `foo':
216 paragraph-end t)) 216 "\\(\\s \\|[(),:]\\)")
217 paragraph-end t)))
217 ;; Add to the existing entry for the same file. 218 ;; Add to the existing entry for the same file.
218 (re-search-forward "^\\s *$\\|^\\s \\*") 219 (re-search-forward "^\\s *$\\|^\\s \\*")
219 (beginning-of-line) 220 (goto-char (match-beginning 0))
221 ;; Delete excess empty lines; make just 2.
220 (while (and (not (eobp)) (looking-at "^\\s *$")) 222 (while (and (not (eobp)) (looking-at "^\\s *$"))
221 (delete-region (point) (save-excursion (forward-line 1) (point)))) 223 (delete-region (point) (save-excursion (forward-line 1) (point))))
222 (insert "\n\n") 224 (insert "\n\n")
223 (forward-line -2) 225 (forward-line -2)
224 (indent-relative-maybe)) 226 (indent-relative-maybe))
403 (progn (forward-sexp 1) (point)))) 405 (progn (forward-sexp 1) (point))))
404 (if (looking-at "^[+-]") 406 (if (looking-at "^[+-]")
405 (get-method-definition) 407 (get-method-definition)
406 ;; Ordinary C function syntax. 408 ;; Ordinary C function syntax.
407 (setq beg (point)) 409 (setq beg (point))
408 (if (condition-case nil 410 (if (and (condition-case nil
409 ;; Protect against "Unbalanced parens" error. 411 ;; Protect against "Unbalanced parens" error.
410 (progn 412 (progn
411 (down-list 1) ; into arglist 413 (down-list 1) ; into arglist
412 (backward-up-list 1) 414 (backward-up-list 1)
413 (skip-chars-backward " \t") 415 (skip-chars-backward " \t")
414 t) 416 t)
415 (error nil)) 417 (error nil))
416 ;; Verify initial pos was after 418 ;; Verify initial pos was after
417 ;; real start of function. 419 ;; real start of function.
418 (if (and (save-excursion 420 (save-excursion
419 (goto-char beg) 421 (goto-char beg)
420 ;; For this purpose, include the line 422 ;; For this purpose, include the line
421 ;; that has the decl keywords. This 423 ;; that has the decl keywords. This
422 ;; may also include some of the 424 ;; may also include some of the
423 ;; comments before the function. 425 ;; comments before the function.
424 (while (and (not (bobp)) 426 (while (and (not (bobp))
425 (save-excursion 427 (save-excursion
426 (forward-line -1) 428 (forward-line -1)
427 (looking-at "[^\n\f]"))) 429 (looking-at "[^\n\f]")))
428 (forward-line -1)) 430 (forward-line -1))
429 (>= location (point))) 431 (>= location (point)))
430 ;; Consistency check: going down and up 432 ;; Consistency check: going down and up
431 ;; shouldn't take us back before BEG. 433 ;; shouldn't take us back before BEG.
432 (> (point) beg)) 434 (> (point) beg))
433 (buffer-substring (point) 435 (let (end middle)
434 (progn (backward-sexp 1) 436 ;; Don't include any final newline
435 (point))))))))))) 437 ;; in the name we use.
438 (if (= (preceding-char) ?\n)
439 (forward-char -1))
440 (setq end (point))
441 (backward-sexp 1)
442 ;; Now find the right beginning of the name.
443 ;; Include certain keywords if they
444 ;; precede the name.
445 (setq middle (point))
446 (forward-word -1)
447 (and (bolp)
448 (looking-at "struct \\|union \\|class ")
449 (setq middle (point)))
450 (buffer-substring middle end)))))))))
436 ((memq major-mode 451 ((memq major-mode
437 '(TeX-mode plain-TeX-mode LaTeX-mode;; tex-mode.el 452 '(TeX-mode plain-TeX-mode LaTeX-mode;; tex-mode.el
438 plain-tex-mode latex-mode;; cmutex.el 453 plain-tex-mode latex-mode;; cmutex.el
439 )) 454 ))
440 (if (re-search-backward 455 (if (re-search-backward