branch: externals/vc-hgcmd
commit 5416977d9cfd1257f721e554330e54c1142bc949
Author: muffinmad <andreyk....@gmail.com>
Commit: muffinmad <andreyk....@gmail.com>

    command callback must be called in output buffer
---
 vc-hgcmd.el | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/vc-hgcmd.el b/vc-hgcmd.el
index e7f05ef..7518fc6 100644
--- a/vc-hgcmd.el
+++ b/vc-hgcmd.el
@@ -5,7 +5,7 @@
 ;; Author: Andrii Kolomoiets <andreyk....@gmail.com>
 ;; Keywords: vc
 ;; URL: https://github.com/muffinmad/emacs-vc-hgcmd
-;; Package-Version: 1.3.5
+;; Package-Version: 1.3.6
 ;; Package-Requires: ((emacs "25.1"))
 
 ;; This file is NOT part of GNU Emacs.
@@ -224,10 +224,12 @@ Insert output to process buffer and check if amount of 
data is enought to parse
                           ((eq channel ?r)
                            (setf (vc-hgcmd--command-result-code 
current-command) (bindat-get-field (bindat-unpack `((f u32)) data) 'f))
                            (setq vc-hgcmd--current-command nil)
-                           (let ((callback (vc-hgcmd--command-callback 
current-command))
+                           (let ((output-buffer 
(vc-hgcmd--command-output-buffer current-command))
+                                 (callback (vc-hgcmd--command-callback 
current-command))
                                  (args (vc-hgcmd--command-callback-args 
current-command)))
-                             (when callback
-                               (if args (funcall callback args) (funcall 
callback)))))
+                             (when (and callback (or (stringp output-buffer) 
(buffer-live-p output-buffer)))
+                               (with-current-buffer output-buffer
+                                 (if args (funcall callback args) (funcall 
callback))))))
                           ;; TODO: cmdserver clients must handle I and L 
channels
                           (t (error (format "unknown channel %c" channel)))))
                   t))))))))

Reply via email to