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

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

Re: making curly apostrophe part of a word


From: Eric Abrahamsen
Subject: Re: making curly apostrophe part of a word
Date: Wed, 11 Sep 2013 14:38:48 +0800
User-agent: Gnus/5.130008 (Ma Gnus v0.8) Emacs/24.3 (gnu/linux)

Kevin Rodgers <address@hidden> writes:

> On 9/6/13 4:37 AM, Andreas Röhler wrote:
>> Am 06.09.2013 11:58, schrieb Eric Abrahamsen:
>>> Andreas Röhler <address@hidden> writes:
>>>> Am 06.09.2013 04:47, schrieb Eric Abrahamsen:
>>>>> In certain modes (actually just certain files) I'd like the `’'
>>>>> character to be treated the same as a `'' character with respect to word
>>>>> movement: ie I'd like M-f to skip over the entirety of both "don't" and
>>>>> "don’t". I'm editing externally-created files, and don't have the
>>>>> liberty of changing this.
>>>>>
>>>>> I thought this would do it:
>>>>>
>>>>> (modify-syntax-entry ?’ "w")
>>>>>
>>>>
>>>> Works for me in current buffer. `forward-word' passes as expected.
>>>> Which command fails for you?
>>>
>>> `forward-word' fails... Hang on, I'll do the emacs -Q dance and see
>>> what's going on. This was originally in an html-mode buffer, but I don't
>>> see why that would matter as long as no third argument was passed to
>>> `modify-syntax-entry'.
>>
>> It affects the current buffer only, not the mode in other buffers when done 
>> that
>> way - maybe that's it?
>
> Not according to its doc string:
>
>       The syntax is changed only for table SYNTAX-TABLE, which defaults to
>        the current buffer's syntax table.
>
> Different buffers in the same major mode usually share the same syntax table.

Ugh, this is very weird. I started emacs -Q (emacs-version "24.3.1"),
went into an empty buffer and turned it into text mode, then put in
these lines:

can’t

bug&bear

bug©bear

All three of "’", "&", and "©" originally act as word boundaries:
invoking M-f from the front of the word and M-b from the back stops once
_before_ the symbol. The next invocation goes to the next whitespace.

Then for each of those three symbols I call (modify-syntax-entry ?[char]
"w"). Now "&" and "©" behave as expected: M-f and M-b jump all the way
across.

But "’" is different: after modifying its syntax, word-movement commands
stop _twice_, once on each side of the character, before moving to the
other end of the word.

I wonder if I've somehow added "w" to its existing syntax definition,
without "clearing" the existing definition, and that's why it's behaving
strangely?

No idea,
E




reply via email to

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