Subject: bug#10494: 24.0.92; Syntax table and non-ASCII character interaction

From: [email-masked]
Date: Sat, 13 Aug 2016 09:21:54 -0400

Eli Zaretskii <[email-masked]> writes:

>> From: [email-masked]
>> Cc: [email-masked],  [email-masked]
>> Date: Fri, 12 Aug 2016 18:37:56 -0400
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> > Indeed.  This is a feature:
>> 
>> Ah, so doing
>> 
>>     (modify-syntax-entry ?’ "w" text-mode-syntax-table)
>>     (aset char-script-table ?’ 'latin)
>> 
>> does let word motion skip over ’ as OP wanted.
>
> Yes.  But I don't recommend such a "solution", because that would most
> probably bite elsewhere, when we do want that character behave as a
> symbol.

Sure, but it could be made local to text-mode:

    (modify-syntax-entry ?’ "w" text-mode-syntax-table)
    (defconst my-text-char-script-table
      (let ((table (copy-sequence char-script-table)))
        (aset table ?’ 'latin)
        table))

    (defun my-text-mode-hook ()
      (set (make-local-variable 'char-script-table)
           my-text-char-script-table))
    (add-hook 'text-mode-hook 'my-text-mode-hook)

>
>> `(elisp) Word Motion' looks like a good place for it:
>
> Right, thanks.
>
>>    The functions for parsing words described below use the syntax table
>> -to decide whether a given character is part of a word.  @xref{Syntax
>> -Tables}.
>> +and @code{char-script-table} to decide whether a given character is
>> +part of a word.  @xref{Syntax Tables} and @xref{Character Properties}.
>
> @xref generates a capitalized "See", so is inappropriate in the middle
> of a sentence.  Please use "see @ref" instead.

Uff, I find these multiple variants of reference very confusing, I also
got a complaint from makeinfo that I was missing punctuation after the
first @xref.  Does it look okay now? (I made the other wording fixes
too)

>From e18a6dc7be2aa245767d00ac69a0e13605fc4440 Mon Sep 17 00:00:00 2001
From: Noam Postavsky <[email-masked]>
Date: Fri, 12 Aug 2016 18:33:17 -0400
Subject: [PATCH v2] Document char-script-table's effect on word motion

* doc/lispref/positions.texi (Word Motion): Talk about
char-script-table (Bug #10494).
---
 doc/lispref/positions.texi | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi
index 1d748b8..b6133dc 100644
--- a/doc/lispref/positions.texi
+++ b/doc/lispref/positions.texi
@@ -192,8 +192,9 @@ Word Motion
 @subsection Motion by Words
 
   The functions for parsing words described below use the syntax table
-to decide whether a given character is part of a word.  @xref{Syntax
-Tables}.
+and @code{char-script-table} to decide whether a given character is
+part of a word.  @xref{Syntax Tables}, and see @ref{Character
+Properties}.
 
 @deffn Command forward-word &optional count
 This function moves point forward @var{count} words (or backward if
@@ -207,11 +208,13 @@ Word Motion
 that begin and end words, known as @dfn{word boundaries}, are defined
 by the current buffer's syntax table (@pxref{Syntax Class Table}), but
 modes can override that by setting up a suitable
-@code{find-word-boundary-function-table}, described below.  In any
-case, this function cannot move point past the boundary of the
-accessible portion of the buffer, or across a field boundary
-(@pxref{Fields}).  The most common case of a field boundary is the end
-of the prompt in the minibuffer.
+@code{find-word-boundary-function-table}, described below.  Characters
+that belong to different scripts (as defined by
+@code{char-syntax-table}), also define a word boundary
+(@pxref{Character Properties}).  In any case, this function cannot
+move point past the boundary of the accessible portion of the buffer,
+or across a field boundary (@pxref{Fields}).  The most common case of
+a field boundary is the end of the prompt in the minibuffer.
 
 If it is possible to move @var{count} words, without being stopped
 prematurely by the buffer boundary or a field boundary, the value is
-- 
2.9.2