Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions rust_src/src/editfns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,19 @@ pub fn eolp() -> LispObject {
buffer_ref.pt == buffer_ref.zv() || buffer_ref.fetch_byte(buffer_ref.pt_byte) == b'\n',
)
}

/// Return the minimum permissible value of point in the current
/// buffer. This is 1, unless narrowing (a buffer restriction) is in
/// effect.
#[lisp_fn]
pub fn point_min() -> LispObject {
LispObject::from_natnum(ThreadState::current_buffer().begv as EmacsInt)
Copy link
Copy Markdown
Member Author

@kidd kidd Sep 4, 2017

Choose a reason for hiding this comment

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

begv (the same as zv) is both an "attribute" of buffer and an accessor. Better use the accessor, right? (that means change this to begv()). Or for efficiency reasons we want to access the attr directly?
It's 'beg' the one that is an accessor. begv is only an attribute so the question is irrelevant.

}

/// Return the maximum permissible value of point in the current
/// buffer. This is (1+ (buffer-size)), unless narrowing (a buffer
/// restriction) is in effect, in which case it is less.
#[lisp_fn]
pub fn point_max() -> LispObject {
LispObject::from_natnum(ThreadState::current_buffer().zv() as EmacsInt)
}
2 changes: 2 additions & 0 deletions rust_src/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,5 +333,7 @@ pub extern "C" fn rust_init_syms() {
defsubr(&*editfns::Sbobp);
defsubr(&*editfns::Sbolp);
defsubr(&*editfns::Seolp);
defsubr(&*editfns::Spoint_min);
defsubr(&*editfns::Spoint_max);
}
}
23 changes: 0 additions & 23 deletions src/editfns.c
Original file line number Diff line number Diff line change
Expand Up @@ -1045,16 +1045,6 @@ usage: (save-current-buffer &rest BODY) */)
return unbind_to (count, Fprogn (args));
}

DEFUN ("point-min", Fpoint_min, Spoint_min, 0, 0, 0,
doc: /* Return the minimum permissible value of point in the current buffer.
This is 1, unless narrowing (a buffer restriction) is in effect. */)
(void)
{
Lisp_Object temp;
XSETFASTINT (temp, BEGV);
return temp;
}

DEFUN ("point-min-marker", Fpoint_min_marker, Spoint_min_marker, 0, 0, 0,
doc: /* Return a marker to the minimum permissible value of point in this buffer.
This is the beginning, unless narrowing (a buffer restriction) is in effect. */)
Expand All @@ -1063,17 +1053,6 @@ This is the beginning, unless narrowing (a buffer restriction) is in effect. */
return build_marker (current_buffer, BEGV, BEGV_BYTE);
}

DEFUN ("point-max", Fpoint_max, Spoint_max, 0, 0, 0,
doc: /* Return the maximum permissible value of point in the current buffer.
This is (1+ (buffer-size)), unless narrowing (a buffer restriction)
is in effect, in which case it is less. */)
(void)
{
Lisp_Object temp;
XSETFASTINT (temp, ZV);
return temp;
}

DEFUN ("point-max-marker", Fpoint_max_marker, Spoint_max_marker, 0, 0, 0,
doc: /* Return a marker to the maximum permissible value of point in this buffer.
This is (1+ (buffer-size)), unless narrowing (a buffer restriction)
Expand Down Expand Up @@ -5381,8 +5360,6 @@ functions if all the text being accessed has this property. */);
defsubr (&Ssave_excursion);
defsubr (&Ssave_current_buffer);

defsubr (&Spoint_max);
defsubr (&Spoint_min);
defsubr (&Spoint_min_marker);
defsubr (&Spoint_max_marker);
defsubr (&Sgap_position);
Expand Down