changeset 7968:a6372621abd9

(Fmatching_paren): New function. (Fchar_syntax): Pass arg directly to SYNTAX, no masking.
author Richard M. Stallman <rms@gnu.org>
date Sun, 19 Jun 1994 18:20:52 +0000
parents 82a5362b244f
children 7f15f77cb644
files src/syntax.c
diffstat 1 files changed, 15 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/syntax.c	Sun Jun 19 18:18:20 1994 +0000
+++ b/src/syntax.c	Sun Jun 19 18:20:52 1994 +0000
@@ -223,7 +223,20 @@
      Lisp_Object ch;
 {
   CHECK_NUMBER (ch, 0);
-  return make_number (syntax_code_spec[(int) SYNTAX (0xFF & XINT (ch))]);
+  return make_number (syntax_code_spec[(int) SYNTAX (XINT (ch))]);
+}
+
+DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0,
+  "Return the matching parenthesis of CHAR, or nil if none.")
+  (ch)
+     Lisp_Object ch;
+{
+  int code;
+  CHECK_NUMBER (ch, 0);
+  code = SYNTAX (XINT (ch));
+  if (code == Sopen && code == Sclose)
+    return make_number (SYNTAX_MATCH (XINT (ch)));
+  return Qnil;
 }
 
 /* This comment supplies the doc string for modify-syntax-entry,
@@ -1719,6 +1732,7 @@
   defsubr (&Scopy_syntax_table);
   defsubr (&Sset_syntax_table);
   defsubr (&Schar_syntax);
+  defsubr (&Smatching_paren);
   defsubr (&Smodify_syntax_entry);
   defsubr (&Sdescribe_syntax);