diff options
| author | Lars Ingebrigtsen | 2021-06-15 16:50:51 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2021-06-15 17:01:57 +0200 |
| commit | 81fd5603ce701a0acae096314c1f7ab1db69c64f (patch) | |
| tree | a86c76aa418d1e2622c4f08337bb453343c07c83 /src | |
| parent | 53e5caa1bd7363e9eb8f3501dbc7c91928c9c8a3 (diff) | |
| download | emacs-81fd5603ce701a0acae096314c1f7ab1db69c64f.tar.gz emacs-81fd5603ce701a0acae096314c1f7ab1db69c64f.zip | |
Add a new function syntax-class-to-char
* doc/lispref/syntax.texi (Syntax Table Internals): Document it.
* src/syntax.c (Fsyntax_class_to_char): New function (bug#37452).
Diffstat (limited to 'src')
| -rw-r--r-- | src/syntax.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/syntax.c b/src/syntax.c index 9fbf88535f3..7bba336744a 100644 --- a/src/syntax.c +++ b/src/syntax.c | |||
| @@ -1109,6 +1109,23 @@ this is probably the wrong function to use, because it can't take | |||
| 1109 | return make_fixnum (syntax_code_spec[SYNTAX (char_int)]); | 1109 | return make_fixnum (syntax_code_spec[SYNTAX (char_int)]); |
| 1110 | } | 1110 | } |
| 1111 | 1111 | ||
| 1112 | DEFUN ("syntax-class-to-char", Fsyntax_class_to_char, | ||
| 1113 | Ssyntax_class_to_char, 1, 1, 0, | ||
| 1114 | doc: /* Return the syntax char of CLASS, described by an integer. | ||
| 1115 | For example, if SYNTAX is word constituent (the integer 2), the | ||
| 1116 | character `w' (119) is returned. */) | ||
| 1117 | (Lisp_Object syntax) | ||
| 1118 | { | ||
| 1119 | int syn; | ||
| 1120 | CHECK_FIXNUM (syntax); | ||
| 1121 | syn = XFIXNUM (syntax); | ||
| 1122 | |||
| 1123 | if (syn < 0 || syn >= sizeof syntax_code_spec) | ||
| 1124 | args_out_of_range (make_fixnum (sizeof syntax_code_spec - 1), | ||
| 1125 | syntax); | ||
| 1126 | return make_fixnum (syntax_code_spec[syn]); | ||
| 1127 | } | ||
| 1128 | |||
| 1112 | DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0, | 1129 | DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0, |
| 1113 | doc: /* Return the matching parenthesis of CHARACTER, or nil if none. */) | 1130 | doc: /* Return the matching parenthesis of CHARACTER, or nil if none. */) |
| 1114 | (Lisp_Object character) | 1131 | (Lisp_Object character) |
| @@ -3782,6 +3799,7 @@ In both cases, LIMIT bounds the search. */); | |||
| 3782 | defsubr (&Scopy_syntax_table); | 3799 | defsubr (&Scopy_syntax_table); |
| 3783 | defsubr (&Sset_syntax_table); | 3800 | defsubr (&Sset_syntax_table); |
| 3784 | defsubr (&Schar_syntax); | 3801 | defsubr (&Schar_syntax); |
| 3802 | defsubr (&Ssyntax_class_to_char); | ||
| 3785 | defsubr (&Smatching_paren); | 3803 | defsubr (&Smatching_paren); |
| 3786 | defsubr (&Sstring_to_syntax); | 3804 | defsubr (&Sstring_to_syntax); |
| 3787 | defsubr (&Smodify_syntax_entry); | 3805 | defsubr (&Smodify_syntax_entry); |