unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* making curly apostrophe part of a word
@ 2013-09-06  2:47 Eric Abrahamsen
  2013-09-06  9:51 ` Andreas Röhler
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Abrahamsen @ 2013-09-06  2:47 UTC (permalink / raw)
  To: help-gnu-emacs

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")

To give the quote character word syntax, but word-level commands still
treat it as a word boundary. Looking at describe-syntax, it appears to
have the same status as regular old `'' (apart from the "p" flag, which
I don't think is relevant). What am I doing wrong?

Thanks!
E




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: making curly apostrophe part of a word
  2013-09-06  2:47 making curly apostrophe part of a word Eric Abrahamsen
@ 2013-09-06  9:51 ` Andreas Röhler
  2013-09-06  9:58   ` Eric Abrahamsen
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Röhler @ 2013-09-06  9:51 UTC (permalink / raw)
  To: help-gnu-emacs

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?

Andreas




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: making curly apostrophe part of a word
  2013-09-06  9:51 ` Andreas Röhler
@ 2013-09-06  9:58   ` Eric Abrahamsen
  2013-09-06 10:37     ` Andreas Röhler
  0 siblings, 1 reply; 6+ messages in thread
From: Eric Abrahamsen @ 2013-09-06  9:58 UTC (permalink / raw)
  To: help-gnu-emacs

Andreas Röhler <andreas.roehler@easy-emacs.de> 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'.

Thanks,
E




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: making curly apostrophe part of a word
  2013-09-06  9:58   ` Eric Abrahamsen
@ 2013-09-06 10:37     ` Andreas Röhler
  2013-09-11  3:39       ` Kevin Rodgers
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas Röhler @ 2013-09-06 10:37 UTC (permalink / raw)
  To: help-gnu-emacs

Am 06.09.2013 11:58, schrieb Eric Abrahamsen:
> Andreas Röhler <andreas.roehler@easy-emacs.de> 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'.
>
> Thanks,
> E
>
>
>

It affects the current buffer only, not the mode in other buffers when done that way - maybe that's it?

Cheers





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: making curly apostrophe part of a word
  2013-09-06 10:37     ` Andreas Röhler
@ 2013-09-11  3:39       ` Kevin Rodgers
  2013-09-11  6:38         ` Eric Abrahamsen
  0 siblings, 1 reply; 6+ messages in thread
From: Kevin Rodgers @ 2013-09-11  3:39 UTC (permalink / raw)
  To: help-gnu-emacs

On 9/6/13 4:37 AM, Andreas Röhler wrote:
> Am 06.09.2013 11:58, schrieb Eric Abrahamsen:
>> Andreas Röhler <andreas.roehler@easy-emacs.de> 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.

-- 
Kevin Rodgers
Denver, Colorado, USA




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: making curly apostrophe part of a word
  2013-09-11  3:39       ` Kevin Rodgers
@ 2013-09-11  6:38         ` Eric Abrahamsen
  0 siblings, 0 replies; 6+ messages in thread
From: Eric Abrahamsen @ 2013-09-11  6:38 UTC (permalink / raw)
  To: help-gnu-emacs

Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:

> On 9/6/13 4:37 AM, Andreas Röhler wrote:
>> Am 06.09.2013 11:58, schrieb Eric Abrahamsen:
>>> Andreas Röhler <andreas.roehler@easy-emacs.de> 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




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-09-11  6:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-06  2:47 making curly apostrophe part of a word Eric Abrahamsen
2013-09-06  9:51 ` Andreas Röhler
2013-09-06  9:58   ` Eric Abrahamsen
2013-09-06 10:37     ` Andreas Röhler
2013-09-11  3:39       ` Kevin Rodgers
2013-09-11  6:38         ` Eric Abrahamsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).