emacs-edbi
emacs-edbi copied to clipboard
How configure edbi to stay in the query window?
I would like to 'tell' EDBI
to stay in the same query window, without switching to the window with the query result.
I tried it with binding C-c C-c in EDBI query window to another function:
(defun edbi-evaluate ()
(interactive)
(edbi:dbview-query-editor-execute-command)
(other-window 1)
)
But it's not working, which I cannot understand. Any other suggestion?
@kiwanami are you still there? :smile:
@ReneFroger I'm sorry for my slow response. Recently, I have little time to spend github...
Well, will you try this command?
(defun my-edbi-evaluate ()
(interactive)
(lexical-let ((buf (current-buffer)))
(edbi:seq
(edbi:dbview-query-editor-execute-command)
(lambda ()
(select-window (get-buffer-window buf))))))
Almost tasks of edbi are working in async manner. So, we need to wait for async task finishing.
deferred.el and edbi.el provide such async framework.
edbi:seq
is convenient macro like do
in Haskell.
@kiwanami thanks for your reply, but unfortunately, It didn't worked out as expected. Note that I use 2 frames. One frame for the EDBI query.And another frame for the EDBI results.
When I call my-edbi-evaluate
in Edbi query editor, the cursor / pointer jumps to the EDBI results in the another frame and stays there, instead staying in the edbi query editor.
Oh, I see. You are using emacs frames. Now, I'm not able to use the PC, I'll check it later.
Great, would love to hear from you!
Will you try this?
(defun my-edbi-evaluate ()
(interactive)
(lexical-let ((fm (selected-frame)))
(edbi:seq
(edbi:dbview-query-editor-execute-command)
(lambda ()
(select-frame-set-input-focus fm)
(other-window 1)
))))
Because edbi:dbview-query-editor-execute-command
uses pop-to-buffer
, window pop-up is not avoidable. Customizing such the window control, we need a new customize mechanism.
Thanks for the explaination, it's appreciated. It's clear now!
Your new functions works only when there are no other windows defined. It will be a problem when there are more windows.
For example, I have a window 1 with buffer filled with the code. And window 2, with the query editor. Both in frame 1. And frame 2, with the EDBI results in the window.
When I call my-edbi-evaluate
from window 2, with the EDBI query editor, the pointer/cursor ends in the window 1 with the code, instead in the window 2.
Any update on this?