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

There should be "upsert" functionality #94

Open
maw opened this issue Dec 2, 2020 · 5 comments
Open

There should be "upsert" functionality #94

maw opened this issue Dec 2, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@maw
Copy link
Contributor

maw commented Dec 2, 2020

There should be a way to edit a note that already exists or to create a new one in one go.

I wrote a function that does this. I'll submit a PR in a few minutes.

maw added a commit to maw/zetteldeft that referenced this issue Dec 2, 2020
maw added a commit to maw/zetteldeft that referenced this issue Dec 2, 2020
maw added a commit to maw/zetteldeft that referenced this issue Dec 2, 2020
@EFLS
Copy link
Owner

EFLS commented Dec 2, 2020

There should be a way to edit a note that already exists or to create a new one in one go.

Can you explain a bit more what the functionality is you aim for?

Is this similar to searching via Deft and -- when no notes are found -- creating a new note with return? (Or something similar, I don't use it.)

@EFLS EFLS added the enhancement New feature or request label Dec 2, 2020
@maw
Copy link
Contributor Author

maw commented Dec 3, 2020

Argh, I had no idea that that existed. AFAICT it's just like you said. But I think it's nicer to use.

I just implemented zetteldeft-upsert-and-link and zetteldeft-upsert-and-backlink. These might be more compelling; they're analogous to zetteldeft-new-file-and-link and zetteldeft-new-file-and-backlink, respectively.

@EFLS
Copy link
Owner

EFLS commented Dec 30, 2020

I'm still a bit in doubt whether this should be included as default Zetteldeft behaviour. Not that I don't think it is useful, but I think the use case is very specific. Can you perhaps explain a bit more how they fit in your workflow? For exapmle with -upsert-and-link. So you are typing a note, looking for one that you want to link to, notice it doesn't exist yet, and then immediately create one and link to it? Isn't this the same as -new-file-and-link? Or am I missing something?

@maw
Copy link
Contributor Author

maw commented Jan 24, 2021

Hi, I'm sorry for taking so long to respond.

Contrary to what I posted earlier, I don't think you can do what my upsert functions do as conveniently from *Deft*. In the deft buffer, if you type a substring of a file that exists and then hit RET, it opens the first match; you need to hit C-c C-n (deft-new-file) to create a new file. This gets the job done, of course, but I think it's clunky.

I use my upsert functions most when I'm working on a note, I think of something tangentially related that I don't want to forget - but I also don't want to lose my train of thought in the current note. I find having fewer steps to create a stub note to be very helpful.

In fact, I don't even run my upsert function directly that often. Instead, I use this little wrapper function (that I definitely don't expect you to accept!):

(defun mw-zetteldeft-new-file-and-link (str)
  (interactive (list (read-string "Note title: ")))
  (progn (split-window)
         (zetteldeft-upsert-and-link str)
         (end-of-buffer)))

Anyway. If you don't want to give these functions bindings, that's fine. If, even once their problems are worked out, you don't want to include them at all, that's fine too—I have no problem maintaining them for my own use. But they've made my experience using zetteldeft much more pleasant and so I thought other people might feel the same way.

@EFLS
Copy link
Owner

EFLS commented Feb 5, 2021

Thanks for the additional info. I'll try to explore such a feature by using it, hopefully soon!

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

No branches or pull requests

2 participants