]> code.delx.au - gnu-emacs/commitdiff
Allow use of vc-root-* commands in *vc-log* buffers.
authorChong Yidong <cyd@gnu.org>
Wed, 11 Jul 2012 04:35:13 +0000 (12:35 +0800)
committerChong Yidong <cyd@gnu.org>
Wed, 11 Jul 2012 04:35:13 +0000 (12:35 +0800)
* 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.

lisp/ChangeLog
lisp/vc/log-edit.el
lisp/vc/log-view.el
lisp/vc/vc-dispatcher.el
lisp/vc/vc.el

index 149c75b1c753ad1c66a2f5bc2ef7faa3d117bb32..3ceed6c667595e890cf50ebaf04a4a18a51e4648 100644 (file)
@@ -1,3 +1,18 @@
+2012-07-11  Chong Yidong  <cyd@gnu.org>
+
+       * vc/log-edit.el (log-edit-vc-backend): New variable.
+       (log-edit): Doc fix.
+
+       * 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.
+
+       * vc/vc.el (vc-checkin): Use it.
+       (vc-deduce-fileset): Handle Log Edit buffers.
+       (vc-diff): Make first argument optional too.
+
+       * vc/log-view.el (log-view-vc-fileset, log-view-vc-backend): Doc fix.
+
 2012-07-10  Michael Albinus  <michael.albinus@gmx.de>
 
        * eshell/esh-ext.el (eshell-remote-command): Remove remote part of
index 5ae311222ba6869c193f8305d4e6831e5bc89da4..7ee000a8aea9a178a04eb05dc0417d5d79f063a9 100644 (file)
@@ -190,6 +190,9 @@ when this variable is set to nil.")
 
 (defvar log-edit-parent-buffer nil)
 
+(defvar log-edit-vc-backend nil
+  "VC fileset corresponding to the current log.")
+
 ;;; Originally taken from VC-Log mode
 
 (defconst log-edit-maximum-comment-ring-size 32
@@ -405,23 +408,27 @@ automatically."
 ;;;###autoload
 (defun log-edit (callback &optional setup params buffer mode &rest _ignore)
   "Setup a buffer to enter a log message.
-\\<log-edit-mode-map>The buffer will be put in mode MODE or `log-edit-mode'
-if MODE is nil.
-If SETUP is non-nil, the buffer is then erased and `log-edit-hook' is run.
-Mark and point will be set around the entire contents of the buffer so
-that it is easy to kill the contents of the buffer with \\[kill-region].
-Once you're done editing the message, pressing \\[log-edit-done] will call
-`log-edit-done' which will end up calling CALLBACK to do the actual commit.
-
-PARAMS if non-nil is an alist.  Possible keys and associated values:
+The buffer is put in mode MODE or `log-edit-mode' if MODE is nil.
+\\<log-edit-mode-map>
+If SETUP is non-nil, erase the buffer and run `log-edit-hook'.
+Set mark and point around the entire contents of the buffer, so
+that it is easy to kill the contents of the buffer with
+\\[kill-region].  Once the user is done editing the message,
+invoking the command \\[log-edit-done] (`log-edit-done') will
+call CALLBACK to do the actual commit.
+
+PARAMS if non-nil is an alist of variables and buffer-local
+values to give them in the Log Edit buffer.  Possible keys and
+associated values:
  `log-edit-listfun' -- function taking no arguments that returns the list of
  files that are concerned by the current operation (using relative names);
  `log-edit-diff-function' -- function taking no arguments that
  displays a diff of the files concerned by the current operation.
+ `vc-log-fileset' -- the VC fileset to be committed (if any).
 
-If BUFFER is non-nil `log-edit' will jump to that buffer, use it to edit the
-log message and go back to the current buffer when done.  Otherwise, it
-uses the current buffer."
+If BUFFER is non-nil `log-edit' will jump to that buffer, use it
+to edit the log message and go back to the current buffer when
+done.  Otherwise, it uses the current buffer."
   (let ((parent (current-buffer)))
     (if buffer (pop-to-buffer buffer))
     (when (and log-edit-setup-invert (not (eq setup 'force)))
index 07526b4fba68ee1e6d85928a1223f5fa5cc43299..6514fbd22d767700e4bde575cb5325a1339509cb 100644 (file)
@@ -245,10 +245,10 @@ The match group number 1 should match the revision number itself.")
   '(log-view-font-lock-keywords t nil nil nil))
 
 (defvar log-view-vc-fileset nil
-  "Set this to the fileset corresponding to the current log.")
+  "The VC fileset corresponding to the current log.")
 
 (defvar log-view-vc-backend nil
-  "Set this to the VC backend that created the current log.")
+  "The VC backend that created the current log.")
 
 ;;;;
 ;;;; Actual code
index 95c150309533ca816a1f4cc7ba88b148d45c16d6..b8ad4ff5217d9b4842e64de7d8d4980a97321152 100644 (file)
@@ -575,10 +575,10 @@ NOT-URGENT means it is ok to continue if the user says not to save."
 
 ;; Set up key bindings for use while editing log messages
 
-(defun vc-log-edit (fileset mode)
+(defun vc-log-edit (fileset mode backend)
   "Set up `log-edit' for use on FILE."
   (setq default-directory
-       (with-current-buffer vc-parent-buffer default-directory))
+       (buffer-local-value 'default-directory vc-parent-buffer))
   (log-edit 'vc-finish-logentry
            nil
            `((log-edit-listfun . (lambda ()
@@ -586,14 +586,15 @@ NOT-URGENT means it is ok to continue if the user says not to save."
                                     ;; for directories.
                                     (mapcar 'file-relative-name
                                             ',fileset)))
-             (log-edit-diff-function . (lambda () (vc-diff nil))))
+             (log-edit-diff-function . vc-diff)
+             (log-edit-vc-backend . ,backend)
+             (vc-log-fileset . ,fileset))
            nil
            mode)
-  (set (make-local-variable 'vc-log-fileset) fileset)
   (set-buffer-modified-p nil)
   (setq buffer-file-name nil))
 
-(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook)
+(defun vc-start-logentry (files comment initial-contents msg logbuf mode action &optional after-hook backend)
   "Accept a comment for an operation on FILES.
 If COMMENT is nil, pop up a LOGBUF buffer, emit MSG, and set the
 action 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
 empty comment.  Remember the file's buffer in `vc-parent-buffer'
 \(current one if no file).  Puts the log-entry buffer in major-mode
 MODE, defaulting to `log-edit-mode' if MODE is nil.
-AFTER-HOOK specifies the local value for `vc-log-after-operation-hook'."
+AFTER-HOOK specifies the local value for `vc-log-after-operation-hook'.
+BACKEND, if non-nil, specifies a VC backend for the Log Edit buffer."
   (let ((parent
          (if (vc-dispatcher-browsing)
              ;; 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'."
     (set (make-local-variable 'vc-parent-buffer) parent)
     (set (make-local-variable 'vc-parent-buffer-name)
         (concat " from " (buffer-name vc-parent-buffer)))
-    (vc-log-edit files mode)
+    (vc-log-edit files mode backend)
     (make-local-variable 'vc-log-after-operation-hook)
     (when after-hook
       (setq vc-log-after-operation-hook after-hook))
index 87e4e1c51249a85f0f08d66cee7acd26a194f291..651008b4e6528d19324513c7b7b05829f0adabd6 100644 (file)
@@ -936,11 +936,13 @@ Within directories, only files already under version control are noticed."
 
 (defvar vc-dir-backend)
 (defvar log-view-vc-backend)
+(defvar log-edit-vc-backend)
 (defvar diff-vc-backend)
 
 (defun vc-deduce-backend ()
   (cond ((derived-mode-p 'vc-dir-mode)   vc-dir-backend)
        ((derived-mode-p 'log-view-mode) log-view-vc-backend)
+       ((derived-mode-p 'log-edit-mode) log-edit-vc-backend)
        ((derived-mode-p 'diff-mode)     diff-vc-backend)
         ;; Maybe we could even use comint-mode rather than shell-mode?
        ((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'."
          (vc-checkout-time . ,(nth 5 (file-attributes file)))
          (vc-working-revision . nil)))
      (message "Checking in %s...done" (vc-delistify files)))
-   'vc-checkin-hook))
+   'vc-checkin-hook
+   backend))
 
 ;;; Additional entry points for examining version histories
 
@@ -1680,7 +1683,7 @@ Return t if the buffer had changes, nil otherwise."
                    (called-interactively-p 'interactive)))
 
 ;;;###autoload
-(defun vc-diff (historic &optional not-urgent)
+(defun vc-diff (&optional historic not-urgent)
   "Display diffs between file revisions.
 Normally this compares the currently selected fileset with their
 working revisions.  With a prefix argument HISTORIC, it reads two revision