comparison lisp/add-log.el @ 49308:0e6cefe9e2d0

(add-change-log-entry): Don't leave space at eol. (add-log-current-defun): Perl functions names can't have (or {.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 18 Jan 2003 21:20:10 +0000
parents 35a56f4a18d3
children caadcafadb0c d7ddb3e565de
comparison
equal deleted inserted replaced
49307:77705cf7893d 49308:0e6cefe9e2d0
543 (insert "* ") 543 (insert "* ")
544 (if item (insert item)))) 544 (if item (insert item))))
545 ;; Now insert the function name, if we have one. 545 ;; Now insert the function name, if we have one.
546 ;; Point is at the item for this file, 546 ;; Point is at the item for this file,
547 ;; either at the end of the line or at the first blank line. 547 ;; either at the end of the line or at the first blank line.
548 (if defun 548 (if (not defun)
549 (progn 549 ;; No function name, so put in a colon unless we have just a star.
550 ;; Make it easy to get rid of the function name. 550 (unless (save-excursion
551 (undo-boundary) 551 (beginning-of-line 1)
552 (unless (save-excursion 552 (looking-at "\\s *\\(\\*\\s *\\)?$"))
553 (beginning-of-line 1) 553 (insert ": ")
554 (looking-at "\\s *$")) 554 (if version (insert version ?\ )))
555 (insert ?\ )) 555 ;; Make it easy to get rid of the function name.
556 ;; See if the prev function name has a message yet or not. 556 (undo-boundary)
557 ;; If not, merge the two items.
558 (let ((pos (point-marker)))
559 (if (and (skip-syntax-backward " ")
560 (skip-chars-backward "):")
561 (looking-at "):")
562 (progn (delete-region (+ 1 (point)) (+ 2 (point))) t)
563 (> fill-column (+ (current-column) (length defun) 3)))
564 (progn (delete-region (point) pos)
565 (insert ", "))
566 (goto-char pos)
567 (insert "("))
568 (set-marker pos nil))
569 (insert defun "): ")
570 (if version
571 (insert version ?\ )))
572 ;; No function name, so put in a colon unless we have just a star.
573 (unless (save-excursion 557 (unless (save-excursion
574 (beginning-of-line 1) 558 (beginning-of-line 1)
575 (looking-at "\\s *\\(\\*\\s *\\)?$")) 559 (looking-at "\\s *$"))
576 (insert ": ") 560 (insert ?\ ))
577 (if version (insert version ?\ )))))) 561 ;; See if the prev function name has a message yet or not.
562 ;; If not, merge the two items.
563 (let ((pos (point-marker)))
564 (skip-syntax-backward " ")
565 (skip-chars-backward "):")
566 (if (and (looking-at "):")
567 (> fill-column (+ (current-column) (length defun) 4)))
568 (progn (delete-region (point) pos) (insert ", "))
569 (if (looking-at "):")
570 (delete-region (+ 1 (point)) (line-end-position)))
571 (goto-char pos)
572 (insert "("))
573 (set-marker pos nil))
574 (insert defun "): ")
575 (if version (insert version ?\ )))))
578 576
579 ;;;###autoload 577 ;;;###autoload
580 (defun add-change-log-entry-other-window (&optional whoami file-name) 578 (defun add-change-log-entry-other-window (&optional whoami file-name)
581 "Find change log file in other window and add entry and item. 579 "Find change log file in other window and add entry and item.
582 This is just like `add-change-log-entry' except that it displays 580 This is just like `add-change-log-entry' except that it displays
827 (line-end-position))))) 825 (line-end-position)))))
828 ((eq major-mode 'texinfo-mode) 826 ((eq major-mode 'texinfo-mode)
829 (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t) 827 (if (re-search-backward "^@node[ \t]+\\([^,\n]+\\)" nil t)
830 (match-string-no-properties 1))) 828 (match-string-no-properties 1)))
831 ((memq major-mode '(perl-mode cperl-mode)) 829 ((memq major-mode '(perl-mode cperl-mode))
832 (if (re-search-backward "^sub[ \t]+\\([^ \t\n]+\\)" nil t) 830 (if (re-search-backward "^sub[ \t]+\\([^({ \t\n]+\\)" nil t)
833 (match-string-no-properties 1))) 831 (match-string-no-properties 1)))
834 ;; Emacs's autoconf-mode installs its own 832 ;; Emacs's autoconf-mode installs its own
835 ;; `add-log-current-defun-function'. This applies to 833 ;; `add-log-current-defun-function'. This applies to
836 ;; a different mode apparently for editing .m4 834 ;; a different mode apparently for editing .m4
837 ;; autoconf source. 835 ;; autoconf source.