* 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.
This commit is contained in:
Sam Steingold 2012-07-19 10:38:01 -04:00
parent 5db81e3362
commit 8a4e6db81a
5 changed files with 42 additions and 17 deletions

View file

@ -1,3 +1,15 @@
2012-07-19 Sam Steingold <sds@gnu.org>
* 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 <monnier@iro.umontreal.ca>
* emacs-lisp/chart.el: Use lexical-binding.

View file

@ -311,7 +311,7 @@ in the repository root directory of FILE."
(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 @@ prompt for the Bzr command to run."
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 @@ default if it is available."
(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)

View file

@ -386,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

View file

@ -646,6 +646,10 @@ The car of the list is the current branch."
(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 @@ for the Git command to run."
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 @@ This prompts for a branch to merge from."
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

View file

@ -611,6 +611,14 @@ REV is the revision to check out into WORKFILE."
(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 @@ then attempts to update the working directory."
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 @@ This runs the command \"hg merge\"."
(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