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

implemented window-start #317

Merged
merged 3 commits into from Sep 23, 2017
Merged
Changes from all commits
Commits
File filter
Filter file types
Jump to
Jump to file
Failed to load files.

Always

Just for now

@@ -222,6 +222,7 @@ pub extern "C" fn rust_init_syms() {
defsubr(&*windows::Sselected_window);
defsubr(&*windows::Swindow_buffer);
defsubr(&*windows::Swindow_valid_p);
defsubr(&*windows::Swindow_start);
defsubr(&*process::Sget_process);
defsubr(&*process::Sprocessp);
defsubr(&*lists::Satom);
@@ -25,6 +25,11 @@ impl LispWindowRef {
pub fn contents(self) -> LispObject {
LispObject::from_raw(self.contents)
}

#[inline]
pub fn start_marker(self) -> LispObject {
LispObject::from_raw(self.start)
}
}

/// Return t if OBJECT is a window and nil otherwise.
@@ -98,3 +103,16 @@ pub fn window_valid_p(object: LispObject) -> LispObject {
|win| win.contents().is_not_nil(),
))
}

/// Return position at which display currently starts in WINDOW.
/// WINDOW must be a live window and defaults to the selected one.
/// This is updated by redisplay or by calling `set-window-start'.
#[lisp_fn(min = "0")]
pub fn window_start(window: LispObject) -> LispObject {
let win = if window.is_nil() {
selected_window()
} else {
window
};
marker_position(win.as_live_window_or_error().start_marker())
}
@@ -1506,15 +1506,6 @@ WINDOW must be a live window and defaults to the selected one. */)
return Fmarker_position (decode_live_window (window)->old_pointm);
}

DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0,
doc: /* Return position at which display currently starts in WINDOW.
WINDOW must be a live window and defaults to the selected one.
This is updated by redisplay or by calling `set-window-start'. */)
(Lisp_Object window)
{
return Fmarker_position (decode_live_window (window)->start);
}

/* This is text temporarily removed from the doc string below.
This function returns nil if the position is not currently known.
@@ -7720,7 +7711,6 @@ displayed after a scrolling operation to be somewhat inaccurate. */);
defsubr (&Scoordinates_in_window_p);
defsubr (&Swindow_at);
defsubr (&Swindow_old_point);
defsubr (&Swindow_start);
defsubr (&Swindow_end);
defsubr (&Sset_window_point);
defsubr (&Sset_window_start);
ProTip! Use n and p to navigate between commits in a pull request.