From 42e0121e84cf9d4b896bd2bdf704bd8abf70bf8b Mon Sep 17 00:00:00 2001 From: orgtre Date: Sun, 13 Nov 2022 13:26:14 +0100 Subject: [PATCH] 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. --- anki-editor.el | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/anki-editor.el b/anki-editor.el index fdb28a5..6f06b21 100644 --- a/anki-editor.el +++ b/anki-editor.el @@ -128,6 +128,10 @@ See `anki-editor-insert-note', whose behavior this controls." Only used when no ANKI_DEFAULT_NOTE_TYPE property is inherited." :type 'string) +(defcustom anki-editor-gui-browse-ensure-foreground t + "Ensure that `anki-editor-gui-browse' opens in foreground." + :type 'boolean) + ;;; AnkiConnect @@ -1245,7 +1249,9 @@ note or deck." (_ (format "deck:%s" (or (org-entry-get-with-inheritance anki-editor-prop-deck) "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 () "Open Anki Add Cards dialog with presets from current note entry."