Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@ def translate_text(text):
def input_message(buffer_id, message, callback_tag, input_type, input_content):
eval_in_emacs('eaf--input-message', [buffer_id, message, callback_tag, input_type, input_content])

def focus_emacs_buffer(message):
eval_in_emacs('eaf-focus-buffer', [message])
def focus_emacs_buffer(buffer_id):
eval_in_emacs('eaf-focus-buffer', [buffer_id])

def atomic_edit(buffer_id, focus_text):
eval_in_emacs('eaf--atomic-edit', [buffer_id, focus_text])
Expand Down
27 changes: 10 additions & 17 deletions eaf.el
Original file line number Diff line number Diff line change
Expand Up @@ -1081,16 +1081,6 @@ of `eaf--buffer-app-name' inside the EAF buffer."
(symbol-name command)
`(quote ,command))))

(defun eaf-focus-buffer (focus-buffer-id)
"Focus the buffer given the FOCUS-BUFFER-ID."
(catch 'found-eaf
(eaf-for-each-eaf-buffer
(when (string= eaf--buffer-id focus-buffer-id)
(let ((buffer-window (get-buffer-window buffer 'visible)))
(when buffer-window
(select-window buffer-window)))
(throw 'found-eaf t)))))

(defun eaf-get-buffer (buffer-id)
"Find the buffer given the BUFFER-ID."
(catch 'found-eaf
Expand All @@ -1099,6 +1089,12 @@ of `eaf--buffer-app-name' inside the EAF buffer."
(throw 'found-eaf buffer))
nil)))

(defun eaf-focus-buffer (buffer-id)
"Focus the buffer given the BUFFER-ID."
(let* ((buffer (eaf-get-buffer buffer-id))
(window (if buffer (get-buffer-window buffer 'visible) nil)))
(when window (select-window window) t)))

(defun eaf--show-message (format-string)
"A wrapper around `message' that prepend [EAF/app-name] before FORMAT-STRING."
(let ((fmt (if eaf--buffer-app-name
Expand All @@ -1123,13 +1119,10 @@ and does not log to the *Message* buffer."
"Set Lisp variable NAME with VALUE on the Emacs side."
(set (intern name) value))

(defun eaf-request-kill-buffer (kill-buffer-id)
"Function for requesting to kill the given buffer with KILL-BUFFER-ID."
(catch 'found-eaf
(eaf-for-each-eaf-buffer
(when (string= eaf--buffer-id kill-buffer-id)
(kill-buffer buffer)
(throw 'found-eaf t)))))
(defun eaf-request-kill-buffer (buffer-id)
"Function for requesting to kill the given buffer with BUFFER-ID."
(let* ((buffer (eaf-get-buffer buffer-id)))
(when buffer (kill-buffer buffer) t)))

(defun eaf--first-start (eaf-epc-port)
"Call `eaf--open-internal' upon receiving `start_finish' signal from server.
Expand Down