Skip to content

Clear the marked playlist when focus is in the playlist list - #1427

Closed
jdholtz wants to merge 1 commit into
cmus:masterfrom
jdholtz:clear-marked-playlist
Closed

jdholtz wants to merge 1 commit into
cmus:masterfrom
jdholtz:clear-marked-playlist

Conversation

@jdholtz

@jdholtz jdholtz commented May 10, 2025 •

Copy link
Copy Markdown
Contributor

Fixes #1423. This PR allows users to clear the marked playlist when focused in the playlist list (left view).

I opted to clear the marked playlist rather than the visible playlist as this has the same functionality as the add command. However, when selected the playlist that is visible will still be cleared. This may be confusing to users though, so I'm up for changing this to always clear the visible playlist (frankly, I think add working on marked playlists instead of visible playlists is confusing).

Implementation notes

Although pl_cursor_in_track_window is currently always false when pl_clear_marked_pl is called, I still kept the condition in there in case it will be used for other situations later and to keep congruence with pl_clear_visible_pl. I can remove this condition if it's deemed unnecessary and just note that pl_cursor_in_track_window is assumed to be false in a comment.

@pgaskin
pgaskin self-requested a review May 11, 2025 16:31
@pgaskin

pgaskin commented Aug 3, 2025

Copy link
Copy Markdown
Member

frankly, I think add working on marked playlists instead of visible playlists is confusing

I generally agree with this too, except for when cmus is automated through cmus-remote.

It might be worth adding a configuration option to keep the marked playlist in sync with the selected one.

@pgaskin pgaskin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be conditional on a flag for the clear command to avoid breaking expectations for automation and to keep it consistent with the other commands. I'm not fully decided though, so I'm open to arguments in the other direction.

@jdholtz

jdholtz commented Aug 8, 2025

Copy link
Copy Markdown
Contributor Author

It might be worth adding a configuration option to keep the marked playlist in sync with the selected one.

Yeah, that makes sense to me. I can look into doing this if it’s desired.

I think this should be conditional on a flag for the clear command to avoid breaking expectations for automation and to keep it consistent with the other commands

Is this in reference to the current changes or the configuration option proposal? If it’s the former, what are expectations for automation that these changes break? If it is the latter, wouldn’t the config option not affect cmus-remote? (I’m not too familiar with how cmus-remote works related to the GUI).

@pgaskin pgaskin mentioned this pull request Jan 10, 2026

@pgaskin pgaskin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's:

  • Make :clear -p clear the marked playlist unconditionally (so -c works properly and matches add -p). Since flag_to_view collapses explicit flags and current view into the same value, view_clear will need to know which case it is in.
  • Make :clear in the playlist view clear the visible (selected) playlist regardless of pane (for #1423, and so it matches win-remove/win-update/pl-rename/pl-export).

Comment thread pl.c
Comment on lines +551 to +552
if (pl_cursor_in_track_window)
pl_win_next();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop this. It's unreachable, and it would be wrong even if it was since pl_win_next only makes sense when the visible playlist was the one emptied.

@pgaskin

pgaskin commented Sep 24, 2026

Copy link
Copy Markdown
Member

expectations for automation that these changes break

Nothing breaks that wasn't already broken, to be precise, but cmus-remote -c FILE sends clear -p then add -p FILE. add -p always targets the marked playlist. clear -p currently targets the visible playlist, and only when the cursor is in the track window. With this PR it targets the visible playlist in the track window and the marked playlist in the left pane. Either way a remote clear -p depends on the currently focused view, resulting in -c behaving unexpectedly.

I'll add the config option I mentioned as a sepearate PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable clearing a playlist when its title is selected (left view), not just when the songs it contains (right view) are selected

2 participants