summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThanos Apollo <[email protected]>2024-06-16 20:33:21 +0300
committerThanos Apollo <[email protected]>2024-06-16 20:33:21 +0300
commit8b24e05f6f02cad2063673271f199b268406a408 (patch)
tree64e9fb9df555257d02e3cbc8e4beeeed876c2824
parent9b0415cf7590d0185d76fc99f454b4069e77b83a (diff)
[fix] gnosis-edit-save-exit: Adjust for existing *gnosis-edit* buffers
This should allow to call gnosis-edit-save-exit at the start of gnosis-edit-* functions. If a user had forgotten to save previous changes this would have caused an error before.
-rw-r--r--gnosis.el10
1 files changed, 6 insertions, 4 deletions
diff --git a/gnosis.el b/gnosis.el
index 48aa652..6394b03 100644
--- a/gnosis.el
+++ b/gnosis.el
@@ -1539,10 +1539,12 @@ INITIAL-INTERVAL: Initial interval for notes of deck"
(cl-defun gnosis-edit-save-exit (&optional exit-func &rest args)
"Save edits and exit using EXIT-FUNC, with ARGS."
(interactive)
- (eval-buffer)
- (quit-window t)
- (when exit-func
- (apply exit-func args)))
+ (when (get-buffer "*gnosis-edit*")
+ (switch-to-buffer "*gnosis-edit*")
+ (eval-buffer)
+ (quit-window t)
+ (when exit-func
+ (apply exit-func args))))
(defvar-keymap gnosis-edit-mode-map
:doc "gnosis-edit keymap"