Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add transient interface #13

Open
orgtre opened this issue Nov 13, 2022 · 8 comments
Open

Add transient interface #13

orgtre opened this issue Nov 13, 2022 · 8 comments

Comments

@orgtre
Copy link
Member

orgtre commented Nov 13, 2022

I'm working on a transient user interface to anki-editor and am opening this issue to collect feedback and suggestions. It would resolve issues like louietan/anki-editor#79 and beyond. An alternative would be a hydra, but I am already familiar with transient and think it is more flexible.

orgtre added a commit that referenced this issue Nov 13, 2022
Resolves louietan/anki-editor#79 and allows local binding of,
for example, the transient interface (#13).
orgtre added a commit that referenced this issue Nov 13, 2022
Create a transient user interface for all anki-editor commands.
See #13 for discussion.
@orgtre
Copy link
Member Author

orgtre commented Nov 13, 2022

Okay, the first version of the transient is out. Feel free to give it a try and come with suggestions for how the anki-editor workflow can be made more smooth. @cmirdesouza @doolio

The transient is in a separate module. In my setup with straight.el I load it like this:

(use-package anki-editor-ui
  :defer t
  :after anki-editor
  :straight (:host github :repo "louietan/anki-editor" :fork "orgtre")
  :bind (:map anki-editor-mode-map
	 ("C-c e" . anki-editor-ui)))

@cmirdesouza
Copy link
Contributor

cmirdesouza commented Nov 14, 2022

I really liked the idea, i was thinking on how the org-agenda works and i didn't think about magit, but it seems like a wonderful feature for better user experience.
Another possible feature could be a special buffer like magit (it opens a buffer with all commits, stage, etc) with a sparse tree of all anki notes on that buffer.
Im going to give it a test.
After doing some tests on Doom Emacs it seems to not been a popup or a window. The problem seems to be that any keyboard input goes to the anki-editor-ui when I focus on them, this makes it impossible to write on the mini buffer after selecting an option.
Per example when creating a new note and asked about Note Heading or when asked about the type of note.
Anyone has the same problem?

@orgtre
Copy link
Member Author

orgtre commented Nov 18, 2022

@cmirdesouza Thanks for testing! Indeed I see the same issue appearing randomly also without Doom, but very rarely and I fail to find a way to reliably reproduce it. The problem seems to be that when a command called by the transient user interface immediately calls a completing-read prompt (or some other function requesting user input?), sometimes the transient keybindings are still in effect (which they shouldn't be), and when you then type one of them, the transient interface pops up again. When this happens the transient interface eats all the keypresses and it is impossible to input anything into the mini buffer prompt or to get it to disappear. Does this description fit with what you're experiencing?

We could work around this by passing all the user input using the transient user interface (or maybe by introducing a delay?), but this would be awkward in this setting and we shouldn't have to. As the anki-editor-ui code is very basic and I don't see anything that might be wrong, I'd guess this is an issue with transient.el or something deeper down in Emacs. If we'd find a reliable way to reproduce this problem we could open an issue further down somewhere.

@doolio
Copy link

doolio commented Mar 20, 2023

This is a great addition, thank you. Curious why you kept in separate from the main file?

One thing I've noticed when using this UI is that the :ANKI_FAILURE_REASON: property remains when successfully pushing a previously failed card. It is removed when pushing such a note not via this UI.

(I'm starting to use this more now so I'll report any other issues I encounter as and when they arise.)

@orgtre
Copy link
Member Author

orgtre commented Mar 25, 2023

Thanks for testing this and reporting issues!

I'll try to resolve the issue with :ANKI_FAILURE_REASON:. If there are issues with transient which we can't resolve we might considering testing a hydra instead.

I kept it separate to not force transient as a dependency for anki-editor. The transient package is quite big (4000+ lines) so one wouldn't want to load it unless necessary. Also, this seems to be almost standard practice for Emacs packages.

@doolio
Copy link

doolio commented Mar 27, 2023

I kept it separate to not force transient as a dependency for anki-editor. The transient package is quite big (4000+ lines) so one wouldn't want to load it unless necessary. Also, this seems to be almost standard practice for Emacs packages.

That's fair. Though isn't transient a part of Emacs now or maybe just GNU ELPA.

@doolio
Copy link

doolio commented Mar 29, 2023

The UI allows one to delete a note but does so only in Anki. Perhaps, an option to delete in Anki and the Org file should be included?

@orgtre
Copy link
Member Author

orgtre commented Mar 30, 2023

Yes, this option is already there actually: With a universal prefix argument (C-u) anki-editor-delete-note-at-point will also delete the note from the Org file. This is in the commands docstring but not indicated in the transient interface. I think having at least some indicator in the transient of which commands take interactive arguments, for example like I did here, would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants