[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#29097: 25.1; to support '_' as a word constituent, subword-mode rege
From: |
Masatake YAMATO |
Subject: |
bug#29097: 25.1; to support '_' as a word constituent, subword-mode regexes need updating |
Date: |
Wed, 01 Nov 2017 18:28:42 +0900 (JST) |
> Yes, sexp's include entire brace blocks and whatnot. I just want to
> forward into valid c identifiers but with subword support. So there's
> still a big difference between the two functions?
I'm talking in narrower scope: C identifier.
Originally subword-mode focuses on moving the point within a C identifier.
I will use '*' is for the current point position.
I will use '^' is for the point position when you press
a key for forwarding.
Let's introduce an example.
gtk_main
=======================================begin
\M-\C-f works as follows:
gtk_main
*-------^
\M-f(subword mode: off) works as follows:
gtk_main
*--^
\C-f works as follows:
gtk_main
*^
=======================================end
For gtk_main, there is no area that subword-mode works.
Subword more make sense when a user thinks granularity(?) of
moving the point with \M-f is too large.
=======================================begin
\M-f(subword mode: off):
NSObjectGtk_main
*----------^
\M-f(subword mode: on):
NSObjectGtk_main
*-^
=======================================end
subword mode provides finer granularity \M-f to those who thinks
granularity(?) of moving the point with (original) \M-f is too large.
This is the original intention I worked on c-subword-mode, the
ancestor of subword-mode.
In other hand, you are setting,
> (modify-syntax-entry ?_ "w")
It seems for me that you think granularity(?) of moving the point with
(original) \M-f is too small. This syntax modification makes moving the
point with (original) \M-f larger.
My basic assumption for designing c-subword-mode is not satisfied.
So I cannot show good direction as an original developer.
The mode syntax defines the behavior of \M-\C-f and \M-f in the mode.
Extending syntax mechanism allowing to define upper case, lower case
and something is ideal. The behavior of subword-forward and subword-backward
can be derived from the exnteded syntax.
Masatake YAMATO
> Yes, sexp's include entire brace blocks and whatnot. I just want to
> forward into valid c identifiers but with subword support. So there's
> still a big difference between the two functions?
>
> Chris
>
>
>
> On Tue, Oct 31, 2017 at 22:54 Masatake YAMATO <yamato@redhat.com> wrote:
>
>> Hi,
>>
>> I read the original bug report.
>>
>> I wonder why you want do
>>
>> (modify-syntax-entry ?_ "w")
>>
>> .
>>
>> This change suppresses the difference of \M-f and \M-C-f.
>> Do you really want this suppression?
>>
>> Masatake YAMATO
>>
>>
>> >> From: Chris Hecker <checker@d6.com>
>> >> Date: Tue, 31 Oct 2017 20:51:23 -0700
>> >> Cc: yamato@redhat.com
>> >>
>> >> If you like using identifiers with underscores (_) in them, like
>> >> C macros or even just regular identifiers, you can add _ as a word
>> >> constituent in the syntax tables, but if you're using subword-mode
>> >> then the forward and backwards regexes need updating to work
>> >> correctly. Here is the relevant section of my .emacs c-mode hook:
>> >
>> > Perhaps we should make subword-forward-regexp and
>> > subword-backward-regexp defcustoms?
>>