aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Steingold2012-07-19 10:38:01 -0400
committerSam Steingold2012-07-19 10:38:01 -0400
commit8a4e6db81ae0c04a73693718cb8aaa59e160663f (patch)
treea507fa298634211085926eb46bfd62d8792782dc
parent5db81e33629049da22e7d0ff6c28a5cae31edac9 (diff)
downloademacs-8a4e6db81ae0c04a73693718cb8aaa59e160663f.tar.gz
emacs-8a4e6db81ae0c04a73693718cb8aaa59e160663f.zip
* 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.
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/vc/vc-bzr.el20
-rw-r--r--lisp/vc/vc-dispatcher.el11
-rw-r--r--lisp/vc/vc-git.el6
-rw-r--r--lisp/vc/vc-hg.el10
5 files changed, 42 insertions, 17 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 170982d724e..3216afa3e4c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
12012-07-19 Sam Steingold <sds@gnu.org>
2
3 * vc/vc-dispatcher.el (vc-compilation-mode): Add, based on
4 vc-bzr-pull & vc-bzr-merge-branch.
5 * vc/vc-bzr.el (vc-bzr-pull, vc-bzr-merge-branch): Use it.
6 (vc-bzr-error-regexp-alist): Rename from vc-bzr-error-regex-alist
7 for consistency with compilation-error-regexp-alist.
8 * vc/vc-git.el (vc-git-error-regexp-alist): Add.
9 (vc-git-pull, vc-git-merge-branch): Call vc-compilation-mode.
10 * vc/vc-hg.el (vc-hg-error-regexp-alist): Add.
11 (vc-hg-pull, vc-hg-merge-branch): Call vc-compilation-mode.
12
12012-07-19 Stefan Monnier <monnier@iro.umontreal.ca> 132012-07-19 Stefan Monnier <monnier@iro.umontreal.ca>
2 14
3 * emacs-lisp/chart.el: Use lexical-binding. 15 * emacs-lisp/chart.el: Use lexical-binding.
diff --git a/lisp/vc/vc-bzr.el b/lisp/vc/vc-bzr.el
index ce4d76dc5f2..c0dafda57b6 100644
--- a/lisp/vc/vc-bzr.el
+++ b/lisp/vc/vc-bzr.el
@@ -311,7 +311,7 @@ in the repository root directory of FILE."
311 (when rootdir 311 (when rootdir
312 (file-relative-name filename* rootdir)))) 312 (file-relative-name filename* rootdir))))
313 313
314(defvar vc-bzr-error-regex-alist 314(defvar vc-bzr-error-regexp-alist
315 '(("^\\( M[* ]\\|+N \\|-D \\|\\| \\*\\|R[M ] \\) \\(.+\\)" 2 nil nil 1) 315 '(("^\\( M[* ]\\|+N \\|-D \\|\\| \\*\\|R[M ] \\) \\(.+\\)" 2 nil nil 1)
316 ("^C \\(.+\\)" 2) 316 ("^C \\(.+\\)" 2)
317 ("^Text conflict in \\(.+\\)" 1 nil nil 2) 317 ("^Text conflict in \\(.+\\)" 1 nil nil 2)
@@ -347,14 +347,7 @@ prompt for the Bzr command to run."
347 command (cadr args) 347 command (cadr args)
348 args (cddr args))) 348 args (cddr args)))
349 (let ((buf (apply 'vc-bzr-async-command command args))) 349 (let ((buf (apply 'vc-bzr-async-command command args)))
350 (with-current-buffer buf 350 (with-current-buffer buf (vc-exec-after '(vc-compilation-mode 'bzr)))
351 (vc-exec-after
352 `(progn
353 (let ((compilation-error-regexp-alist
354 vc-bzr-error-regex-alist))
355 (compilation-mode))
356 (set (make-local-variable 'compilation-error-regexp-alist)
357 vc-bzr-error-regex-alist))))
358 (vc-set-async-update buf)))) 351 (vc-set-async-update buf))))
359 352
360(defun vc-bzr-merge-branch () 353(defun vc-bzr-merge-branch ()
@@ -385,14 +378,7 @@ default if it is available."
385 (command (cadr cmd)) 378 (command (cadr cmd))
386 (args (cddr cmd))) 379 (args (cddr cmd)))
387 (let ((buf (apply 'vc-bzr-async-command command args))) 380 (let ((buf (apply 'vc-bzr-async-command command args)))
388 (with-current-buffer buf 381 (with-current-buffer buf (vc-exec-after '(vc-compilation-mode 'bzr)))
389 (vc-exec-after
390 `(progn
391 (let ((compilation-error-regexp-alist
392 vc-bzr-error-regex-alist))
393 (compilation-mode))
394 (set (make-local-variable 'compilation-error-regexp-alist)
395 vc-bzr-error-regex-alist))))
396 (vc-set-async-update buf)))) 382 (vc-set-async-update buf))))
397 383
398(defun vc-bzr-status (file) 384(defun vc-bzr-status (file)
diff --git a/lisp/vc/vc-dispatcher.el b/lisp/vc/vc-dispatcher.el
index b8ad4ff5217..d8a7a296cf1 100644
--- a/lisp/vc/vc-dispatcher.el
+++ b/lisp/vc/vc-dispatcher.el
@@ -386,6 +386,17 @@ Display the buffer in some window, but don't select it."
386 (set-window-start window new-window-start)) 386 (set-window-start window new-window-start))
387 buffer)) 387 buffer))
388 388
389(defun vc-compilation-mode (backend)
390 "Setup `compilation-mode' after with the appropriate `compilation-error-regexp-alist'."
391 (let* ((error-regexp-alist
392 (vc-make-backend-sym backend 'error-regexp-alist))
393 (compilation-error-regexp-alist
394 (and (boundp error-regexp-alist)
395 (symbol-value error-regexp-alist))))
396 (compilation-mode)
397 (set (make-local-variable 'compilation-error-regexp-alist)
398 compilation-error-regexp-alist)))
399
389(defun vc-set-async-update (process-buffer) 400(defun vc-set-async-update (process-buffer)
390 "Set a `vc-exec-after' action appropriate to the current buffer. 401 "Set a `vc-exec-after' action appropriate to the current buffer.
391This action will update the current buffer after the current 402This action will update the current buffer after the current
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 700adf12fc2..ee776092443 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -646,6 +646,10 @@ The car of the list is the current branch."
646 (vc-git-command nil 0 file "reset" "-q" "--") 646 (vc-git-command nil 0 file "reset" "-q" "--")
647 (vc-git-command nil nil file "checkout" "-q" "--"))) 647 (vc-git-command nil nil file "checkout" "-q" "--")))
648 648
649(defvar vc-git-error-regexp-alist
650 '(("^ \\(.+\\) |" 1 nil nil 0))
651 "Value of `compilation-error-regexp-alist' in *vc-git* buffers.")
652
649(defun vc-git-pull (prompt) 653(defun vc-git-pull (prompt)
650 "Pull changes into the current Git branch. 654 "Pull changes into the current Git branch.
651Normally, this runs \"git pull\". If PROMPT is non-nil, prompt 655Normally, this runs \"git pull\". If PROMPT is non-nil, prompt
@@ -666,6 +670,7 @@ for the Git command to run."
666 command (cadr args) 670 command (cadr args)
667 args (cddr args))) 671 args (cddr args)))
668 (apply 'vc-do-async-command buffer root git-program command args) 672 (apply 'vc-do-async-command buffer root git-program command args)
673 (with-current-buffer buffer (vc-exec-after '(vc-compilation-mode 'git)))
669 (vc-set-async-update buffer))) 674 (vc-set-async-update buffer)))
670 675
671(defun vc-git-merge-branch () 676(defun vc-git-merge-branch ()
@@ -685,6 +690,7 @@ This prompts for a branch to merge from."
685 nil t))) 690 nil t)))
686 (apply 'vc-do-async-command buffer root vc-git-program "merge" 691 (apply 'vc-do-async-command buffer root vc-git-program "merge"
687 (list merge-source)) 692 (list merge-source))
693 (with-current-buffer buffer (vc-exec-after '(vc-compilation-mode 'git)))
688 (vc-set-async-update buffer))) 694 (vc-set-async-update buffer)))
689 695
690;;; HISTORY FUNCTIONS 696;;; HISTORY FUNCTIONS
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 6dbf6978372..727fb08e388 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -611,6 +611,14 @@ REV is the revision to check out into WORKFILE."
611 (mapcar (lambda (arg) (list "-r" arg)) marked-list))) 611 (mapcar (lambda (arg) (list "-r" arg)) marked-list)))
612 (error "No log entries selected for push")))) 612 (error "No log entries selected for push"))))
613 613
614(defvar vc-hg-error-regexp-alist nil
615 ;; 'hg pull' does not list modified files, so, for now, the only
616 ;; benefit of `vc-compilation-mode' is that one can get rid of
617 ;; *vc-hg* buffer with 'q' or 'z'.
618 ;; TODO: call 'hg incoming' before pull/merge to get the list of
619 ;; modified files
620 "Value of `compilation-error-regexp-alist' in *vc-hg* buffers.")
621
614(defun vc-hg-pull (prompt) 622(defun vc-hg-pull (prompt)
615 "Issue a Mercurial pull command. 623 "Issue a Mercurial pull command.
616If called interactively with a set of marked Log View buffers, 624If called interactively with a set of marked Log View buffers,
@@ -651,6 +659,7 @@ then attempts to update the working directory."
651 args (cddr args))) 659 args (cddr args)))
652 (apply 'vc-do-async-command buffer root hg-program 660 (apply 'vc-do-async-command buffer root hg-program
653 command args) 661 command args)
662 (with-current-buffer buffer (vc-exec-after '(vc-compilation-mode 'hg)))
654 (vc-set-async-update buffer))))) 663 (vc-set-async-update buffer)))))
655 664
656(defun vc-hg-merge-branch () 665(defun vc-hg-merge-branch ()
@@ -659,6 +668,7 @@ This runs the command \"hg merge\"."
659 (let* ((root (vc-hg-root default-directory)) 668 (let* ((root (vc-hg-root default-directory))
660 (buffer (format "*vc-hg : %s*" (expand-file-name root)))) 669 (buffer (format "*vc-hg : %s*" (expand-file-name root))))
661 (apply 'vc-do-async-command buffer root vc-hg-program '("merge")) 670 (apply 'vc-do-async-command buffer root vc-hg-program '("merge"))
671 (with-current-buffer buffer (vc-exec-after '(vc-compilation-mode 'hg)))
662 (vc-set-async-update buffer))) 672 (vc-set-async-update buffer)))
663 673
664;;; Internal functions 674;;; Internal functions