unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* C++ Mode:  Interpretation of Underscores In Words
@ 2003-11-12 15:03 Joe Mama
  0 siblings, 0 replies; 5+ messages in thread
From: Joe Mama @ 2003-11-12 15:03 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 321 bytes --]

Hello:
 
Given a variable like "employee_name" is there a way to make emacs treat this as one word.  Would be nice when doing commands like "forward-word" which treats employee_name as two words.  
 
Thanks in advance.


---------------------------------
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard

[-- Attachment #1.2: Type: text/html, Size: 446 bytes --]

[-- Attachment #2: Type: text/plain, Size: 151 bytes --]

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: C++ Mode:  Interpretation of Underscores In Words
       [not found] <mailman.209.1068653145.2005.help-gnu-emacs@gnu.org>
@ 2003-11-12 15:38 ` Stefan Monnier
  2003-11-12 16:33 ` Sandip Chitale
  2003-11-12 18:54 ` kgold
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Monnier @ 2003-11-12 15:38 UTC (permalink / raw)


> Given a variable like "employee_name" is there a way to make emacs treat
> this as one word.  Would be nice when doing commands like "forward-word"
> which treats employee_name as two words.  

Use forward-sexp which does just that in this case.


        Stefan

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

* Re: C++ Mode:  Interpretation of Underscores In Words
       [not found] <mailman.209.1068653145.2005.help-gnu-emacs@gnu.org>
  2003-11-12 15:38 ` C++ Mode: Interpretation of Underscores In Words Stefan Monnier
@ 2003-11-12 16:33 ` Sandip Chitale
  2003-11-12 16:57   ` marc0
  2003-11-12 18:54 ` kgold
  2 siblings, 1 reply; 5+ messages in thread
From: Sandip Chitale @ 2003-11-12 16:33 UTC (permalink / raw)



[-- Attachment #1.1: Type: text/plain, Size: 756 bytes --]

The word boundary is controlled by the syntax table. You can change the syntax of _ to be part of the word using modify-syntax.
Do C-h f modify-syntax RET to get help on the defun. This however may affect other features that depend on syntax table.

  "Joe Mama" <spartanquarters@yahoo.com> wrote in message news:mailman.209.1068653145.2005.help-gnu-emacs@gnu.org...
  Hello:

  Given a variable like "employee_name" is there a way to make emacs treat this as one word.  Would be nice when doing commands like "forward-word" which treats employee_name as two words.  

  Thanks in advance.


------------------------------------------------------------------------------
  Do you Yahoo!?
  Protect your identity with Yahoo! Mail AddressGuard

[-- Attachment #1.2: Type: text/html, Size: 1569 bytes --]

[-- Attachment #2: Type: text/plain, Size: 151 bytes --]

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

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

* Re: C++ Mode:  Interpretation of Underscores In Words
  2003-11-12 16:33 ` Sandip Chitale
@ 2003-11-12 16:57   ` marc0
  0 siblings, 0 replies; 5+ messages in thread
From: marc0 @ 2003-11-12 16:57 UTC (permalink / raw)


Sandip Chitale on Wed, 12 Nov 2003 16:33:45 GMT writes:

> <DIV><FONT face=Arial size=2>The word boundary is controlled by the syntax 
> table. You can change the syntax of _ to be part of the word using 
> modify-syntax.</FONT></DIV>
> <DIV><FONT face=Arial size=2>Do C-h f modify-syntax RET to get help on the 
> defun. </FONT><FONT face=Arial size=2>This however may affect other features 

>   <DIV>Given a variable&nbsp;like "employee_name" is there a way to make emacs 
>   treat this as one word.&nbsp; Would be nice when doing&nbsp;commands 
>   like&nbsp;"forward-word" which treats employee_name as two words.&nbsp; </DIV>
>   <DIV>&nbsp;</DIV>

or while in cc-mode:

M-x modify-syntax-entry RET _ RET w RET

but, as Stefan wrote, there are C-M-f and similar.


PS: please stop posting in HTML.

HTML posts are less accessible then plain-text ones, HTML posts make
archives less useful to search with grep & co, they take more space
and bandwith, they are nearly-unreadable for many peoples who have no
HTML redering configuration, and take away (cpu-)time to peoples who
have it.  plain-text is enought for mail, anyone setups its MUA/NR to
display mails with the fonts/colors/font-size he wants, paragraph
separator can be an empty line.

-- 
marc0@autistici.org - 0x4E8899C2

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

* Re: C++ Mode:  Interpretation of Underscores In Words
       [not found] <mailman.209.1068653145.2005.help-gnu-emacs@gnu.org>
  2003-11-12 15:38 ` C++ Mode: Interpretation of Underscores In Words Stefan Monnier
  2003-11-12 16:33 ` Sandip Chitale
@ 2003-11-12 18:54 ` kgold
  2 siblings, 0 replies; 5+ messages in thread
From: kgold @ 2003-11-12 18:54 UTC (permalink / raw)


Joe Mama <spartanquarters@yahoo.com> writes:
> Given a variable like "employee_name" is there a way to make emacs
> treat this as one word.  Would be nice when doing commands like
> "forward-word" which treats employee_name as two words.

Here are the two steps you need to do.  Both are required!

1 - Reconfigure your client to turn off HTML when posting to news
    groups and mailing lists.

2 - Add this to your .emacs:

(add-hook 'c-mode-common-hook
	  (function (lambda ()
		(modify-syntax-entry ?_ "w" c++-mode-syntax-table)
		(modify-syntax-entry ?_ "w" c-mode-syntax-table)
		(modify-syntax-entry ?_ "w" java-mode-syntax-table)
)))


-- 

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

end of thread, other threads:[~2003-11-12 18:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.209.1068653145.2005.help-gnu-emacs@gnu.org>
2003-11-12 15:38 ` C++ Mode: Interpretation of Underscores In Words Stefan Monnier
2003-11-12 16:33 ` Sandip Chitale
2003-11-12 16:57   ` marc0
2003-11-12 18:54 ` kgold
2003-11-12 15:03 Joe Mama

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