help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Making forward-word work with curly apostrophes


From: A.Politz
Subject: Re: Making forward-word work with curly apostrophes
Date: Sun, 2 Aug 2009 15:46:16 -0700 (PDT)
User-agent: G2/1.0

On Aug 2, 10:19 pm, Ian Eure <address@hidden> wrote:
> If I have a text-mode buffer with the following two words:
>
> 1. I've
> 2. I’ve
>
> forward-word skips over "I've," but treats "I’ve" as _three_ words. I  
> seem to recall that forward-char skips over characters with word  
> syntax until it finds one with non-word-syntax, but that doesn't seem  
> to be the case here. I set ’ to have the same syntax as ' with:
>
> (modify-syntax-entry ?’ "w p")
>
> But forward-word still treats it as three words. All works well if I do:
>
> (skip-syntax-forward "w")
>
> What is forward-word doing, and how can I make it treat ’ as part of  
> my word?
>
>   - Ian



Apart from syntax-class, 2 chars form a word boundary, if they do
not share a common character category. You need to do something
like this:

(let ((latin ?l)
      (other
       (aref (category-set-mnemonics
              (char-category-set ?’)) 0)))
  (add-to-list 'word-combining-categories
               (cons latin other))
  (add-to-list 'word-combining-categories
               (cons other latin)))


For the whole story read

(describe-variable 'word-combining-categories)

and maybe

(info "(elisp)Categories")

.

-ap


reply via email to

[Prev in Thread] Current Thread [Next in Thread]