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 bobp to rust #291

Merged
merged 1 commit into from Aug 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions rust_src/src/editfns.rs
Expand Up @@ -41,3 +41,11 @@ pub fn eobp() -> LispObject {
let buffer_ref = ThreadState::current_buffer();
LispObject::from_bool(buffer_ref.zv() == buffer_ref.pt)
}

/// Return t if point is at the beginning of the buffer. If the
/// buffer is narrowed, this means the beginning of the narrowed part.
#[lisp_fn]
pub fn bobp() -> LispObject {
let buffer_ref = ThreadState::current_buffer();
LispObject::from_bool(buffer_ref.pt == buffer_ref.begv)
}
2 changes: 2 additions & 0 deletions rust_src/src/lib.rs
Expand Up @@ -85,6 +85,7 @@ pub use math::Flss;
pub use math::Fleq;
pub use math::arithcompare;
pub use editfns::Feobp;
pub use editfns::Fbobp;

// Widely used in the C codebase.
pub use lists::Fsetcar;
Expand Down Expand Up @@ -317,5 +318,6 @@ pub extern "C" fn rust_init_syms() {
defsubr(&*editfns::Spoint);
defsubr(&*editfns::Sbuffer_size);
defsubr(&*editfns::Seobp);
defsubr(&*editfns::Sbobp);
}
}
11 changes: 0 additions & 11 deletions src/editfns.c
Expand Up @@ -1167,16 +1167,6 @@ At the beginning of the buffer or accessible region, return 0. */)
return temp;
}

DEFUN ("bobp", Fbobp, Sbobp, 0, 0, 0,
doc: /* Return t if point is at the beginning of the buffer.
If the buffer is narrowed, this means the beginning of the narrowed part. */)
(void)
{
if (PT == BEGV)
return Qt;
return Qnil;
}

DEFUN ("bolp", Fbolp, Sbolp, 0, 0, 0,
doc: /* Return t if point is at the beginning of a line. */)
(void)
Expand Down Expand Up @@ -5419,7 +5409,6 @@ functions if all the text being accessed has this property. */);
defsubr (&Sposition_bytes);
defsubr (&Sbyte_to_position);

defsubr (&Sbobp);
defsubr (&Sbolp);
defsubr (&Seolp);
defsubr (&Sfollowing_char);
Expand Down