emacs-edbi icon indicating copy to clipboard operation
emacs-edbi copied to clipboard

How configure edbi to stay in the query window?

Open ReneFroger opened this issue 9 years ago • 8 comments

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?

ReneFroger avatar Feb 08 '16 21:02 ReneFroger

@kiwanami are you still there? :smile:

ReneFroger avatar Feb 16 '16 20:02 ReneFroger

@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 avatar Feb 21 '16 02:02 kiwanami

@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.

ReneFroger avatar Feb 21 '16 17:02 ReneFroger

Oh, I see. You are using emacs frames. Now, I'm not able to use the PC, I'll check it later.

kiwanami avatar Feb 22 '16 04:02 kiwanami

Great, would love to hear from you!

ReneFroger avatar Feb 22 '16 20:02 ReneFroger

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.

kiwanami avatar Feb 23 '16 04:02 kiwanami

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.

ReneFroger avatar Feb 23 '16 22:02 ReneFroger

Any update on this?

ReneFroger avatar Mar 12 '16 18:03 ReneFroger