comparison lisp/vc.el @ 47765:1dc1153f070a

(vc-log-mode-map): Explicitly inherit from text-mode. (vc-maybe-resolve-conflicts): Don't check smerge-mode and smerge-ediff. (vc-print-log): Don't check log-view-mode. (vc-default-show-log-entry): Don't check log-view-goto-rev. (vc-log-mode): Remove. (vc-log-edit): Don't check log-edit.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sat, 05 Oct 2002 16:35:28 +0000
parents 15d0c5379959
children 27caec378c23
comparison
equal deleted inserted replaced
47764:ce6344b68d1c 47765:1dc1153f070a
4 4
5 ;; Author: FSF (see below for full credits) 5 ;; Author: FSF (see below for full credits)
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> 6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
7 ;; Keywords: tools 7 ;; Keywords: tools
8 8
9 ;; $Id: vc.el,v 1.337 2002/10/03 22:43:01 monnier Exp $ 9 ;; $Id: vc.el,v 1.338 2002/10/05 03:00:47 rost Exp $
10 10
11 ;; This file is part of GNU Emacs. 11 ;; This file is part of GNU Emacs.
12 12
13 ;; GNU Emacs is free software; you can redistribute it and/or modify 13 ;; GNU Emacs is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by 14 ;; it under the terms of the GNU General Public License as published by
652 ;; The main keymap 652 ;; The main keymap
653 653
654 ;; Initialization code, to be done just once at load-time 654 ;; Initialization code, to be done just once at load-time
655 (defvar vc-log-mode-map 655 (defvar vc-log-mode-map
656 (let ((map (make-sparse-keymap))) 656 (let ((map (make-sparse-keymap)))
657 (set-keymap-parent map text-mode-map)
657 (define-key map "\M-n" 'vc-next-comment) 658 (define-key map "\M-n" 'vc-next-comment)
658 (define-key map "\M-p" 'vc-previous-comment) 659 (define-key map "\M-p" 'vc-previous-comment)
659 (define-key map "\M-r" 'vc-comment-search-reverse) 660 (define-key map "\M-r" 'vc-comment-search-reverse)
660 (define-key map "\M-s" 'vc-comment-search-forward) 661 (define-key map "\M-s" 'vc-comment-search-forward)
661 (define-key map "\C-c\C-c" 'vc-finish-logentry) 662 (define-key map "\C-c\C-c" 'vc-finish-logentry)
2031 (vc-maybe-resolve-conflicts file status "WORKFILE" "MERGE SOURCE"))) 2032 (vc-maybe-resolve-conflicts file status "WORKFILE" "MERGE SOURCE")))
2032 2033
2033 (defun vc-maybe-resolve-conflicts (file status &optional name-A name-B) 2034 (defun vc-maybe-resolve-conflicts (file status &optional name-A name-B)
2034 (vc-resynch-buffer file t (not (buffer-modified-p))) 2035 (vc-resynch-buffer file t (not (buffer-modified-p)))
2035 (if (zerop status) (message "Merge successful") 2036 (if (zerop status) (message "Merge successful")
2036 (if (fboundp 'smerge-mode) (smerge-mode 1)) 2037 (smerge-mode 1)
2037 (if (y-or-n-p "Conflicts detected. Resolve them now? ") 2038 (if (y-or-n-p "Conflicts detected. Resolve them now? ")
2038 (if (fboundp 'smerge-ediff) 2039 (smerge-ediff name-A name-B)
2039 (smerge-ediff)
2040 (vc-resolve-conflicts name-A name-B))
2041 (message "File contains conflict markers")))) 2040 (message "File contains conflict markers"))))
2042 2041
2043 (defvar vc-ediff-windows) 2042 (defvar vc-ediff-windows)
2044 (defvar vc-ediff-result) 2043 (defvar vc-ediff-result)
2045 (eval-when-compile 2044 (eval-when-compile
2472 (vc-ensure-vc-buffer) 2471 (vc-ensure-vc-buffer)
2473 (let ((file buffer-file-name)) 2472 (let ((file buffer-file-name))
2474 (vc-call print-log file) 2473 (vc-call print-log file)
2475 (set-buffer "*vc*") 2474 (set-buffer "*vc*")
2476 (pop-to-buffer (current-buffer)) 2475 (pop-to-buffer (current-buffer))
2477 (if (fboundp 'log-view-mode) (log-view-mode)) 2476 (log-view-mode)
2478 (vc-exec-after 2477 (vc-exec-after
2479 `(let ((inhibit-read-only t)) 2478 `(let ((inhibit-read-only t))
2480 (goto-char (point-max)) (forward-line -1) 2479 (goto-char (point-max)) (forward-line -1)
2481 (while (looking-at "=*\n") 2480 (while (looking-at "=*\n")
2482 (delete-char (- (match-end 0) (match-beginning 0))) 2481 (delete-char (- (match-end 0) (match-beginning 0)))
2490 'show-log-entry 2489 'show-log-entry
2491 ',(vc-workfile-version file)) 2490 ',(vc-workfile-version file))
2492 (set-buffer-modified-p nil))))) 2491 (set-buffer-modified-p nil)))))
2493 2492
2494 (defun vc-default-show-log-entry (backend rev) 2493 (defun vc-default-show-log-entry (backend rev)
2495 (if (fboundp 'log-view-goto-rev) 2494 (log-view-goto-rev rev))
2496 (log-view-goto-rev rev)))
2497 2495
2498 (defun vc-default-comment-history (backend file) 2496 (defun vc-default-comment-history (backend file)
2499 "Return a string with all log entries stored in BACKEND for FILE." 2497 "Return a string with all log entries stored in BACKEND for FILE."
2500 (if (vc-find-backend-function backend 'print-log) 2498 (if (vc-find-backend-function backend 'print-log)
2501 (with-current-buffer "*vc*" 2499 (with-current-buffer "*vc*"
3237 3235
3238 ;; Back-end-dependent stuff ends here. 3236 ;; Back-end-dependent stuff ends here.
3239 3237
3240 ;; Set up key bindings for use while editing log messages 3238 ;; Set up key bindings for use while editing log messages
3241 3239
3242 (define-derived-mode vc-log-mode text-mode "VC-Log"
3243 "Major mode for editing VC log entries.
3244 These bindings are added to the global keymap when you enter this mode:
3245 \\[vc-next-action] perform next logical version-control operation on current file
3246 \\[vc-register] register current file
3247 \\[vc-insert-headers] insert version-control headers in current file
3248 \\[vc-print-log] display change history of current file
3249 \\[vc-revert-buffer] revert buffer to latest version
3250 \\[vc-cancel-version] undo latest checkin
3251 \\[vc-diff] show diffs between file versions
3252 \\[vc-version-other-window] visit old version in another window
3253 \\[vc-directory] show all files locked by any user in or below .
3254 \\[vc-annotate] colorful display of the cvs annotate command
3255 \\[vc-update-change-log] add change log entry from recent checkins
3256
3257 While you are entering a change log message for a version, the following
3258 additional bindings will be in effect.
3259
3260 \\[vc-finish-logentry] proceed with check in, ending log message entry
3261
3262 Whenever you do a checkin, your log comment is added to a ring of
3263 saved comments. These can be recalled as follows:
3264
3265 \\[vc-next-comment] replace region with next message in comment ring
3266 \\[vc-previous-comment] replace region with previous message in comment ring
3267 \\[vc-comment-search-reverse] search backward for regexp in the comment ring
3268 \\[vc-comment-search-forward] search backward for regexp in the comment ring
3269
3270 Entry to the change-log submode calls the value of `text-mode-hook', then
3271 the value of `vc-log-mode-hook'.
3272
3273 Global user options:
3274 `vc-initial-comment' If non-nil, require user to enter a change
3275 comment upon first checkin of the file.
3276
3277 `vc-keep-workfiles' Non-nil value prevents workfiles from being
3278 deleted when changes are checked in
3279
3280 `vc-suppress-confirm' Suppresses some confirmation prompts.
3281
3282 vc-BACKEND-header Which keywords to insert when adding headers
3283 with \\[vc-insert-headers]. Defaults to
3284 '(\"\%\W\%\") under SCCS, '(\"\$Id\$\") under
3285 RCS and CVS.
3286
3287 `vc-static-header-alist' By default, version headers inserted in C files
3288 get stuffed in a static string area so that
3289 ident(RCS/CVS) or what(SCCS) can see them in
3290 the compiled object code. You can override
3291 this by setting this variable to nil, or change
3292 the header template by changing it.
3293
3294 `vc-command-messages' if non-nil, display run messages from the
3295 actual version-control utilities (this is
3296 intended primarily for people hacking vc
3297 itself)."
3298 (make-local-variable 'vc-comment-ring-index))
3299
3300 (defun vc-log-edit (file) 3240 (defun vc-log-edit (file)
3301 "Set up `log-edit' for use with VC on FILE. 3241 "Set up `log-edit' for use with VC on FILE."
3302 If `log-edit' is not available, resort to `vc-log-mode'."
3303 (setq default-directory 3242 (setq default-directory
3304 (if file (file-name-directory file) 3243 (if file (file-name-directory file)
3305 (with-current-buffer vc-parent-buffer default-directory))) 3244 (with-current-buffer vc-parent-buffer default-directory)))
3306 (if (fboundp 'log-edit) 3245 (log-edit 'vc-finish-logentry nil
3307 (log-edit 'vc-finish-logentry nil 3246 (if file `(lambda () ',(list (file-name-nondirectory file)))
3308 (if file `(lambda () ',(list (file-name-nondirectory file))) 3247 ;; If FILE is nil, we were called from vc-dired.
3309 ;; If FILE is nil, we were called from vc-dired. 3248 (lambda ()
3310 (lambda () 3249 (with-current-buffer vc-parent-buffer
3311 (with-current-buffer vc-parent-buffer 3250 (dired-get-marked-files t)))))
3312 (dired-get-marked-files t)))))
3313 (vc-log-mode))
3314 (set (make-local-variable 'vc-log-file) file) 3251 (set (make-local-variable 'vc-log-file) file)
3315 (make-local-variable 'vc-log-version) 3252 (make-local-variable 'vc-log-version)
3316 (set-buffer-modified-p nil) 3253 (set-buffer-modified-p nil)
3317 (setq buffer-file-name nil)) 3254 (setq buffer-file-name nil))
3318 3255