-
Notifications
You must be signed in to change notification settings - Fork 6
Allow editing an existing lyric #10
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
base: master
Are you sure you want to change the base?
Conversation
Extract the "pop edit buffer" logic into its own function versuri--pop-edit-buffer and reuse it to implement versuri-add-lyric to type a lyric from scratch. This also requires versuri--pop-edit-buffer and versuri-save-lyric to handle a nil lyric or buffer.
versuri-lyric-edit-meta allows to change the artist and/or song title of an already saved song. It's useful to fix typos introduced with versuri-add-lyric.
Don't delete-lyrics + save-lyric, just to the update in the db.
|
I've also added versuri-lyric-edit-meta to change the author and song title, and did a bit of refactoring of my versuri-lyric-edit-meta function to do directly the Some of this commits could be squashed together if you prefer. Cheers :) P.S.: this time I haven't forgot to update the readme :P P.P.S.: I noticed that the readme don't seem to document the interactive functions, so I haven't documented the lyrics-edit and edit-meta functions, or should I? (no problem, just wondering) |
|
Awesome! Wouldn't it be easier (or more intuitive) to change the If you agree, then maybe you would just need the new interactive function |
I might have not noticed some of them?! |
|
Mihai Olteanu ***@***.***> writes:
Awesome!
I haven't thought about this feature. Looks like a nice addition!
thanks :)
Wouldn't it be easier (or more intuitive) to change the lyrics mode to a non-read-only mode?
That way, you can edit the db lyrics directly from the lyrics buffer. True, you would have to change the keybindings (from r to C-r,
for example).
the rationale was to disallow accidental changes to the lyrics. For
example, I currently have some binding like `n` to forward-line and `p`
to previous line in versuri-mode. True, we could just enable view-mode
instead of read-only-mode and disable that when the user wants to edit
the lyric.
I would imagine editing the first line would mean editing the song artist and song name. Currently, - is used to spit the two visually,
but we can use whatever we like (then you can parse the first line using this char to split the string into artist and song) One
question would need to be answering. If the user edits the artist and/or song that already exists in the db, what happens? Add a new
entry in the db or modify/replace the existing one? Or allow the user to choose between the two?
This was my first thought, but then I thought that there's no reason the
"-" (or even " - ") can't appear on the artist name or song title,
making the recognition more difficult. The edit-meta command was to
avoid this possible ambiguity. (it's a quite extreme case and to be
fair I can't recall from the top of my head an artist with a "-" in the
name.)
This also weighted in favour of the decision to pop-up a new buffer.
If you agree, then maybe you would just need the new interactive function versuri-add-lyric that would just open a normal, but
blank lyrics buffer where the user can add whatever. Maybe add placeholders for where the artist, song name and lyrics would go
in the new buffer,
[artist] - [song]
[lyrics]
I don't have any strong opinion in this, I just forgot to mention those
points in the OP, apologies. I can just easily change the code to allow
editing the original buffer, and for the user to avoid accidental edits
is just as easy as:
(add-hook 'versuri-mode #'view-mode)
which we may even make the default or mention in the documentation.
|
I understand your point.
Yes, I have that too.
Correct! That is a real concern. If we don't know any artist with
It looks to me like the Emacs/Lisp/Unix way is to allow the user to do whatever he likes. You can even change the I'm not 100% convinced of anything yet. Just floating ideas around. :) |
|
Mihai Olteanu ***@***.***> writes:
the rationale was to disallow accidental changes to the lyrics
I understand your point.
First, the user would, somehow, have to not see his accidental changes.
Second, he would have to not know how to undo the buffer.
Third, he would actually have to C-x C-s to change the db, as well. Otherwise, he can answer no when closing an edited buffer.
Worst case, he can re-fetch the lyrics completely new from the web, so nothing is lost for good.
I completely agree, I was over-thinking the interaction.
I currently have some binding like n to forward-line and p to previous line in versuri-mode.
Yes, I have that too.
First, how often do you need to move through the lyrics buffer.
Second, with a non-read-only buffer you will have to fall-back to C-n and C-p like in a regular buffer. Would that be (much) worse
that simply using n and p.
there's no reason the "-" (or even " - ") can't appear on the artist name or song title
Correct! That is a real concern. If we don't know any artist with - in its name, it doesn't mean it doesn't exist. But, we're the
presidents here, we can choose whatever we like :)) |, maybe. Or split the line in two,
[artist]
[song]
[lyrics]
Two lines may be the best solution, only I'd put the song as first line
and the artist as second. We could introduce different faces for the
artist and the song title too!
which we may even make the default or mention in the documentation
It looks to me like the Emacs/Lisp/Unix way is to allow the user to do whatever he likes. You can even change the car to point to
whatever you like, for example. It is not useful, but nobody is stopping you if you have some crazy ideas. So I would favor this
approach. And yes, updating the documentation to let the user know what happens when he opens a lyrics buffer, that he can edit
it, that he can modify it and if he doesn't like that he can disable it, is an excellent idea!
I'm not 100% convinced of anything yet. Just floating ideas around. :)
I really like your take on the idea. Using two lines for the
title/artist and an editable buffer from the start seems to most
powerful way, yet easy to implement and use/understand, to add this
feature.
I've only one doubt in the technical side and that is if we allow the
title to be edited in the lyrics buffer how do we to ensure that the
faces are not messed up. (i.e. the user copies something from the text
into the title and now it has the normal face instead of the title one,
or vice versa.) But we can solve this later when we have a demo of the
new lyrics buffer.
Thanks!
(it'll take me a while to find the time to rework the patch thought,
sorry)
|
From time to time, I'd like to tweak the lyrics fetched from versuri. Maybe it's just a wrong line break, or a typo, or a strange quoting, something like that.
This PR adds a
versuri-lyric-editcommand that pops a buffer intext-modewhere the user can edit the existing buffer. Even better: after save the lyric buffer gets automatically updated :DIt's still a draft, I just noticed that the temporary file used to store the lyric remains and clutters the /tmp.
I'd also like to add a
versuri-add-lyriccommand to manually insert a lyric for those cases where versuri fails to fetch one. (use case: I don't seem to be able to fetch the lyric for "It's the end of the world as we know it (and I feel fine)", but still like to be able to read it using versuri)Cheers