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 forward point #321

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


Just for now

@@ -26,6 +26,11 @@ impl LispBufferRef {

pub fn pt(&self) -> ptrdiff_t {

pub fn beg_addr(&self) -> *mut c_uchar {
unsafe { (*self.text).beg }
@@ -0,0 +1,11 @@
use lisp::LispObject;
use remacs_macros::lisp_fn;
use remacs_sys::EmacsInt;
use threads::ThreadState;

/// Return buffer position N characters after (before if N negative) point.
pub fn forward_point(n: LispObject) -> LispObject {
let pt = ThreadState::current_buffer().pt();
LispObject::from_fixnum(n.as_fixnum_or_error() + pt as EmacsInt)
@@ -63,6 +63,7 @@ mod obarray;
mod editfns;
mod util;
mod minibuf;
mod cmds;

#[cfg(all(not(test), target_os = "macos"))]
use alloc_unexecmacosx::OsxUnexecAlloc;
@@ -379,5 +380,6 @@ pub extern "C" fn rust_init_syms() {
@@ -30,15 +30,6 @@ along with GNU Emacs. If not, see <>. */
#include "frame.h"

static int internal_self_insert (int, EMACS_INT);

DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
doc: /* Return buffer position N characters after (before if N negative) point. */)
(Lisp_Object n)

return make_number (PT + XINT (n));

/* Add N to point; or subtract N if FORWARD is false. N defaults to 1.
Validate the new location. Return nil. */
@@ -511,7 +502,6 @@ syms_of_cmds (void)
This is run after inserting the character. */);
Vpost_self_insert_hook = Qnil;

defsubr (&Sforward_point);
defsubr (&Sforward_char);
defsubr (&Sbackward_char);
defsubr (&Sforward_line);
ProTip! Use n and p to navigate between commits in a pull request.