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.
+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.
(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)
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 ()
(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)
(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
(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
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 ()
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
(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,
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 ()
(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