* lisp/color.el (color-xyz-to-lab, color-lab-to-xyz, color-cie-de2000):
[bpt/emacs.git] / lisp / vc / vc-dispatcher.el
index c4e0dbf..d8a7a29 100644 (file)
@@ -1,6 +1,6 @@
 ;;; vc-dispatcher.el -- generic command-dispatcher facility.
 
-;; Copyright (C) 2008-2011  Free Software Foundation, Inc.
+;; Copyright (C) 2008-2012  Free Software Foundation, Inc.
 
 ;; Author:     FSF (see below for full credits)
 ;; Maintainer: Eric S. Raymond <esr@thyrsus.com>
 ;;
 ;; When the client mode adds a local vc-mode-line-hook to a buffer, it
 ;; will be called with the buffer file name as argument whenever the
-;; dispatcher resynchs the buffer.
+;; dispatcher resyncs the buffer.
 
 ;; To do:
 ;;
@@ -363,6 +363,7 @@ of a buffer, which is created.
 ROOT should be the directory in which the command should be run.
 Display the buffer in some window, but don't select it."
   (let* ((dir default-directory)
+        (inhibit-read-only t)
         window new-window-start)
     (setq buffer (get-buffer-create buffer))
     (if (get-buffer-process buffer)
@@ -385,6 +386,17 @@ Display the buffer in some window, but don't select it."
        (set-window-start window new-window-start))
     buffer))
 
+(defun vc-compilation-mode (backend)
+  "Setup `compilation-mode' after with the appropriate `compilation-error-regexp-alist'."
+  (let* ((error-regexp-alist
+          (vc-make-backend-sym backend 'error-regexp-alist))
+         (compilation-error-regexp-alist
+          (and (boundp error-regexp-alist)
+               (symbol-value error-regexp-alist))))
+    (compilation-mode)
+    (set (make-local-variable 'compilation-error-regexp-alist)
+         compilation-error-regexp-alist)))
+
 (defun vc-set-async-update (process-buffer)
   "Set a `vc-exec-after' action appropriate to the current buffer.
 This action will update the current buffer after the current
@@ -536,13 +548,12 @@ editing!"
         (kill-buffer (current-buffer)))))
 
 (declare-function vc-dir-resynch-file "vc-dir" (&optional fname))
-(declare-function vc-string-prefix-p "vc" (prefix string))
 
 (defun vc-resynch-buffers-in-directory (directory &optional keep noquery reset-vc-info)
   "Resync all buffers that visit files in DIRECTORY."
   (dolist (buffer (buffer-list))
     (let ((fname (buffer-file-name buffer)))
-      (when (and fname (vc-string-prefix-p directory fname))
+      (when (and fname (string-prefix-p directory fname))
        (with-current-buffer buffer
          (vc-resynch-buffer fname keep noquery reset-vc-info))))))
 
@@ -575,10 +586,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 +597,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 +616,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 +632,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))
@@ -665,18 +678,15 @@ the buffer contents as a comment."
       (funcall log-operation
               log-fileset
               log-entry))
-    ;; Remove checkin window (after the checkin so that if that fails
-    ;; we don't zap the log buffer and the typing therein).
-    ;; -- IMO this should be replaced with quit-window
-    (cond ((and logbuf vc-delete-logbuf-window)
-          (delete-windows-on logbuf (selected-frame))
-          ;; Kill buffer and delete any other dedicated windows/frames.
-          (kill-buffer logbuf))
-         (logbuf
-           (with-selected-window (or (get-buffer-window logbuf 0)
-                                     (selected-window))
-             (with-current-buffer logbuf
-               (bury-buffer)))))
+
+    ;; Quit windows on logbuf.
+    (cond
+     ((not logbuf))
+     (vc-delete-logbuf-window
+      (quit-windows-on logbuf t (selected-frame)))
+     (t
+      (quit-windows-on logbuf nil 0)))
+
     ;; Now make sure we see the expanded headers
     (when log-fileset
       (mapc