* 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.
+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
(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
;;;###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)))
'(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
;; 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 ()
;; 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
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
(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))
(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)
(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
(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