X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=src%2Fsyntax.c;h=4fdc4be1a6e911c8f9587f0017a6f6e4d1cbc453;hb=6ad9899c500e90d43b534a0c67d13b10bb3ddfb6;hp=9a1d56ba1cd313dc6766dc257aedbf6db4ecf1a2;hpb=2e3e3f9ee27fec50f45c282d71eaddf7c673bc56;p=chise%2Fxemacs-chise.git- diff --git a/src/syntax.c b/src/syntax.c index 9a1d56b..4fdc4be 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -27,8 +27,6 @@ Boston, MA 02111-1307, USA. */ #include "lisp.h" #include "buffer.h" -#include "commands.h" -#include "insdel.h" #include "syntax.h" /* Here is a comment from Ken'ichi HANDA @@ -55,6 +53,7 @@ Sextword is a word-constituent but a word boundary may exist between two such characters. */ /* Mule 2.4 doesn't seem to have Sextword - I'm removing it -- mrb */ +/* Recovered by tomo */ Lisp_Object Qsyntax_table_p; @@ -328,7 +327,17 @@ syntax table. } - +#ifdef MULE +/* Return 1 if there is a word boundary between two word-constituent + characters C1 and C2 if they appear in this order, else return 0. + There is no word boundary between two word-constituent ASCII + characters. */ +#define WORD_BOUNDARY_P(c1, c2) \ + (!(CHAR_ASCII_P (c1) && CHAR_ASCII_P (c2)) \ + && word_boundary_p (c1, c2)) + +extern int word_boundary_p (Emchar c1, Emchar c2); +#else static int word_constituent_p (struct buffer *buf, Bufpos pos, struct Lisp_Char_Table *tab) @@ -338,6 +347,7 @@ word_constituent_p (struct buffer *buf, Bufpos pos, (code == Sescape || code == Scharquote)) || (code == Sword)); } +#endif /* Return the position across COUNT words from FROM. If that many words cannot be found before the end of the buffer, return 0. @@ -348,6 +358,11 @@ scan_words (struct buffer *buf, Bufpos from, int count) { Bufpos limit = count > 0 ? BUF_ZV (buf) : BUF_BEGV (buf); struct Lisp_Char_Table *mirrortab = XCHAR_TABLE (buf->mirror_syntax_table); +#ifdef MULE + Emchar ch0, ch1; + enum syntaxcode code; +#endif + while (count > 0) { QUIT; @@ -356,15 +371,40 @@ scan_words (struct buffer *buf, Bufpos from, int count) { if (from == limit) return 0; +#ifdef MULE + ch0 = BUF_FETCH_CHAR (buf, from); + code = SYNTAX_UNSAFE (mirrortab, ch0); +#else if (word_constituent_p (buf, from, mirrortab)) break; +#endif from++; +#ifdef MULE + if (words_include_escapes + && (code == Sescape || code == Scharquote)) + break; + if (code == Sword) + break; +#endif } QUIT; - while ((from != limit) && word_constituent_p (buf, from, mirrortab)) + while ((from != limit) +#ifndef MULE + && word_constituent_p (buf, from, mirrortab) +#endif + ) { +#ifdef MULE + ch1 = BUF_FETCH_CHAR (buf, from); + code = SYNTAX_UNSAFE (mirrortab, ch1); + if (!(words_include_escapes + && (code == Sescape || code == Scharquote))) + if (code != Sword || WORD_BOUNDARY_P (ch0, ch1)) + break; + ch0 = ch1; +#endif from++; } count--; @@ -378,15 +418,39 @@ scan_words (struct buffer *buf, Bufpos from, int count) { if (from == limit) return 0; +#ifndef MULE if (word_constituent_p (buf, from - 1, mirrortab)) break; +#endif from--; +#ifdef MULE + ch1 = BUF_FETCH_CHAR (buf, from - 1); + code = SYNTAX_UNSAFE (mirrortab, ch1); + if (words_include_escapes + && (code == Sescape || code == Scharquote)) + break; + if (code == Sword) + break; +#endif } QUIT; - while ((from != limit) && word_constituent_p (buf, from - 1, mirrortab)) + while ((from != limit) +#ifndef MULE + && word_constituent_p (buf, from - 1, mirrortab) +#endif + ) { +#ifdef MULE + ch0 = BUF_FETCH_CHAR (buf, from - 1); + code = SYNTAX_UNSAFE (mirrortab, ch0); + if (!(words_include_escapes + && (code == Sescape || code == Scharquote))) + if (code != Sword || WORD_BOUNDARY_P (ch0, ch1)) + break; + ch1 = ch0; +#endif from--; } count++; @@ -396,10 +460,12 @@ scan_words (struct buffer *buf, Bufpos from, int count) } DEFUN ("forward-word", Fforward_word, 1, 2, "_p", /* -Move point forward ARG words (backward if ARG is negative). +Move point forward COUNT words (backward if COUNT is negative). Normally returns t. If an edge of the buffer is reached, point is left there and nil is returned. + +Optional argument BUFFER defaults to the current buffer. */ (count, buffer)) { @@ -1652,8 +1718,8 @@ complex_vars_of_syntax (void) Vstandard_syntax_table = Fcopy_syntax_table (Qnil); staticpro (&Vstandard_syntax_table); - Vsyntax_designator_chars_string = make_pure_string (syntax_code_spec, - Smax, Qnil, 1); + Vsyntax_designator_chars_string = make_string_nocopy (syntax_code_spec, + Smax); staticpro (&Vsyntax_designator_chars_string); fill_char_table (XCHAR_TABLE (Vstandard_syntax_table),