Closed qingshuizheng closed 10 months ago
Interesting, thank you for contributing! Having a way to clean up after saving a draft is nice. One thing I'm wondering is whether aborted notes should go to the trash or simply be deleted. To me, a trashed note is a note that was once good, but is no longer needed. An aborted note doesn't seem to rise to that level. What do you think?
An aborted note doesn't seem to rise to that level.
I think you are right, I would change the code to adapt to this idea.
Also, I add a new local variable ekg-kill-buffer-query-function
, which adapted from builtin kill-buffer-query-function
, for user to decide whether to save the note on buffer kill.
edit: reword.
I'll need to make some adjustment to kill-buffer-query-function
to adapt it to ekg-capture-abort
, convert this pr to drafts for the moment.
Update: adjustments done.
Update 2: let me know if you see this pr is okay for ekg, and you'd like me to squash them into one.
Update 3: forced-push a fix for wrongly usage of "delq"; kill-emacs-query-functions
-> kill-buffer-query-functions
Pushed two new commits:
ekg-buffer-kill-query-function
, which leads to buffer not killed after save.ekg-save-action-on-buffer-kill
.Thank you for all the changes so far. We're close! Maybe all the way there, but I want to continue to think about making things even clearer. I'm not sure, though, so please be patient as I continue to think through this.
Ahh no worry at all.
I planned to place this on discussion
section. But since I have these changes in my personal branch, I think I could make a PR here, so that you could play with it, then decide whether you like it or not.
Thanks for bearing with me - this looks good. I want to make a few changes and test this out, but this will be nice to have for the next release. Thanks again for your effort in putting this together.
Thanks for the review and merge. Feel free to make any changes to fit the repo.
Why this commit:
I personally want to have an abort function, so that I could decide where the note should go. Even the note has been auto-saved as draft by
ekg-auto-save-mode
(my personal branch), withekg-capture-abort
, the note still could go to trash. Or when I edit a note but later I decide not to save it at all,ekg-edit-abort
could abort all the edits.Changes in this commit:
In
ekg-edit-mode
: abort edit -> restore note to its original state. (Except for modification time:ekg-save-note
recalculates it finally. Q: Any function to compare the new note vs the note in db: if value are the same, don't update the modification time?)In
ekg-capture-mode
: abort capture -> trashing the note.Clean up some whitespaces and bad indentations around the edits.
This commit also address https://github.com/ahyatt/ekg/pull/19 :