diff src/fns.c @ 5089:99f8ebc082d9

Make #'substring an alias of #'subseq; give the latter the byte code. src/ChangeLog addition: 2010-03-03 Aidan Kehoe <kehoea@parhasard.net> * fns.c (Fsubstring): Removed. * search.c (Freplace_match): * minibuf.c (Ftry_completion): * lisp.h: * keymap.c (ensure_meta_prefix_char_keymapp): * dired.c (user_name_completion, file_name_completion): * console-x.c (x_canonicalize_console_connection): * bytecode.c (Bsubseq): * bytecode-ops.h (subseq): Move #'substring to Lisp, as an alias for #'subseq; change all C Fsubstring() calls to Fsubseq(), change the Bsubstring bytecode to Bsubseq. Motivation; not accepting vectors in #'substring is incompatible with GNU, and Common Lisp prefers #'subseq, it has no #'substring. lisp/ChangeLog addition: 2010-03-03 Aidan Kehoe <kehoea@parhasard.net> Move byte code #o117 to #'subseq, not #'substring. Make #'substring available as an alias for #'subseq in Lisp. * bytecomp.el (79, subseq, substring): * bytecomp.el (byte-compile-subseq): New. * update-elc.el (update-elc-chop-extension): Use #'subseq, not #'substring, the latter is not yet available. * subr.el (substring): New alias, to #'subseq. man/ChangeLog addition: 2010-03-03 Aidan Kehoe <kehoea@parhasard.net> * lispref/tips.texi (Comment Tips): * lispref/text.texi (Text Properties): * lispref/strings.texi (Creating Strings): * lispref/processes.texi (Input to Processes): * lispref/functions.texi (Argument List): * lispref/extents.texi (Duplicable Extents): Move examples that used substring to using subseq; in strings.texi, do not change the examples, but document that in this XEmacs, it is an alias for subseq, and that there may be some incompatibilities if you depend on that.
author Aidan Kehoe <kehoea@parhasard.net>
date Wed, 03 Mar 2010 18:40:12 +0000
parents c3d372419e09
children 7be849cb8828
line wrap: on
line diff
--- a/src/fns.c	Tue Mar 02 13:42:37 2010 -0700
+++ b/src/fns.c	Wed Mar 03 18:40:12 2010 +0000
@@ -947,30 +947,6 @@
   return arg;
 }
 
-DEFUN ("substring", Fsubstring, 2, 3, 0, /*
-Return the substring of STRING starting at START and ending before END.
-END may be nil or omitted; then the substring runs to the end of STRING.
-If START or END is negative, it counts from the end.
-Relevant parts of the string-extent-data are copied to the new string.
-*/
-       (string, start, end))
-{
-  Charcount ccstart, ccend;
-  Bytecount bstart, blen;
-  Lisp_Object val;
-
-  CHECK_STRING (string);
-  CHECK_INT (start);
-  get_string_range_char (string, start, end, &ccstart, &ccend,
-			 GB_HISTORICAL_STRING_BEHAVIOR);
-  bstart = string_index_char_to_byte (string, ccstart);
-  blen = string_offset_char_to_byte_len (string, bstart, ccend - ccstart);
-  val = make_string (XSTRING_DATA (string) + bstart, blen);
-  /* Copy any applicable extent information into the new string. */
-  copy_string_extents (val, string, 0, bstart, blen);
-  return val;
-}
-
 DEFUN ("subseq", Fsubseq, 2, 3, 0, /*
 Return the subsequence of SEQUENCE starting at START and ending before END.
 END may be omitted; then the subsequence runs to the end of SEQUENCE.
@@ -983,11 +959,25 @@
 {
   EMACS_INT len, s, e;
 
+  if (STRINGP (sequence))
+    {
+      Charcount ccstart, ccend;
+      Bytecount bstart, blen;
+      Lisp_Object val;
+
+      CHECK_INT (start);
+      get_string_range_char (sequence, start, end, &ccstart, &ccend,
+                             GB_HISTORICAL_STRING_BEHAVIOR);
+      bstart = string_index_char_to_byte (sequence, ccstart);
+      blen = string_offset_char_to_byte_len (sequence, bstart, ccend - ccstart);
+      val = make_string (XSTRING_DATA (sequence) + bstart, blen);
+      /* Copy any applicable extent information into the new string. */
+      copy_string_extents (val, sequence, 0, bstart, blen);
+      return val;
+    }
+
   CHECK_SEQUENCE (sequence);
 
-  if (STRINGP (sequence))
-    return Fsubstring (sequence, start, end);
-
   len = XINT (Flength (sequence));
 
   CHECK_INT (start);
@@ -4796,7 +4786,6 @@
   DEFSUBR (Fcopy_sequence);
   DEFSUBR (Fcopy_alist);
   DEFSUBR (Fcopy_tree);
-  DEFSUBR (Fsubstring);
   DEFSUBR (Fsubseq);
   DEFSUBR (Fnthcdr);
   DEFSUBR (Fnth);