Ensure that anki-editor-gui-browse opens in foreground

This is accomplished by calling guiBrowse twice. Workaround until
https://github.com/FooSoft/anki-connect/issues/357
is resolved.
This commit is contained in:
orgtre 2022-11-13 13:26:14 +01:00
parent 5982dcef69
commit 42e0121e84

View file

@ -128,6 +128,10 @@ See `anki-editor-insert-note', whose behavior this controls."
Only used when no ANKI_DEFAULT_NOTE_TYPE property is inherited." Only used when no ANKI_DEFAULT_NOTE_TYPE property is inherited."
:type 'string) :type 'string)
(defcustom anki-editor-gui-browse-ensure-foreground t
"Ensure that `anki-editor-gui-browse' opens in foreground."
:type 'boolean)
;;; AnkiConnect ;;; AnkiConnect
@ -1245,7 +1249,9 @@ note or deck."
(_ (format "deck:%s" (_ (format "deck:%s"
(or (org-entry-get-with-inheritance anki-editor-prop-deck) (or (org-entry-get-with-inheritance anki-editor-prop-deck)
"current")))))) "current"))))))
(anki-editor-api-call 'guiBrowse :query (or query ""))) (anki-editor-api-call 'guiBrowse :query (or query ""))
(when anki-editor-gui-browse-ensure-foreground
(anki-editor-api-call 'guiBrowse :query (or query ""))))
(defun anki-editor-gui-add-cards () (defun anki-editor-gui-add-cards ()
"Open Anki Add Cards dialog with presets from current note entry." "Open Anki Add Cards dialog with presets from current note entry."