diff options
author | Thanos Apollo <[email protected]> | 2024-03-03 02:02:05 +0200 |
---|---|---|
committer | Thanos Apollo <[email protected]> | 2024-03-03 02:04:07 +0200 |
commit | 40929155bff9276a8edf3dbe3fd0bb473f7a7b65 (patch) | |
tree | a448afd7b91bc686de2dffa23a5088e75abdbf61 /gnosis.el | |
parent | 8b753f9a24fb90e94ff51b7073be6978424ef8c8 (diff) |
gnosis-edit-save-exit: Refactor
Add function as argument to be used as exit func. This will make it
easier to reuse with other funcs
Diffstat (limited to 'gnosis.el')
-rw-r--r-- | gnosis.el | 17 |
1 files changed, 9 insertions, 8 deletions
@@ -1217,15 +1217,16 @@ changes." ":tags" ":extra-notes" ":image" ":second-image" ":ef" ":ff" ":suspend")) -(defun gnosis-edit-save-exit () - "Save edits and exit." +(cl-defun gnosis-edit-save-exit (&optional deck-edit (exit-func 'exit-recursive-edit) &rest args) + "Save edits and exit. + +If not DECK-EDIT and not in a recursive-edit, pop back +gnosis-dashboard." (interactive) - (eval-buffer) - (quit-window t) - ;; exit recursive edit if we are in one - (if (>= (recursion-depth) 1) - (exit-recursive-edit) - (gnosis-dashboard))) + (let ((deck-edit (or deck-edit nil))) + (eval-buffer) + (quit-window t) + (apply exit-func args))) (defvar-keymap gnosis-edit-mode-map :doc "gnosis-edit keymap" |