X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/ab5796a9f97180707734a81320e3eb81937281fe..139bbb9cc4db48696ce8c48b8dd6ce09c2c07594:/lisp/log-edit.el diff --git a/lisp/log-edit.el b/lisp/log-edit.el index 31bf7add45..2b38dcadf5 100644 --- a/lisp/log-edit.el +++ b/lisp/log-edit.el @@ -1,6 +1,7 @@ ;;; log-edit.el --- Major mode for editing CVS commit messages -;; Copyright (C) 1999,2000,2003 Free Software Foundation, Inc. +;; Copyright (C) 1999, 2000, 2002, 2003, 2004, +;; 2005 Free Software Foundation, Inc. ;; Author: Stefan Monnier ;; Keywords: pcl-cvs cvs commit log @@ -19,8 +20,8 @@ ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the -;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, -;; Boston, MA 02111-1307, USA. +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +;; Boston, MA 02110-1301, USA. ;;; Commentary: @@ -154,12 +155,12 @@ different paragraphs are unrelated. You could argue that the log entry for a file should contain the full ChangeLog paragraph mentioning the change to the file, even though it may mention other files, because that gives you the full context you -need to understand the change. This is the behaviour you get when this +need to understand the change. This is the behavior you get when this variable is set to t. On the other hand, you could argue that the log entry for a change should contain only the text for the changes which occurred in that -file, because the log is per-file. This is the behaviour you get +file, because the log is per-file. This is the behavior you get when this variable is set to nil.") ;;;; Internal global or buffer-local vars @@ -281,24 +282,29 @@ automatically." ;; Compatibility with old names. (defvaralias 'vc-comment-ring 'log-edit-comment-ring) -(make-obsolete-variable 'vc-comment-ring 'log-edit-comment-ring "21.5") +(make-obsolete-variable 'vc-comment-ring 'log-edit-comment-ring "22.1") (defvaralias 'vc-comment-ring-index 'log-edit-comment-ring-index) -(make-obsolete-variable 'vc-comment-ring-index 'log-edit-comment-ring-index "21.5") +(make-obsolete-variable 'vc-comment-ring-index 'log-edit-comment-ring-index "22.1") (defalias 'vc-previous-comment 'log-edit-previous-comment) -(make-obsolete 'vc-previous-comment 'log-edit-previous-comment "21.5") +(make-obsolete 'vc-previous-comment 'log-edit-previous-comment "22.1") (defalias 'vc-next-comment 'log-edit-next-comment) -(make-obsolete 'vc-next-comment 'log-edit-next-comment "21.5") +(make-obsolete 'vc-next-comment 'log-edit-next-comment "22.1") (defalias 'vc-comment-search-reverse 'log-edit-comment-search-backward) -(make-obsolete 'vc-comment-search-reverse 'log-edit-comment-search-backward "21.5") +(make-obsolete 'vc-comment-search-reverse 'log-edit-comment-search-backward "22.1") (defalias 'vc-comment-search-forward 'log-edit-comment-search-forward) -(make-obsolete 'vc-comment-search-forward 'log-edit-comment-search-forward "21.5") +(make-obsolete 'vc-comment-search-forward 'log-edit-comment-search-forward "22.1") (defalias 'vc-comment-to-change-log 'log-edit-comment-to-change-log) -(make-obsolete 'vc-comment-to-change-log 'log-edit-comment-to-change-log "21.5") +(make-obsolete 'vc-comment-to-change-log 'log-edit-comment-to-change-log "22.1") ;;; ;;; Actual code ;;; +(defvar log-edit-font-lock-keywords + '(("\\`\\(Summary:\\)\\(.*\\)" + (1 font-lock-keyword-face) + (2 font-lock-function-name-face)))) + ;;;###autoload (defun log-edit (callback &optional setup listfun buffer &rest ignore) "Setup a buffer to enter a log message. @@ -337,6 +343,8 @@ the package from which this is used might also provide additional commands (under C-x v for VC, for example). \\{log-edit-mode-map}" + (set (make-local-variable 'font-lock-defaults) + '(log-edit-font-lock-keywords t)) (make-local-variable 'log-edit-comment-ring-index)) (defun log-edit-hide-buf (&optional buf where) @@ -564,12 +572,21 @@ where LOGBUFFER is the name of the ChangeLog buffer, and each (save-excursion (let ((changelog-file-name (let ((default-directory - (file-name-directory (expand-file-name file)))) - ;; `find-change-log' uses `change-log-default-name' if set - ;; and sets it before exiting, so we need to work around - ;; that memoizing which is undesired here - (setq change-log-default-name nil) - (find-change-log)))) + (file-name-directory (expand-file-name file))) + (visiting-buffer (find-buffer-visiting file))) + ;; If there is a buffer visiting FILE, and it has a local + ;; value for `change-log-default-name', use that. + (if (and visiting-buffer + (local-variable-p 'change-log-default-name + visiting-buffer)) + (save-excursion + (set-buffer visiting-buffer) + change-log-default-name) + ;; `find-change-log' uses `change-log-default-name' if set + ;; and sets it before exiting, so we need to work around + ;; that memoizing which is undesired here + (setq change-log-default-name nil) + (find-change-log))))) (set-buffer (find-file-noselect changelog-file-name)) (unless (eq major-mode 'change-log-mode) (change-log-mode)) (goto-char (point-min)) @@ -591,8 +608,12 @@ where LOGBUFFER is the name of the ChangeLog buffer, and each (search-forward pattern nil t)))) (setq pattern (file-name-nondirectory file))) + (setq pattern (concat "\\(^\\|[^[:alnum:]]\\)" + pattern + "\\($\\|[^[:alnum:]]\\)")) + (let (texts) - (while (search-forward pattern nil t) + (while (re-search-forward pattern nil t) (let ((entry (log-edit-changelog-entry))) (push entry texts) (goto-char (elt entry 1)))) @@ -630,5 +651,5 @@ Sort REGIONS front-to-back first." (provide 'log-edit) -;;; arch-tag: 8089b39c-983b-4e83-93cd-ed0a64c7fdcc +;; arch-tag: 8089b39c-983b-4e83-93cd-ed0a64c7fdcc ;;; log-edit.el ends here