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

Set last focused window in switch-to-window. #881

Merged
merged 2 commits into from
Jul 26, 2023

Conversation

Homo-carbonis
Copy link
Contributor

I would like to be able to switch to the repl and then use switch-to-last-focused-window to return to the buffer I was last editing. Currently the use of switch-to-last-focused-window is limited because commands which switch windows are left to set *last-focused-window* themselves and most of them don't.

To resolve this I added a line to set *last-focused-window* in the switch-to-window function.

The next step would be to make all the commands which directly call (setf (current window)) use switch-to-window so that *last-focused-window* is set and window-leave-hook is run.

Copy link
Member

@cxxxr cxxxr left a comment

Choose a reason for hiding this comment

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

Thanks for the PR.
I think it is a very nice improvement.

@@ -203,6 +203,7 @@
:*window-scroll-functions*
:*window-size-change-functions*
:*window-show-buffer-functions*
:*last-focused-window*
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this variable should be encapsulated, what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Or if you need to reference it from the outside package, maybe use the (last-focusd-window) function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I think you are right. I'll export a (last-focused-window) function instead. It is only switch-to-last-focused-window which needs to access externally but I think it is best to keep the logic with the command.

@cxxxr cxxxr merged commit 531074d into lem-project:main Jul 26, 2023
@cxxxr
Copy link
Member

cxxxr commented Jul 26, 2023

Thank you very much!

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