* Making forward-word work with curly apostrophes
@ 2009-08-02 20:19 Ian Eure
2009-08-02 21:23 ` Leo
0 siblings, 1 reply; 5+ messages in thread
From: Ian Eure @ 2009-08-02 20:19 UTC (permalink / raw)
To: Emacs Help List
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
^ permalink raw reply [flat|nested] 5+ messages in thread
[parent not found: <mailman.3711.1249244381.2239.help-gnu-emacs@gnu.org>]
* Re: Making forward-word work with curly apostrophes
[not found] <mailman.3711.1249244381.2239.help-gnu-emacs@gnu.org>
@ 2009-08-02 20:40 ` Xah Lee
2009-08-02 22:46 ` A.Politz
1 sibling, 0 replies; 5+ messages in thread
From: Xah Lee @ 2009-08-02 20:40 UTC (permalink / raw)
To: help-gnu-emacs
On Aug 2, 1:19 pm, Ian Eure <i...@digg.com> 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.
in my emacs23, it treats the second one as 2 words, not 3.
My emacs version is:
GNU Emacs 23.0.94.1 (i386-mingw-nt6.0.6002) of 2009-05-28 on
LENNART-69DE564 (patched)
just tested on my carbon emacs which is emacs 22. Same behavior.
i work with text having curly quotes in the past several years, i
don't recall emacs treating it as 3 words with forward-word.
you prob have some customization that does that? tried starting with -
Q?
Xah
∑ http://xahlee.org/
☄
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Making forward-word work with curly apostrophes
[not found] <mailman.3711.1249244381.2239.help-gnu-emacs@gnu.org>
2009-08-02 20:40 ` Xah Lee
@ 2009-08-02 22:46 ` A.Politz
2009-08-03 23:58 ` Ian Eure
1 sibling, 1 reply; 5+ messages in thread
From: A.Politz @ 2009-08-02 22:46 UTC (permalink / raw)
To: help-gnu-emacs
On Aug 2, 10:19 pm, Ian Eure <i...@digg.com> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Making forward-word work with curly apostrophes
2009-08-02 22:46 ` A.Politz
@ 2009-08-03 23:58 ` Ian Eure
0 siblings, 0 replies; 5+ messages in thread
From: Ian Eure @ 2009-08-03 23:58 UTC (permalink / raw)
To: A.Politz; +Cc: help-gnu-emacs
On Aug 2, 2009, at 3:46 PM, A.Politz wrote:
>
> 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)))
>
Perfect, this is what I needed.
I mentioned something like this in a bug report before, but it got
wontfixed. Basically, a bunch of symbols which are used in latin
scripts (like directional quotes) are categorized (incorrectly, I
believe) as CJK.
I'll report it again and see if I can get it fixed.
- Ian
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-08-03 23:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-02 20:19 Making forward-word work with curly apostrophes Ian Eure
2009-08-02 21:23 ` Leo
[not found] <mailman.3711.1249244381.2239.help-gnu-emacs@gnu.org>
2009-08-02 20:40 ` Xah Lee
2009-08-02 22:46 ` A.Politz
2009-08-03 23:58 ` Ian Eure
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.