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

Generalizes sorting of perspectives and adds sort-by-creation-time. #87

Merged
merged 2 commits into from
Sep 15, 2019

Conversation

zenspider
Copy link
Collaborator

This is valuable to me because I often use perspectives during yak
shaves and other multi-project tasks where I need to "push" and "pop"
things to work on. By sorting by persp-time-created, this simulates
that perfectly:

  • While working on a task, find a tangent I need to go off on.
  • Create a new perspective.
  • Work on tangent. Possibly going back and forth between multiple perspectives.
  • When done with tangent, kill the perspective, going back to next-most-recent.

This switches from persp-sort-chronologically (bool) to
persp-sort (symbol). There might be some smoother way to honor the
old value and auto-convert to the new variable, but I don't know how.

This also adds created-time to the perspective struct. Loading this
code in your current emacs breaks everything. I don't know if it is
possible to migrate existing structs or otherwise patch this code to
work with old structs. Restarting emacs seems fine but I'm open to
suggestion.

This is valuable to me because I often use perspectives during yak
shaves and other multi-project tasks where I need to "push" and "pop"
things to work on. By sorting by persp-time-created, this simulates
that perfectly:

+ While working on a task, find a tangent I need to go off on.
+ Create a new perspective.
+ Work on tangent. Possibly going back and forth between multiple perspectives.
+ When done with tangent, kill the perspective, going back to next-most-recent.

This switches from `persp-sort-chronologically` (bool) to
`persp-sort` (symbol). There might be some smoother way to honor the
old value and auto-convert to the new variable, but I don't know how.

This also adds `created-time` to the perspective struct. Loading this
code in your current emacs breaks everything. I don't know if it is
possible to migrate existing structs or otherwise patch this code to
work with old structs. Restarting emacs seems fine but I'm open to
suggestion.
@zenspider zenspider self-assigned this Sep 4, 2019
@zenspider zenspider requested a review from gcv September 4, 2019 19:33
@zenspider
Copy link
Collaborator Author

I'm not thrilled with the way persp-find-some works when you're killing off perspectives and probably need to extend it for this change, but it's not really related to this change so much as it needs some more generalizations added to it.

The gist: Let's say you're using this mode to do a yak shave and you have several perspectives pushed on the stack. You finish up some of them and start to kill the perspectives. The first time, it uses persp-last to switch to the last one you were on. That seems fine. But after that, persp-last is nil and it goes to (car (persp-names)) instead. That doesn't really match the workflow for this mode and should be something a bit smarter (newest, or persp-last should maintain a stack, or something).

Copy link
Collaborator

@gcv gcv left a comment

Choose a reason for hiding this comment

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

This is nice. I updated #80 to respect perspective order on save and restore.

I'm not too concerned about breaking existing Emacs sessions when this update loads. Elisp doesn't support update-instance-for-redefined-class, so there isn't much we can reasonably do.

In the future, we can just recommend that people use persp-state-save before upgrading perspective-el.

@zenspider
Copy link
Collaborator Author

In the future, we can just recommend that people use persp-state-save before upgrading perspective-el.

does that have some sort of migration strategy or is it just flexible enough that it just fills in the blanks for fields that aren't there?

@zenspider
Copy link
Collaborator Author

zenspider commented Sep 15, 2019

Merging... Actually... no. I prefer rebase merges. I'll start a dialog in our #92 discussion.

@zenspider
Copy link
Collaborator Author

fuck it. 😛

@zenspider zenspider merged commit 519838e into nex3:master Sep 15, 2019
@zenspider zenspider deleted the created-order branch September 15, 2019 21:06
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.

2 participants