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 identity function to rust #329

Merged
merged 2 commits into from
Sep 28, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions rust_src/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,9 @@ pub use editfns::Feolp;
// Used in minibuffer.c
pub use windows::Fwindow_minibuffer_p;

// Used in term.c, dired.c
pub use objects::Fidentity;

extern "C" {
fn defsubr(sname: *const Lisp_Subr);
}
Expand Down Expand Up @@ -266,6 +269,7 @@ pub extern "C" fn rust_init_syms() {
defsubr(&*objects::Seql);
defsubr(&*objects::Sequal);
defsubr(&*objects::Sequal_including_properties);
defsubr(&*objects::Sidentity);
defsubr(&*symbols::Ssymbolp);
defsubr(&*symbols::Ssymbol_name);
defsubr(&*symbols::Sfboundp);
Expand Down
6 changes: 6 additions & 0 deletions rust_src/src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,9 @@ fn equal_including_properties(o1: LispObject, o2: LispObject) -> LispObject {
};
LispObject::from_bool(res)
}

/// Return the argument unchanged.
#[lisp_fn]
fn identity(arg: LispObject) -> LispObject {
arg
}
9 changes: 0 additions & 9 deletions src/fns.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,6 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
enum equal_kind { EQUAL_NO_QUIT, EQUAL_PLAIN, EQUAL_INCLUDING_PROPERTIES };
bool internal_equal (Lisp_Object, Lisp_Object, enum equal_kind, int, Lisp_Object);

DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0,
doc: /* Return the argument unchanged. */
attributes: const)
(Lisp_Object arg)
{
return arg;
}

/* Random data-structure functions. */

DEFUN ("compare-strings", Fcompare_strings, Scompare_strings, 6, 7, 0,
Expand Down Expand Up @@ -3854,7 +3846,6 @@ that disables the use of a file dialog, regardless of the value of
this variable. */);
use_file_dialog = 1;

defsubr (&Sidentity);
defsubr (&Scompare_strings);
defsubr (&Sstring_version_lessp);
defsubr (&Sstring_collate_lessp);
Expand Down