Add 2008 to copyright years.
[bpt/emacs.git] / man / programs.texi
index 5cd7694..b1c196b 100644 (file)
@@ -1,6 +1,6 @@
 @c This is part of the Emacs manual.
 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 1999, 2000,
-@c   2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+@c   2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 @c See file emacs.texi for copying conditions.
 @node Programs, Building, Text, Top
 @chapter Editing Programs
@@ -42,6 +42,9 @@ Highlight program syntax (@pxref{Font Lock}).
 * C Modes::             Special commands of C, C++, Objective-C,
                           Java, and Pike modes.
 * Asm Mode::            Asm mode and its special features.
+@ifnottex
+* Fortran::             Fortran mode and its special features.
+@end ifnottex
 @end menu
 
 @node Program Modes
@@ -109,7 +112,14 @@ tab character before point, in these modes.
 Mode, ada-mode, Ada Mode}), C/C++/Objective C/Java/Corba IDL/Pike/AWK
 (@pxref{Top, , CC Mode, ccmode, CC Mode}) and the IDLWAVE modes
 (@pxref{Top, , IDLWAVE, idlwave, IDLWAVE User Manual}).  For Fortran
-mode, @inforef{Fortran,, emacs-xtra}.
+mode, see
+@iftex
+@ref{Fortran,,, emacs-xtra, Specialized Emacs Features}.
+@end iftex
+@ifnottex
+@ref{Fortran}.
+@end ifnottex
+
 
 @cindex mode hook
 @vindex c-mode-hook
@@ -146,23 +156,11 @@ from Lisp, but in Emacs we use it for all languages.
 @cindex open-parenthesis in leftmost column
 @cindex ( in leftmost column
   Emacs assumes by default that any opening delimiter found at the
-left margin is the start of a top-level definition, or defun.  You can
-override this default by setting this user option:
-
-@defvar open-paren-in-column-0-is-defun-start
-If this user option is set to @code{t} (the default), opening
-parentheses or braces at column zero always start defuns.  When it's
-@code{nil}, defuns are found by searching for parens or braces at the
-outermost level.  Some major modes, including C and related modes, set
-@code{open-paren-in-column-0-is-defun-start} buffer-locally to
-@code{nil}
-@end defvar
-
-  In modes where @code{open-paren-in-column-0-is-defun-start} is
-@code{t}, @strong{don't put an opening delimiter at the left margin
-unless it is a defun start}.  For instance, never put an
+left margin is the start of a top-level definition, or defun.
+Therefore, @strong{don't put an opening delimiter at the left margin
+unless it should have that significance}.  For instance, never put an
 open-parenthesis at the left margin in a Lisp file unless it is the
-start of a top-level list.
+start of a top-level list.  
 
   If you don't follow this convention, not only will you have trouble
 when you explicitly use the commands for motion by defuns; other
@@ -172,10 +170,10 @@ mode (@pxref{Font Lock}).
 
   The most likely problem case is when you want an opening delimiter
 at the start of a line inside a string.  To avoid trouble, put an
-escape character (@samp{\}, in Emacs Lisp, @samp{/} in some other Lisp
-dialects) before the opening delimiter.  This will not affect the
-contents of the string, but will prevent that opening delimiter from
-starting a defun.  Here's an example:
+escape character (@samp{\}, in C and Emacs Lisp, @samp{/} in some
+other Lisp dialects) before the opening delimiter.  This will not
+affect the contents of the string, but will prevent that opening
+delimiter from starting a defun.  Here's an example:
 
 @example
   (insert "Foo:
@@ -187,6 +185,25 @@ starting a defun.  Here's an example:
 highlights confusing opening delimiters (those that ought to be
 quoted) in bold red.
 
+If you need to override this convention, you can so by setting this
+user option:
+
+@defvar open-paren-in-column-0-is-defun-start
+If this user option is set to @code{t} (the default), opening
+parentheses or braces at column zero always start defuns.  When it's
+@code{nil}, defuns are found by searching for parens or braces at the
+outermost level.
+@end defvar
+
+  Usually, you shouldn't need to set
+@code{open-paren-in-column-0-is-defun-start} to @code{nil}.  However,
+if your buffer contains parentheses or braces in column zero which
+don't start defuns and this confuses Emacs, it sometimes helps to set
+the option to @code{nil}.  Be aware, though, that this will make
+scrolling and display in large buffers quite sluggish, and that
+parentheses and braces must be correctly matched throughout the buffer
+for it to work properly.
+
   In the earliest days, the original Emacs found defuns by moving
 upward a level of parentheses or braces until there were no more
 levels to go up.  This always required scanning all the way back to
@@ -321,13 +338,13 @@ buffer.
 
 @findex which-function-mode
 @vindex which-func-modes
-  To enable (or disable) Which Function mode, use the command @kbd{M-x
-which-function-mode}.  This command is global; it applies to all
-buffers, both existing ones and those yet to be created.  However, it
-takes effect only in certain major modes, those listed in the value of
-@code{which-func-modes}.  If the value is @code{t}, then Which Function
-mode applies to all major modes that know how to support it---in other
-words, all the major modes that support Imenu.
+  To either enable or disable Which Function mode, use the command
+@kbd{M-x which-function-mode}.  This command is global; it applies to
+all buffers, both existing ones and those yet to be created.  However,
+it takes effect only in certain major modes, those listed in the value
+of @code{which-func-modes}.  If the value is @code{t}, then Which
+Function mode applies to all major modes that know how to support
+it---in other words, all the major modes that support Imenu.
 
 @node Program Indent
 @section Indentation for Programs
@@ -356,6 +373,7 @@ This program reformats a Lisp object with indentation chosen to look nice.
   The basic indentation commands indent a single line according to the
 usual conventions of the language you are editing.
 
+@need 1000
 @table @kbd
 @item @key{TAB}
 Adjust indentation of current line.
@@ -387,9 +405,10 @@ the characters around it.
 @findex newline-and-indent
   When entering lines of new code, use @kbd{C-j}
 (@code{newline-and-indent}), which inserts a newline and then adjusts
-indentation after it.  Thus, @kbd{C-j} at the end of a line creates a
-blank line with appropriate indentation.  In programming language
-modes, it is equivalent to @key{RET} @key{TAB}.
+indentation after it.  (It also deletes any trailing whitespace which
+remains before the new newline.)  Thus, @kbd{C-j} at the end of a line
+creates a blank line with appropriate indentation.  In programming
+language modes, it is equivalent to @key{RET} @key{TAB}.
 
   @key{TAB} indents a line that starts within a parenthetical grouping
 under the preceding line within the grouping, or the text after the
@@ -938,15 +957,16 @@ comment delimiters to add or how many to delete.
 comments in certain contexts.  For example, in Lisp code, comments which
 start with two semicolons are indented as if they were lines of code,
 instead of at the comment column.  Comments which start with three
-semicolons are supposed to start at the left margin.  Emacs understands
+semicolons are supposed to start at the left margin and are often used
+for sectioning purposes.  Emacs understands
 these conventions by indenting a double-semicolon comment using @key{TAB},
 and by not changing the indentation of a triple-semicolon comment at all.
 
 @example
-;; This function is just an example
+;; This function is just an example.
 ;;; Here either two or three semicolons are appropriate.
 (defun foo (x)
-;;; And now, the first part of the function:
+;;;  And now, the first part of the function:
   ;; The following line adds one.
   (1+ x))           ; This line adds one.
 @end example
@@ -1105,7 +1125,7 @@ You can also use @kbd{M-x info-lookup-file} to look for documentation
 for a file name.
 
   If you use @kbd{C-h S} in a major mode that does not support it,
-it asks you to specify the ``symbol help mode''.  You should enter
+it asks you to specify the ``symbol help mode.''  You should enter
 a command such as @code{c-mode} that would select a major
 mode which @kbd{C-h S} does support.
 
@@ -1310,9 +1330,12 @@ symbol names.
   The character @kbd{M-@key{TAB}} runs a command to complete the
 partial symbol before point against the set of meaningful symbol
 names.  This command inserts at point any additional characters that
-it can determine from the partial name.  (If your window manager
-defines @kbd{M-@key{TAB}} to switch windows, you can type
-@kbd{@key{ESC} @key{TAB}} or @kbd{C-M-i}.)
+it can determine from the partial name.
+
+  If your window manager defines @kbd{M-@key{TAB}} to switch windows,
+you can type @kbd{@key{ESC} @key{TAB}} or @kbd{C-M-i} instead.
+However, most window managers let you customize these shortcuts, and
+we recommend that you change any that get in the way of use of Emacs.
 
   If the partial name in the buffer has multiple possible completions
 that differ in the very next character, so that it is impossible to
@@ -1544,10 +1567,10 @@ preprocessor commands.
 @table @kbd
 @item C-c C-@key{DEL}
 @itemx C-c @key{DEL}
-@findex c-hungry-backspace
+@findex c-hungry-delete-backwards
 @kindex C-c C-@key{DEL} (C Mode)
 @kindex C-c @key{DEL} (C Mode)
-@code{c-hungry-backspace}---Delete the entire block of whitespace
+@code{c-hungry-delete-backwards}---Delete the entire block of whitespace
 preceding point.
 
 @item C-c C-d
@@ -1590,7 +1613,7 @@ hungry-delete feature is enabled.
 @itemx M-x c-subword-mode
 @findex c-subword-mode
 Enable (or disable) @dfn{subword mode}.  In subword mode, Emacs's word
-commands then recognize upper case letters in
+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 c-subword-mode} in
@@ -1612,11 +1635,11 @@ needs a binding to be useful.  The following code will bind it to
 @kbd{C-j}.  We use @code{c-initialization-hook} here to make sure
 the keymap is loaded before we try to change it.
 
-@example
+@smallexample
 (defun my-bind-clb ()
   (define-key c-mode-base-map "\C-j" 'c-context-line-break))
 (add-hook 'c-initialization-hook 'my-bind-clb)
-@end example
+@end smallexample
 
 @item C-M-h
 Put mark at the end of a function definition, and put point at the
@@ -1741,6 +1764,10 @@ Insert or align a comment.
   The variable @code{asm-comment-char} specifies which character
 starts comments in assembler syntax.
 
+@ifnottex
+@include fortran-xtra.texi
+@end ifnottex
+
 @ignore
    arch-tag: c7ee7409-40a4-45c7-bfb7-ae7f2c74d0c0
 @end ignore