Discussion:
[emms-help] [patch] better kill-track
Rasmus
2014-10-25 12:10:21 UTC
Permalink
Hi,

If I don't do C-a C-k I will not kill the entire line in *EMMS
Playlist*. This is nonsense.

Also, I often have to do C-k C-k since an empty line remains. This
patch fixes both of these issue and makes C-k in *EMMS Playlist* more
pleasant IMO.

The patch should apply against master.

Thanks,
Rasmus
--
Need more coffee. . .
Yoni Rabkin
2014-10-25 15:43:56 UTC
Permalink
Post by Rasmus
If I don't do C-a C-k I will not kill the entire line in *EMMS
Playlist*. This is nonsense.
Also, I often have to do C-k C-k since an empty line remains. This
patch fixes both of these issue and makes C-k in *EMMS Playlist* more
pleasant IMO.
The patch should apply against master.
I've always viewed it as a feature since C-k killing in an Emms playlist
buffer behaved exactly like it did everywhere else in Emacs; uniformity
and the principle of least surprise.

This means that you can kill a line from the playlist and then
immediately yank a different line into that space from the kill-ring
with the exact same muscle memory that works everywhere else.

But recognizing that people sometime want to just remove the track,
there has always been the "D" binding in the playlist buffer, aka
`emms-playlist-mode-kill-entire-track'. Does it do what you want?
--
"Cut your own wood and it will warm you twice"
Rasmus
2014-10-25 19:21:34 UTC
Permalink
Hi,

Thanks for the quick reply.
Post by Yoni Rabkin
Post by Rasmus
If I don't do C-a C-k I will not kill the entire line in *EMMS
Playlist*. This is nonsense.
Also, I often have to do C-k C-k since an empty line remains. This
patch fixes both of these issue and makes C-k in *EMMS Playlist* more
pleasant IMO.
The patch should apply against master.
I've always viewed it as a feature since C-k killing in an Emms playlist
buffer behaved exactly like it did everywhere else in Emacs; uniformity
and the principle of least surprise.
I see. I don't know if we have the same expectation of "least
surprise" in a media program, but that's fine. In my mind, the
playlist is more like a Gnus summary buffer, where I don't care about
the position within a line, but only which line I'm 'cause one line
represents one entry.
Post by Yoni Rabkin
This means that you can kill a line from the playlist and then
immediately yank a different line into that space from the kill-ring
with the exact same muscle memory that works everywhere else.
Should I be able to do C-a C-k in my library and C-y it into my
playlist and expect it to play? A quick test suggest that this does
not work (the line is added but the track is skipped). It would be
pretty neat, though.
Post by Yoni Rabkin
But recognizing that people sometime want to just remove the track,
there has always been the "D" binding in the playlist buffer, aka
`emms-playlist-mode-kill-entire-track'. Does it do what you want?
No. Unless I'm at BOL it acts like C-k. If at BOL it works as if
kill-whole-line is t. In the patch C-k works like D at BOL
everywhere.

—Rasmus
--
A clever person solves a problem. A wise person avoids it
Yoni Rabkin
2014-10-25 21:11:25 UTC
Permalink
Post by Rasmus
Hi,
Thanks for the quick reply.
Post by Yoni Rabkin
Post by Rasmus
If I don't do C-a C-k I will not kill the entire line in *EMMS
Playlist*. This is nonsense.
Also, I often have to do C-k C-k since an empty line remains. This
patch fixes both of these issue and makes C-k in *EMMS Playlist* more
pleasant IMO.
The patch should apply against master.
I've always viewed it as a feature since C-k killing in an Emms playlist
buffer behaved exactly like it did everywhere else in Emacs; uniformity
and the principle of least surprise.
I see. I don't know if we have the same expectation of "least
surprise" in a media program, but that's fine. In my mind, the
playlist is more like a Gnus summary buffer, where I don't care about
the position within a line, but only which line I'm 'cause one line
represents one entry.
C-k in a playlist buffer should indeed go to the beginning of a line and
then kill it. But I think it shouldn't kill-whole-line by default.
Post by Rasmus
Post by Yoni Rabkin
This means that you can kill a line from the playlist and then
immediately yank a different line into that space from the kill-ring
with the exact same muscle memory that works everywhere else.
Should I be able to do C-a C-k in my library and C-y it into my
playlist and expect it to play? A quick test suggest that this does
not work (the line is added but the track is skipped). It would be
pretty neat, though.
That's interesting, because that definitely works on my machine. Can you
post a recipe?

Here is mine. If I start with this in the playlist buffer and point at
0:

The English Concert - J.S. Bach: Brandenburg Concerto No.1 in F...1
The English Concert - J.S. Bach: Brandenburg Concerto No.1 in F...2
The English Concert - J.S. Bach: Brandenburg Concerto No.1 in F...3
Dame Joan Sutherland/Helen Watts/Wilfred Brown/Thomas Hemsley/G...4
Dame Joan Sutherland/Helen Watts/Wilfred Brown/Thomas Hemsley/G...5
Dame Joan Sutherland/Helen Watts/Wilfred Brown/Thomas Hemsley/G...6

I can switch between track 2 and 5 with:

(setq last-kbd-macro
"\C-n\C-k\C-n\C-n\C-n\C-k\C-p\C-p\C-p\C-y\C-a\C-n\C-n\C-n\C-y\371\C-a")

This is exactly how it would work in any text buffer too.
Post by Rasmus
Post by Yoni Rabkin
But recognizing that people sometime want to just remove the track,
there has always been the "D" binding in the playlist buffer, aka
`emms-playlist-mode-kill-entire-track'. Does it do what you want?
No. Unless I'm at BOL it acts like C-k. If at BOL it works as if
kill-whole-line is t. In the patch C-k works like D at BOL
everywhere.
D should be changed to work exactly like your patch.
--
"Cut your own wood and it will warm you twice"
Michael Olson
2014-10-25 21:20:38 UTC
Permalink
FWIW, I'd recommend changing default behavior to make C-k act exactly like
it's proposed D act. I don't see a reasonable use-case for making it kill
less than the entire line, including trailing newline, unless we had a
concept of a mixed track-and-text buffer, which I don't believe anyone
would actually use.
Post by Yoni Rabkin
Post by Rasmus
Hi,
Thanks for the quick reply.
Post by Yoni Rabkin
Post by Rasmus
If I don't do C-a C-k I will not kill the entire line in *EMMS
Playlist*. This is nonsense.
Also, I often have to do C-k C-k since an empty line remains. This
patch fixes both of these issue and makes C-k in *EMMS Playlist* more
pleasant IMO.
The patch should apply against master.
I've always viewed it as a feature since C-k killing in an Emms playlist
buffer behaved exactly like it did everywhere else in Emacs; uniformity
and the principle of least surprise.
I see. I don't know if we have the same expectation of "least
surprise" in a media program, but that's fine. In my mind, the
playlist is more like a Gnus summary buffer, where I don't care about
the position within a line, but only which line I'm 'cause one line
represents one entry.
C-k in a playlist buffer should indeed go to the beginning of a line and
then kill it. But I think it shouldn't kill-whole-line by default.
Post by Rasmus
Post by Yoni Rabkin
This means that you can kill a line from the playlist and then
immediately yank a different line into that space from the kill-ring
with the exact same muscle memory that works everywhere else.
Should I be able to do C-a C-k in my library and C-y it into my
playlist and expect it to play? A quick test suggest that this does
not work (the line is added but the track is skipped). It would be
pretty neat, though.
That's interesting, because that definitely works on my machine. Can you
post a recipe?
Here is mine. If I start with this in the playlist buffer and point at
The English Concert - J.S. Bach: Brandenburg Concerto No.1 in F...1
The English Concert - J.S. Bach: Brandenburg Concerto No.1 in F...2
The English Concert - J.S. Bach: Brandenburg Concerto No.1 in F...3
Dame Joan Sutherland/Helen Watts/Wilfred Brown/Thomas Hemsley/G...4
Dame Joan Sutherland/Helen Watts/Wilfred Brown/Thomas Hemsley/G...5
Dame Joan Sutherland/Helen Watts/Wilfred Brown/Thomas Hemsley/G...6
(setq last-kbd-macro
"\C-n\C-k\C-n\C-n\C-n\C-k\C-p\C-p\C-p\C-y\C-a\C-n\C-n\C-n\C-y\371\C-a")
This is exactly how it would work in any text buffer too.
Post by Rasmus
Post by Yoni Rabkin
But recognizing that people sometime want to just remove the track,
there has always been the "D" binding in the playlist buffer, aka
`emms-playlist-mode-kill-entire-track'. Does it do what you want?
No. Unless I'm at BOL it acts like C-k. If at BOL it works as if
kill-whole-line is t. In the patch C-k works like D at BOL
everywhere.
D should be changed to work exactly like your patch.
--
"Cut your own wood and it will warm you twice"
_______________________________________________
Emms-help mailing list
https://lists.gnu.org/mailman/listinfo/emms-help
Yoni Rabkin
2014-10-26 00:23:07 UTC
Permalink
Since more than one person took the trouble to write in and explain why
this behavior should change, I went ahead and made the change to the
behavior of C-k as Rasmus described it. I didn't use Rasmus' patch, but
made a functionally equivallent change.

But I added a variable (set by default to Rasmus' way) which permits me
to retain the old way of doing it, which I still personally prefer. So
if anyone else is bugged by this new behavior, just do:

(setq emms-playlist-mode-kill-whole-line-p nil)
--
"Cut your own wood and it will warm you twice"
Rasmus
2014-10-26 01:11:49 UTC
Permalink
Hi,
Post by Yoni Rabkin
Since more than one person took the trouble to write in and explain why
this behavior should change, I went ahead and made the change to the
behavior of C-k as Rasmus described it. I didn't use Rasmus' patch, but
made a functionally equivallent change.
Cool!

I won't claim to understand all of the overlay stuff in your commit,
but it looks good.
Post by Yoni Rabkin
But I added a variable (set by default to Rasmus' way) which permits me
to retain the old way of doing it, which I still personally prefer. So
Thanks.

—Rasmus
--
The second rule of Fight Club is: You do not talk about Fight Club
Loading...