From: Glenn Morris Date: Sun, 9 Feb 2014 02:08:17 +0000 (-0800) Subject: Doc for subword, superword modes X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~84 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6995e5d0e54a41851bc6ce04d1c50749f531b077;p=emacs.git Doc for subword, superword modes * doc/emacs/programs.texi (MixedCase Words): Rename node from "Glasses". Move Subword mode here from "Other C Commands" node. (Misc for Programs): Mention Superword mode. * doc/emacs/emacs.texi: Update menu. * etc/NEWS: Related markup. --- diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index 97acd1c212f..64587ae097d 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,3 +1,10 @@ +2014-02-09 Glenn Morris + + * programs.texi (MixedCase Words): Rename node from "Glasses". + Move Subword mode here from "Other C Commands" node. + (Misc for Programs): Mention Superword mode. + * emacs.texi: Update menu. + 2014-02-08 Lars Ingebrigtsen * regs.texi (File Registers): Clarify metasyntactical variables diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index acd17d4d327..ee612643fea 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -668,7 +668,7 @@ Editing Programs * Documentation:: Getting documentation of functions you plan to call. * Hideshow:: Displaying blocks selectively. * Symbol Completion:: Completion on symbol names of your program or language. -* Glasses:: Making identifiersLikeThis more readable. +* MixedCase Words:: Dealing with identifiersLikeThis. * Semantic:: Suite of editing tools based on source code parsing. * Misc for Programs:: Other Emacs features useful for editing programs. * C Modes:: Special commands of C, C++, Objective-C, diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index 8e62a031293..23d1f9fa20e 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -1,3 +1,4 @@ +@c -*- coding: utf-8 -*- @c This is part of the Emacs manual. @c Copyright (C) 1985-1987, 1993-1995, 1997, 1999-2014 Free Software @c Foundation, Inc. @@ -35,7 +36,7 @@ Highlight program syntax (@pxref{Font Lock}). * Documentation:: Getting documentation of functions you plan to call. * Hideshow:: Displaying blocks selectively. * Symbol Completion:: Completion on symbol names of your program or language. -* Glasses:: Making identifiersLikeThis more readable. +* MixedCase Words:: Dealing with identifiersLikeThis. * Semantic:: Suite of editing tools based on source code parsing. * Misc for Programs:: Other Emacs features useful for editing programs. * C Modes:: Special commands of C, C++, Objective-C, Java, @@ -1335,24 +1336,37 @@ another window. @xref{Completion}. In Text mode and related modes, @kbd{M-@key{TAB}} completes words based on the spell-checker's dictionary. @xref{Spelling}. -@node Glasses -@section Glasses minor mode -@cindex Glasses mode +@node MixedCase Words +@section MixedCase Words @cindex camel case -@findex mode, Glasses - Glasses mode is a buffer-local minor mode that makes it easier to -read mixed-case (or ``CamelCase'') symbols like -@samp{unReadableSymbol}, by altering how they are displayed. By -default, it displays extra underscores between each lower-case letter -and the following capital letter. This does not alter the buffer -text, only how it is displayed. + Some programming styles make use of mixed-case (or ``CamelCase'') +symbols like @samp{unReadableSymbol}. (In the GNU project, we recommend +using underscores to separate words within an identifier, rather than +using case distinctions.) Emacs has various features to make it easier +to deal with such symbols. + +@cindex Glasses mode +@findex mode, Glasses + Glasses mode is a buffer-local minor mode that makes it easier to read +such symbols, by altering how they are displayed. By default, it +displays extra underscores between each lower-case letter and the +following capital letter. This does not alter the buffer text, only how +it is displayed. To toggle Glasses mode, type @kbd{M-x glasses-mode} (@pxref{Minor Modes}). When Glasses mode is enabled, the minor mode indicator @samp{o^o} appears in the mode line. For more information about Glasses mode, type @kbd{C-h P glasses @key{RET}}. +@cindex Subword mode +@findex subword-mode + Subword mode is another buffer-local minor mode. In subword mode, +Emacs's word commands recognize upper case letters in +@samp{StudlyCapsIdentifiers} as word boundaries. When Subword mode is +enabled, the minor mode indicator @samp{,} appears in the mode line. +See also the similar @code{superword-mode} (@pxref{Misc for Programs}). + @node Semantic @section Semantic @cindex Semantic package @@ -1438,6 +1452,19 @@ paragraph commands to work on. Auto Fill mode, if enabled in a programming language major mode, indents the new lines which it creates. +@findex superword-mode + Superword mode is a buffer-local minor mode that causes editing and +motion commands to treat symbols (e.g., @samp{this_is_a_symbol}) as words. +When Subword mode is enabled, the minor mode indicator +@iftex +@samp{@math{^2}} +@end iftex +@ifnottex +@samp{²} +@end ifnottex +appears in the mode line. See also the similar @code{subword-mode} +(@pxref{MixedCase Words}). + @findex electric-layout-mode Electric Layout mode (@kbd{M-x electric-layout-mode}) is a global minor mode that automatically inserts newlines when you type certain @@ -1650,19 +1677,6 @@ hungry-delete feature is enabled. @subsection Other Commands for C Mode @table @kbd -@item C-c C-w -@itemx M-x subword-mode -@findex subword-mode -Enable (or disable) @dfn{subword mode}. In subword mode, Emacs's word -commands recognize upper case letters in -@samp{StudlyCapsIdentifiers} as word boundaries. This is indicated by -the flag @samp{/w} on the mode line after the mode name -(e.g., @samp{C/law}). You can even use @kbd{M-x subword-mode} in -non-CC Mode buffers. - -In the GNU project, we recommend using underscores to separate words -within an identifier in C or C++, rather than using case distinctions. - @item M-x c-context-line-break @findex c-context-line-break This command inserts a line break and indents the new line in a manner diff --git a/etc/NEWS b/etc/NEWS index 35e673a8076..9c0d0398d73 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -937,6 +937,7 @@ are obsolete. Customize the `woman-*' faces instead. ** New package `eww' is a built-in web browser. It is only available if Emacs is compiled with libxml2 support. ++++ ** New minor mode `superword-mode'. This overrides the default word motion commands to treat "symbol_words" as a single word, similar to what `subword-mode' does.