aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChong Yidong2012-07-11 12:35:13 +0800
committerChong Yidong2012-07-11 12:35:13 +0800
commit9af577566add17398ee3b778ac9934bc391eecf7 (patch)
tree0d25dec5da3788e495ab505361e0de9f93765314
parent984e7f300ef0bfec7be97c9bbaff5a6295a43aa2 (diff)
downloademacs-9af577566add17398ee3b778ac9934bc391eecf7.tar.gz
emacs-9af577566add17398ee3b778ac9934bc391eecf7.zip
Allow use of vc-root-* commands in *vc-log* buffers.
* lisp/vc/log-edit.el (log-edit-vc-backend): New variable. (log-edit): Doc fix. * lisp/vc/log-view.el (log-view-vc-fileset, log-view-vc-backend): Doc fix. * lisp/vc/vc-dispatcher.el (vc-log-edit): New args. Use PARAMS argument of log-edit to set up all local variables. (vc-start-logentry): New optional arg specifying VC backend. * lisp/vc/vc.el (vc-checkin): Use it. (vc-deduce-fileset): Handle Log Edit buffers. (vc-diff): Make first argument optional too.
-rw-r--r--lisp/ChangeLog15
-rw-r--r--lisp/vc/log-edit.el31
-rw-r--r--lisp/vc/log-view.el4
-rw-r--r--lisp/vc/vc-dispatcher.el16
-rw-r--r--lisp/vc/vc.el7
5 files changed, 50 insertions, 23 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 149c75b1c75..3ceed6c6675 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,18 @@
12012-07-11 Chong Yidong <cyd@gnu.org>
2
3 * vc/log-edit.el (log-edit-vc-backend): New variable.
4 (log-edit): Doc fix.
5
6 * vc/vc-dispatcher.el (vc-log-edit): New args. Use PARAMS
7 argument of log-edit to set up all local variables.
8 (vc-start-logentry): New optional arg specifying VC backend.
9
10 * vc/vc.el (vc-checkin): Use it.
11 (vc-deduce-fileset): Handle Log Edit buffers.
12 (vc-diff): Make first argument optional too.
13
14 * vc/log-view.el (log-view-vc-fileset, log-view-vc-backend): Doc fix.
15
12012-07-10 Michael Albinus <michael.albinus@gmx.de> 162012-07-10 Michael Albinus <michael.albinus@gmx.de>
2 17
3 * eshell/esh-ext.el (eshell-remote-command): Remove remote part of 18 * eshell/esh-ext.el (eshell-remote-command): Remove remote part of
diff --git a/lisp/vc/log-edit.el b/lisp/vc/log-edit.el
index 5ae311222ba..7ee000a8aea 100644
--- a/lisp/vc/log-edit.el
+++ b/lisp/vc/log-edit.el
@@ -190,6 +190,9 @@ when this variable is set to nil.")
190 190
191(defvar log-edit-parent-buffer nil) 191(defvar log-edit-parent-buffer nil)
192 192
193(defvar log-edit-vc-backend nil
194 "VC fileset corresponding to the current log.")
195
193;;; Originally taken from VC-Log mode 196;;; Originally taken from VC-Log mode
194 197
195(defconst log-edit-maximum-comment-ring-size 32 198(defconst log-edit-maximum-comment-ring-size 32
@@ -405,23 +408,27 @@ automatically."
405;;;###autoload 408;;;###autoload
406(defun log-edit (callback &optional setup params buffer mode &rest _ignore) 409(defun log-edit (callback &optional setup params buffer mode &rest _ignore)
407 "Setup a buffer to enter a log message. 410 "Setup a buffer to enter a log message.
408\\<log-edit-mode-map>The buffer will be put in mode MODE or `log-edit-mode' 411The buffer is put in mode MODE or `log-edit-mode' if MODE is nil.
409if MODE is nil. 412\\<log-edit-mode-map>
410If SETUP is non-nil, the buffer is then erased and `log-edit-hook' is run. 413If SETUP is non-nil, erase the buffer and run `log-edit-hook'.
411Mark and point will be set around the entire contents of the buffer so 414Set mark and point around the entire contents of the buffer, so
412that it is easy to kill the contents of the buffer with \\[kill-region]. 415that it is easy to kill the contents of the buffer with
413Once you're done editing the message, pressing \\[log-edit-done] will call 416\\[kill-region]. Once the user is done editing the message,
414`log-edit-done' which will end up calling CALLBACK to do the actual commit. 417invoking the command \\[log-edit-done] (`log-edit-done') will
415 418call CALLBACK to do the actual commit.
416PARAMS if non-nil is an alist. Possible keys and associated values: 419
420PARAMS if non-nil is an alist of variables and buffer-local
421values to give them in the Log Edit buffer. Possible keys and
422associated values:
417 `log-edit-listfun' -- function taking no arguments that returns the list of 423 `log-edit-listfun' -- function taking no arguments that returns the list of
418 files that are concerned by the current operation (using relative names); 424 files that are concerned by the current operation (using relative names);
419 `log-edit-diff-function' -- function taking no arguments that 425 `log-edit-diff-function' -- function taking no arguments that
420 displays a diff of the files concerned by the current operation. 426 displays a diff of the files concerned by the current operation.
427 `vc-log-fileset' -- the VC fileset to be committed (if any).
421 428
422If BUFFER is non-nil `log-edit' will jump to that buffer, use it to edit the 429If BUFFER is non-nil `log-edit' will jump to that buffer, use it
423log message and go back to the current buffer when done. Otherwise, it 430to edit the log message and go back to the current buffer when
424uses the current buffer." 431done. Otherwise, it uses the current buffer."
425 (let ((parent (current-buffer))) 432 (let ((parent (current-buffer)))
426 (if buffer (pop-to-buffer buffer)) 433 (if buffer (pop-to-buffer buffer))
427 (when (and log-edit-setup-invert (not (eq setup 'force))) 434 (when (and log-edit-setup-invert (not (eq setup 'force)))
diff --git a/lisp/vc/log-view.el b/lisp/vc/log-view.el
index 07526b4fba6..6514fbd22d7 100644
--- a/lisp/vc/log-view.el
+++ b/lisp/vc/log-view.el
@@ -245,10 +245,10 @@ The match group number 1 should match the revision number itself.")
245 '(log-view-font-lock-keywords t nil nil nil)) 245 '(log-view-font-lock-keywords t nil nil nil))
246 246
247(defvar log-view-vc-fileset nil 247(defvar log-view-vc-fileset nil
248 "Set this to the fileset corresponding to the current log.") 248 "The VC fileset corresponding to the current log.")
249 249
250(defvar log-view-vc-backend nil 250(defvar log-view-vc-backend nil
251 "Set this to the VC backend that created the current log.") 251 "The VC backend that created the current log.")
252 252
253;;;; 253;;;;
254;;;; Actual code 254;;;; Actual code
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index 95c15030953..b8ad4ff5217 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -575,10 +575,10 @@ NOT-URGENT means it is ok to continue if the user says not to save."
575 575
576;; Set up key bindings for use while editing log messages 576;; Set up key bindings for use while editing log messages
577 577
578(defun vc-log-edit (fileset mode) 578(defun vc-log-edit (fileset mode backend)
579 "Set up `log-edit' for use on FILE." 579 "Set up `log-edit' for use on FILE."
580 (setq default-directory 580 (setq default-directory
581 (with-current-buffer vc-parent-buffer default-directory)) 581 (buffer-local-value 'default-directory vc-parent-buffer))
582 (log-edit 'vc-finish-logentry 582 (log-edit 'vc-finish-logentry
583 nil 583 nil
584 `((log-edit-listfun . (lambda () 584 `((log-edit-listfun . (lambda ()
@@ -586,14 +586,15 @@ NOT-URGENT means it is ok to continue if the user says not to save."
586 ;; for directories. 586 ;; for directories.
587 (mapcar 'file-relative-name 587 (mapcar 'file-relative-name
588 ',fileset))) 588 ',fileset)))
589 (log-edit-diff-function . (lambda () (vc-diff nil)))) 589 (log-edit-diff-function . vc-diff)
590 (log-edit-vc-backend . ,backend)
591 (vc-log-fileset . ,fileset))
590 nil 592 nil
591 mode) 593 mode)
592 (set (make-local-variable 'vc-log-fileset) fileset)
593 (set-buffer-modified-p nil) 594 (set-buffer-modified-p nil)
594 (setq buffer-file-name nil)) 595 (setq buffer-file-name nil))
595 596
596(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook) 597(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook backend)
597 "Accept a comment for an operation on FILES. 598 "Accept a comment for an operation on FILES.
598If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the 599If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the
599action on close to ACTION. If COMMENT is a string and 600action on close to ACTION. If COMMENT is a string and
@@ -604,7 +605,8 @@ entered COMMENT. If COMMENT is t, also do action immediately with an
604empty comment. Remember the file's buffer in `vc-parent-buffer' 605empty comment. Remember the file's buffer in `vc-parent-buffer'
605\(current one if no file). Puts the log-entry buffer in major-mode 606\(current one if no file). Puts the log-entry buffer in major-mode
606MODE, defaulting to `log-edit-mode' if MODE is nil. 607MODE, defaulting to `log-edit-mode' if MODE is nil.
607AFTER-HOOK specifies the local value for `vc-log-after-operation-hook'." 608AFTER-HOOK specifies the local value for `vc-log-after-operation-hook'.
609BACKEND, if non-nil, specifies a VC backend for the Log Edit buffer."
608 (let ((parent 610 (let ((parent
609 (if (vc-dispatcher-browsing) 611 (if (vc-dispatcher-browsing)
610 ;; If we are called from a directory browser, the parent buffer is 612 ;; If we are called from a directory browser, the parent buffer is
@@ -619,7 +621,7 @@ AFTER-HOOK specifies the local value for `vc-log-after-operation-hook'."
619 (set (make-local-variable 'vc-parent-buffer) parent) 621 (set (make-local-variable 'vc-parent-buffer) parent)
620 (set (make-local-variable 'vc-parent-buffer-name) 622 (set (make-local-variable 'vc-parent-buffer-name)
621 (concat " from " (buffer-name vc-parent-buffer))) 623 (concat " from " (buffer-name vc-parent-buffer)))
622 (vc-log-edit files mode) 624 (vc-log-edit files mode backend)
623 (make-local-variable 'vc-log-after-operation-hook) 625 (make-local-variable 'vc-log-after-operation-hook)
624 (when after-hook 626 (when after-hook
625 (setq vc-log-after-operation-hook after-hook)) 627 (setq vc-log-after-operation-hook after-hook))
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 87e4e1c5124..651008b4e65 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -936,11 +936,13 @@ Within directories, only files already under version control are noticed."
936 936
937(defvar vc-dir-backend) 937(defvar vc-dir-backend)
938(defvar log-view-vc-backend) 938(defvar log-view-vc-backend)
939(defvar log-edit-vc-backend)
939(defvar diff-vc-backend) 940(defvar diff-vc-backend)
940 941
941(defun vc-deduce-backend () 942(defun vc-deduce-backend ()
942 (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend) 943 (cond ((derived-mode-p 'vc-dir-mode) vc-dir-backend)
943 ((derived-mode-p 'log-view-mode) log-view-vc-backend) 944 ((derived-mode-p 'log-view-mode) log-view-vc-backend)
945 ((derived-mode-p 'log-edit-mode) log-edit-vc-backend)
944 ((derived-mode-p 'diff-mode) diff-vc-backend) 946 ((derived-mode-p 'diff-mode) diff-vc-backend)
945 ;; Maybe we could even use comint-mode rather than shell-mode? 947 ;; Maybe we could even use comint-mode rather than shell-mode?
946 ((derived-mode-p 'dired-mode 'shell-mode 'compilation-mode) 948 ((derived-mode-p 'dired-mode 'shell-mode 'compilation-mode)
@@ -1434,7 +1436,8 @@ Runs the normal hooks `vc-before-checkin-hook' and `vc-checkin-hook'."
1434 (vc-checkout-time . ,(nth 5 (file-attributes file))) 1436 (vc-checkout-time . ,(nth 5 (file-attributes file)))
1435 (vc-working-revision . nil))) 1437 (vc-working-revision . nil)))
1436 (message "Checking in %s...done" (vc-delistify files))) 1438 (message "Checking in %s...done" (vc-delistify files)))
1437 'vc-checkin-hook)) 1439 'vc-checkin-hook
1440 backend))
1438 1441
1439;;; Additional entry points for examining version histories 1442;;; Additional entry points for examining version histories
1440 1443
@@ -1680,7 +1683,7 @@ Return t if the buffer had changes, nil otherwise."
1680 (called-interactively-p 'interactive))) 1683 (called-interactively-p 'interactive)))
1681 1684
1682;;;###autoload 1685;;;###autoload
1683(defun vc-diff (historic &optional not-urgent) 1686(defun vc-diff (&optional historic not-urgent)
1684 "Display diffs between file revisions. 1687 "Display diffs between file revisions.
1685Normally this compares the currently selected fileset with their 1688Normally this compares the currently selected fileset with their
1686working revisions. With a prefix argument HISTORIC, it reads two revision 1689working revisions. With a prefix argument HISTORIC, it reads two revision