diff options
author | Thanos Apollo <[email protected]> | 2024-03-03 02:21:50 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-03-03 02:21:50 +0200 |
commit | 4ef9ce6064a3c73144956c2acc25164db155c298 (patch) | |
tree | 5b948348c3901344995ac027d4bfd6968a58f6be | |
parent | 6e576af9a0b4edca1dbd38fd22b3553b15fb727b (diff) |
Add gnosis-edit-deck
Edit contents of a deck with a given ID. This function is meant to be
used from within a *gnosis-dashboard* buffer. Uses custom kbd via
local-set-key, since gnosis-dashboard mode is also used by
gnosis-edit-notes, this is viable alternative, if you have any other
recommendations feel free to email them to me
-rw-r--r-- | gnosis.el | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -1269,6 +1269,23 @@ Insert deck values `ef-increase', `ef-decrease', `ef-threshold', `failure-factor when value do (gnosis-update 'decks `(= ,field ,value) `(= id ,id)))) +(defun gnosis-edit-deck (&optional id) + "Edit the contents of a deck with the given ID." + (interactive "P") + (let ((id (or id (gnosis--get-deck-id)))) + (pop-to-buffer-same-window (get-buffer-create "*gnosis-edit*")) + (gnosis-edit-mode) + (erase-buffer) + (insert ";;\n;; You are editing a gnosis deck.\n\n") + (insert "(gnosis-edit-update-deck ") + (gnosis-edit-deck--export id) + (insert ")") + (insert "\n\n;; After finishing editing, save changes with `<C-c> <C-c>'\n;; Avoid exiting without saving.") + (indent-region (point-min) (point-max)) + (gnosis-edit-read-only-values (format ":id %s" id) ":name" ":ef-increase" + ":ef-decrease" ":ef-threshold" ":failure-factor") + (local-unset-key (kbd "C-c C-c")) + (local-set-key (kbd "C-c C-c") (lambda () (interactive) (gnosis-edit-save-exit t 'gnosis-dashboard "Decks"))))) (cl-defun gnosis-edit-save-exit (&optional deck-edit (exit-func 'exit-recursive-edit) &rest args) "Save edits and exit. |