From 14f088ba26459f2bb941cd4d376317393a7a65bd Mon Sep 17 00:00:00 2001 From: Andy Stewart Date: Sat, 28 Sep 2019 07:24:30 +0800 Subject: [PATCH] Make EAF support watch-other-window.el --- eaf.el | 19 +++++++++++++++++++ eaf.py | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/eaf.el b/eaf.el index 87fd4fb..88e8364 100644 --- a/eaf.el +++ b/eaf.el @@ -811,6 +811,25 @@ Other files will open normally with `dired-find-file' or `dired-find-alternate-f (other-window -1) ad-do-it)) +(defadvice watch-other-window-internal (around eaf-watch-other-window activate) + "When next buffer is `eaf-mode', do `eaf-watch-other-window'." + (other-window +1) + (if (eq major-mode 'eaf-mode) + (let ((direction (ad-get-arg 0)) + (line (ad-get-arg 1))) + (if (string-equal direction "up") + (if (null line) + (eaf-call "scroll_buffer" (eaf-get-view-info) "up" "page") + (eaf-call "scroll_buffer" (eaf-get-view-info) "up" "line") + ) + (if (null line) + (eaf-call "scroll_buffer" (eaf-get-view-info) "down" "page") + (eaf-call "scroll_buffer" (eaf-get-view-info) "down" "line") + )) + (other-window -1)) + (other-window -1) + ad-do-it)) + (provide 'eaf) ;;; eaf.el ends here diff --git a/eaf.py b/eaf.py index d34eb35..d52bb36 100755 --- a/eaf.py +++ b/eaf.py @@ -81,7 +81,7 @@ class EAF(dbus.service.Object): @dbus.service.method(EAF_DBUS_NAME, in_signature="sss", out_signature="") def scroll_buffer(self, view_info, scroll_direction, scroll_type): - (buffer_id, _, _, _, _, _) = view_info.split(":") + (buffer_id, _, _, _, _) = view_info.split(":") if buffer_id in self.buffer_dict: self.buffer_dict[buffer_id].scroll(scroll_direction, scroll_type)