changeset 22645:e5b201634497

(Fbyte_to_position): New function. (syms_of_editfns): defsubr it.
author Richard M. Stallman <rms@gnu.org>
date Mon, 29 Jun 1998 18:35:52 +0000
parents 5f67eacb5c04
children d5b24acb8f9b
files src/editfns.c
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/editfns.c	Mon Jun 29 18:34:43 1998 +0000
+++ b/src/editfns.c	Mon Jun 29 18:35:52 1998 +0000
@@ -497,6 +497,15 @@
   CHECK_NUMBER_COERCE_MARKER (position, 1);
   return make_number (CHAR_TO_BYTE (XINT (position)));
 }
+
+DEFUN ("byte-to-position", Fbyte_to_position, Sbyte_to_position, 1, 1, 0,
+  "Return the character position for byte position BYTEPOS.")
+  (bytepos)
+     Lisp_Object bytepos;
+{
+  CHECK_NUMBER (bytepos, 1);
+  return make_number (BYTE_TO_CHAR (XINT (bytepos)));
+}
 
 DEFUN ("following-char", Ffollowing_char, Sfollowing_char, 0, 0, 0,
   "Return the character following point, as a number.\n\
@@ -3117,6 +3126,7 @@
   defsubr (&Sgap_position);
   defsubr (&Sgap_size);
   defsubr (&Sposition_bytes);
+  defsubr (&Sbyte_to_position);
 
   defsubr (&Sbobp);
   defsubr (&Seobp);