aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1995-07-17 22:44:40 +0000
committerKarl Heuer1995-07-17 22:44:40 +0000
commite172f5463f737d5f570b8ea99553eed8e08cb900 (patch)
tree125af6bfeebfaab9a05f2f826625ca8b351c1319
parent97e6527f20d9caf7c48f4747d9bd88e7ff3f2684 (diff)
downloademacs-e172f5463f737d5f570b8ea99553eed8e08cb900.tar.gz
emacs-e172f5463f737d5f570b8ea99553eed8e08cb900.zip
(add-log-current-defun): Handle C struct definitions.
(add-change-log-entry): Use case-sensitive search for file name. Find first blank line correctly.
-rw-r--r--lisp/add-log.el79
1 files changed, 47 insertions, 32 deletions
diff --git a/lisp/add-log.el b/lisp/add-log.el
index 327aaf2eb9f..f380875649c 100644
--- a/lisp/add-log.el
+++ b/lisp/add-log.el
@@ -208,15 +208,17 @@ never append to an existing 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")
@@ -405,34 +407,47 @@ Has a preference of looking backwards."
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