emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r109160: * lisp/vc/vc-dispatcher.el (


From: Sam Steingold
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r109160: * lisp/vc/vc-dispatcher.el (vc-compilation-mode): Add, based on
Date: Thu, 19 Jul 2012 10:38:01 -0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 109160
committer: Sam Steingold <address@hidden>
branch nick: trunk
timestamp: Thu 2012-07-19 10:38:01 -0400
message:
  * lisp/vc/vc-dispatcher.el (vc-compilation-mode): Add, based on
  vc-bzr-pull & vc-bzr-merge-branch.
  * lisp/vc/vc-bzr.el (vc-bzr-pull, vc-bzr-merge-branch): Use it.
  (vc-bzr-error-regexp-alist): Rename from vc-bzr-error-regex-alist
  for consistency with compilation-error-regexp-alist.
  * lisp/vc/vc-git.el (vc-git-error-regexp-alist): Add.
  (vc-git-pull, vc-git-merge-branch): Call vc-compilation-mode.
  * lisp/vc/vc-hg.el (vc-hg-error-regexp-alist): Add.
  (vc-hg-pull, vc-hg-merge-branch): Call vc-compilation-mode.
modified:
  lisp/ChangeLog
  lisp/vc/vc-bzr.el
  lisp/vc/vc-dispatcher.el
  lisp/vc/vc-git.el
  lisp/vc/vc-hg.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-07-19 11:39:38 +0000
+++ b/lisp/ChangeLog    2012-07-19 14:38:01 +0000
@@ -1,3 +1,15 @@
+2012-07-19  Sam Steingold  <address@hidden>
+
+       * vc/vc-dispatcher.el (vc-compilation-mode): Add, based on
+       vc-bzr-pull & vc-bzr-merge-branch.
+       * vc/vc-bzr.el (vc-bzr-pull, vc-bzr-merge-branch): Use it.
+       (vc-bzr-error-regexp-alist): Rename from vc-bzr-error-regex-alist
+       for consistency with compilation-error-regexp-alist.
+       * vc/vc-git.el (vc-git-error-regexp-alist): Add.
+       (vc-git-pull, vc-git-merge-branch): Call vc-compilation-mode.
+       * vc/vc-hg.el (vc-hg-error-regexp-alist): Add.
+       (vc-hg-pull, vc-hg-merge-branch): Call vc-compilation-mode.
+
 2012-07-19  Stefan Monnier  <address@hidden>
 
        * emacs-lisp/chart.el: Use lexical-binding.

=== modified file 'lisp/vc/vc-bzr.el'
--- a/lisp/vc/vc-bzr.el 2012-07-11 23:13:41 +0000
+++ b/lisp/vc/vc-bzr.el 2012-07-19 14:38:01 +0000
@@ -311,7 +311,7 @@
     (when rootdir
          (file-relative-name filename* rootdir))))
 
-(defvar vc-bzr-error-regex-alist
+(defvar vc-bzr-error-regexp-alist
   '(("^\\( M[* ]\\|+N \\|-D \\|\\|  \\*\\|R[M ] \\) \\(.+\\)" 2 nil nil 1)
     ("^C  \\(.+\\)" 2)
     ("^Text conflict in \\(.+\\)" 1 nil nil 2)
@@ -347,14 +347,7 @@
            command        (cadr args)
            args           (cddr args)))
     (let ((buf (apply 'vc-bzr-async-command command args)))
-      (with-current-buffer buf
-       (vc-exec-after
-        `(progn
-           (let ((compilation-error-regexp-alist
-                  vc-bzr-error-regex-alist))
-             (compilation-mode))
-           (set (make-local-variable 'compilation-error-regexp-alist)
-                vc-bzr-error-regex-alist))))
+      (with-current-buffer buf (vc-exec-after '(vc-compilation-mode 'bzr)))
       (vc-set-async-update buf))))
 
 (defun vc-bzr-merge-branch ()
@@ -385,14 +378,7 @@
         (command        (cadr cmd))
         (args           (cddr cmd)))
     (let ((buf (apply 'vc-bzr-async-command command args)))
-      (with-current-buffer buf
-       (vc-exec-after
-        `(progn
-           (let ((compilation-error-regexp-alist
-                  vc-bzr-error-regex-alist))
-             (compilation-mode))
-           (set (make-local-variable 'compilation-error-regexp-alist)
-                vc-bzr-error-regex-alist))))
+      (with-current-buffer buf (vc-exec-after '(vc-compilation-mode 'bzr)))
       (vc-set-async-update buf))))
 
 (defun vc-bzr-status (file)

=== modified file 'lisp/vc/vc-dispatcher.el'
--- a/lisp/vc/vc-dispatcher.el  2012-07-11 04:35:13 +0000
+++ b/lisp/vc/vc-dispatcher.el  2012-07-19 14:38:01 +0000
@@ -386,6 +386,17 @@
        (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

=== modified file 'lisp/vc/vc-git.el'
--- a/lisp/vc/vc-git.el 2012-07-18 15:04:36 +0000
+++ b/lisp/vc/vc-git.el 2012-07-19 14:38:01 +0000
@@ -646,6 +646,10 @@
     (vc-git-command nil 0 file "reset" "-q" "--")
     (vc-git-command nil nil file "checkout" "-q" "--")))
 
+(defvar vc-git-error-regexp-alist
+  '(("^ \\(.+\\) |" 1 nil nil 0))
+  "Value of `compilation-error-regexp-alist' in *vc-git* buffers.")
+
 (defun vc-git-pull (prompt)
   "Pull changes into the current Git branch.
 Normally, this runs \"git pull\".  If PROMPT is non-nil, prompt
@@ -666,6 +670,7 @@
            command     (cadr args)
            args        (cddr args)))
     (apply 'vc-do-async-command buffer root git-program command args)
+    (with-current-buffer buffer (vc-exec-after '(vc-compilation-mode 'git)))
     (vc-set-async-update buffer)))
 
 (defun vc-git-merge-branch ()
@@ -685,6 +690,7 @@
                           nil t)))
     (apply 'vc-do-async-command buffer root vc-git-program "merge"
           (list merge-source))
+    (with-current-buffer buffer (vc-exec-after '(vc-compilation-mode 'git)))
     (vc-set-async-update buffer)))
 
 ;;; HISTORY FUNCTIONS

=== modified file 'lisp/vc/vc-hg.el'
--- a/lisp/vc/vc-hg.el  2012-07-11 23:13:41 +0000
+++ b/lisp/vc/vc-hg.el  2012-07-19 14:38:01 +0000
@@ -611,6 +611,14 @@
                       (mapcar (lambda (arg) (list "-r" arg)) marked-list)))
       (error "No log entries selected for push"))))
 
+(defvar vc-hg-error-regexp-alist nil
+  ;; 'hg pull' does not list modified files, so, for now, the only
+  ;; benefit of `vc-compilation-mode' is that one can get rid of
+  ;; *vc-hg* buffer with 'q' or 'z'.
+  ;; TODO: call 'hg incoming' before pull/merge to get the list of
+  ;;       modified files
+  "Value of `compilation-error-regexp-alist' in *vc-hg* buffers.")
+
 (defun vc-hg-pull (prompt)
   "Issue a Mercurial pull command.
 If called interactively with a set of marked Log View buffers,
@@ -651,6 +659,7 @@
                args       (cddr args)))
        (apply 'vc-do-async-command buffer root hg-program
               command args)
+        (with-current-buffer buffer (vc-exec-after '(vc-compilation-mode 'hg)))
        (vc-set-async-update buffer)))))
 
 (defun vc-hg-merge-branch ()
@@ -659,6 +668,7 @@
   (let* ((root (vc-hg-root default-directory))
         (buffer (format "*vc-hg : %s*" (expand-file-name root))))
     (apply 'vc-do-async-command buffer root vc-hg-program '("merge"))
+    (with-current-buffer buffer (vc-exec-after '(vc-compilation-mode 'hg)))
     (vc-set-async-update buffer)))
 
 ;;; Internal functions


reply via email to

[Prev in Thread] Current Thread [Next in Thread]