comparison lisp/log-edit.el @ 89909:68c22ea6027c

Sync to HEAD
author Kenichi Handa <handa@m17n.org>
date Fri, 16 Apr 2004 12:51:06 +0000
parents 375f2633d815
children d8411455de48
comparison
equal deleted inserted replaced
89908:ee1402f7b568 89909:68c22ea6027c
1 ;;; log-edit.el --- Major mode for editing CVS commit messages 1 ;;; log-edit.el --- Major mode for editing CVS commit messages
2 2
3 ;; Copyright (C) 1999,2000,2003 Free Software Foundation, Inc. 3 ;; Copyright (C) 1999,2000,2003,2004 Free Software Foundation, Inc.
4 4
5 ;; Author: Stefan Monnier <monnier@cs.yale.edu> 5 ;; Author: Stefan Monnier <monnier@cs.yale.edu>
6 ;; Keywords: pcl-cvs cvs commit log 6 ;; Keywords: pcl-cvs cvs commit log
7 7
8 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
297 297
298 ;;; 298 ;;;
299 ;;; Actual code 299 ;;; Actual code
300 ;;; 300 ;;;
301 301
302 (defvar log-edit-font-lock-keywords
303 '(("\\`\\(Summary:\\)\\(.*\\)"
304 (1 font-lock-keyword-face)
305 (2 font-lock-function-name-face))))
306
302 ;;;###autoload 307 ;;;###autoload
303 (defun log-edit (callback &optional setup listfun buffer &rest ignore) 308 (defun log-edit (callback &optional setup listfun buffer &rest ignore)
304 "Setup a buffer to enter a log message. 309 "Setup a buffer to enter a log message.
305 \\<log-edit-mode-map>The buffer will be put in `log-edit-mode'. 310 \\<log-edit-mode-map>The buffer will be put in `log-edit-mode'.
306 If SETUP is non-nil, the buffer is then erased and `log-edit-hook' is run. 311 If SETUP is non-nil, the buffer is then erased and `log-edit-hook' is run.
335 Several other handy support commands are provided of course and 340 Several other handy support commands are provided of course and
336 the package from which this is used might also provide additional 341 the package from which this is used might also provide additional
337 commands (under C-x v for VC, for example). 342 commands (under C-x v for VC, for example).
338 343
339 \\{log-edit-mode-map}" 344 \\{log-edit-mode-map}"
345 (set (make-local-variable 'font-lock-defaults)
346 '(log-edit-font-lock-keywords t))
340 (make-local-variable 'log-edit-comment-ring-index)) 347 (make-local-variable 'log-edit-comment-ring-index))
341 348
342 (defun log-edit-hide-buf (&optional buf where) 349 (defun log-edit-hide-buf (&optional buf where)
343 (when (setq buf (get-buffer (or buf log-edit-files-buf))) 350 (when (setq buf (get-buffer (or buf log-edit-files-buf)))
344 (let ((win (get-buffer-window buf where))) 351 (let ((win (get-buffer-window buf where)))
562 where LOGBUFFER is the name of the ChangeLog buffer, and each 569 where LOGBUFFER is the name of the ChangeLog buffer, and each
563 \(ENTRYSTART . ENTRYEND\) pair is a buffer region." 570 \(ENTRYSTART . ENTRYEND\) pair is a buffer region."
564 (save-excursion 571 (save-excursion
565 (let ((changelog-file-name 572 (let ((changelog-file-name
566 (let ((default-directory 573 (let ((default-directory
567 (file-name-directory (expand-file-name file)))) 574 (file-name-directory (expand-file-name file)))
568 ;; `find-change-log' uses `change-log-default-name' if set 575 (visiting-buffer (find-buffer-visiting file)))
569 ;; and sets it before exiting, so we need to work around 576 ;; If there is a buffer visiting FILE, and it has a local
570 ;; that memoizing which is undesired here 577 ;; value for `change-log-default-name', use that.
571 (setq change-log-default-name nil) 578 (if (and visiting-buffer
572 (find-change-log)))) 579 (local-variable-p 'change-log-default-name
580 visiting-buffer))
581 (save-excursion
582 (set-buffer visiting-buffer)
583 change-log-default-name)
584 ;; `find-change-log' uses `change-log-default-name' if set
585 ;; and sets it before exiting, so we need to work around
586 ;; that memoizing which is undesired here
587 (setq change-log-default-name nil)
588 (find-change-log)))))
573 (set-buffer (find-file-noselect changelog-file-name)) 589 (set-buffer (find-file-noselect changelog-file-name))
574 (unless (eq major-mode 'change-log-mode) (change-log-mode)) 590 (unless (eq major-mode 'change-log-mode) (change-log-mode))
575 (goto-char (point-min)) 591 (goto-char (point-min))
576 (if (looking-at "\\s-*\n") (goto-char (match-end 0))) 592 (if (looking-at "\\s-*\n") (goto-char (match-end 0)))
577 (if (not (log-edit-changelog-ours-p)) 593 (if (not (log-edit-changelog-ours-p))
628 (log-edit-changelog-insert-entries (car buffer-entry) (cdr buffer-entry)) 644 (log-edit-changelog-insert-entries (car buffer-entry) (cdr buffer-entry))
629 (when (cdr buffer-entry) (newline))))) 645 (when (cdr buffer-entry) (newline)))))
630 646
631 (provide 'log-edit) 647 (provide 'log-edit)
632 648
649 ;;; arch-tag: 8089b39c-983b-4e83-93cd-ed0a64c7fdcc
633 ;;; log-edit.el ends here 650 ;;; log-edit.el ends here