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

port get-buffer-window #1453

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

brotzeit
Copy link
Member

No description provided.

@brotzeit
Copy link
Member Author

brotzeit commented May 2, 2019

@agraven done.

/// Any other value of ALL-FRAMES means consider all windows on the
/// selected frame and no others.
#[lisp_fn(min = "0")]
pub fn get_buffer_window(buffer_or_name: LispObject, all_frames: LispObject) -> LispObject {
Copy link
Collaborator

@agraven agraven May 18, 2019

Choose a reason for hiding this comment

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

There's a LispBufferOrName type for this situation. You then get a buffer by doing let buffer: LispBufferRef = buffer_or_name.into(). Option<LispBufferRef> also works here, since it looks like that's what you need here, along with doing a match on it after.

Copy link
Member Author

Choose a reason for hiding this comment

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

The test is failing this way. It seems it doesn't handle the case when buffer_or_name is a name.

Copy link
Collaborator

Choose a reason for hiding this comment

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

That's odd, it should. What's the trace of the error, if there is one?

Copy link
Member Author

Choose a reason for hiding this comment

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

I push the changes so you can see the log. But shouldn't there by a call to get_buffer in a method of LispBufferOrName ?

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm probably just missing something again :P

Fget_buffer(buffer_or_name).as_buffer()
};

if let Some(b) = buffer {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's preferred you do a match instead if you also have an else block on the if let

brotzeit added 2 commits May 22, 2019 17:10
@shaleh
Copy link
Collaborator

shaleh commented Jan 10, 2020

@brotzeit wanna pick this back up?

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.

None yet

3 participants