diff options
| author | Paul Eggert | 2011-10-29 10:33:13 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-10-29 10:33:13 -0700 |
| commit | 8d0eb4c275581847990b85dbb350caa3df9e653f (patch) | |
| tree | c161f977d59ac3103b04dc0f4aea57c83436a456 /doc | |
| parent | 929bb973dd3faf1655f03ac758942d5b009354ad (diff) | |
| parent | 196e41e4aec1a44ec5b6e9bed485185ba872ae67 (diff) | |
| download | emacs-8d0eb4c275581847990b85dbb350caa3df9e653f.tar.gz emacs-8d0eb4c275581847990b85dbb350caa3df9e653f.zip | |
Merge from trunk.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/misc/ChangeLog | 12 | ||||
| -rw-r--r-- | doc/misc/cc-mode.texi | 108 |
2 files changed, 120 insertions, 0 deletions
diff --git a/doc/misc/ChangeLog b/doc/misc/ChangeLog index 6b0ef9c5d8b..10a0d5e7a91 100644 --- a/doc/misc/ChangeLog +++ b/doc/misc/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2011-10-28 Alan Mackenzie <acm@muc.de> | ||
| 2 | |||
| 3 | * cc-mode.texi (Indentation Commands): Mention "macros with semicolons". | ||
| 4 | (Other Special Indentations): Add an xref to "Macros with ;". | ||
| 5 | (Customizing Macros): Add stuff about syntax in macros. Add an xref to | ||
| 6 | "Macros with ;". | ||
| 7 | (Macros with ;): New page. | ||
| 8 | |||
| 9 | * progmodes/cc-mode.texi (Movement Commands): Document | ||
| 10 | `c-defun-tactic'. Document the new handling of nested scopes for | ||
| 11 | movement by defuns. | ||
| 12 | |||
| 1 | 2011-10-23 Michael Albinus <michael.albinus@gmx.de> | 13 | 2011-10-23 Michael Albinus <michael.albinus@gmx.de> |
| 2 | 14 | ||
| 3 | Sync with Tramp 2.2.3. | 15 | Sync with Tramp 2.2.3. |
diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi index a9339162666..887e3f3c808 100644 --- a/doc/misc/cc-mode.texi +++ b/doc/misc/cc-mode.texi | |||
| @@ -341,6 +341,11 @@ Line-Up Functions | |||
| 341 | * Comment Line-Up:: | 341 | * Comment Line-Up:: |
| 342 | * Misc Line-Up:: | 342 | * Misc Line-Up:: |
| 343 | 343 | ||
| 344 | Customizing Macros | ||
| 345 | |||
| 346 | * Macro Backslashes:: | ||
| 347 | * Macros with ;:: | ||
| 348 | |||
| 344 | @end detailmenu | 349 | @end detailmenu |
| 345 | @end menu | 350 | @end menu |
| 346 | 351 | ||
| @@ -655,6 +660,10 @@ expression, to some statements, or perhaps to whole functions, the | |||
| 655 | syntactic recognition can be wrong. @ccmode{} manages to figure it | 660 | syntactic recognition can be wrong. @ccmode{} manages to figure it |
| 656 | out correctly most of the time, though. | 661 | out correctly most of the time, though. |
| 657 | 662 | ||
| 663 | Some macros, when invoked, ''have their own semicolon''. To get the | ||
| 664 | next line indented correctly, rather than as a continuation line, | ||
| 665 | @xref{Macros with ;}. | ||
| 666 | |||
| 658 | Reindenting large sections of code can take a long time. When | 667 | Reindenting large sections of code can take a long time. When |
| 659 | @ccmode{} reindents a region of code, it is essentially equivalent to | 668 | @ccmode{} reindents a region of code, it is essentially equivalent to |
| 660 | hitting @key{TAB} on every line of the region. | 669 | hitting @key{TAB} on every line of the region. |
| @@ -882,6 +891,8 @@ lines. | |||
| 882 | @itemx @kbd{C-M-e} (@code{c-end-of-defun}) | 891 | @itemx @kbd{C-M-e} (@code{c-end-of-defun}) |
| 883 | @findex c-beginning-of-defun | 892 | @findex c-beginning-of-defun |
| 884 | @findex c-end-of-defun | 893 | @findex c-end-of-defun |
| 894 | @vindex c-defun-tactic | ||
| 895 | @vindex defun-tactic (c-) | ||
| 885 | 896 | ||
| 886 | Move to the beginning or end of the current or next function. Other | 897 | Move to the beginning or end of the current or next function. Other |
| 887 | constructs (such as a structs or classes) which have a brace block | 898 | constructs (such as a structs or classes) which have a brace block |
| @@ -895,6 +906,15 @@ commands try to leave point at the beginning of a line near the actual | |||
| 895 | start or end of the function. This occasionally causes point not to | 906 | start or end of the function. This occasionally causes point not to |
| 896 | move at all. | 907 | move at all. |
| 897 | 908 | ||
| 909 | By default, these commands will recognize functions contained within a | ||
| 910 | @dfn{declaration scope} such as a C++ @code{class} or @code{namespace} | ||
| 911 | construct, should the point start inside it. If @ccmode fails to find | ||
| 912 | function beginnings or ends inside the current declaration scope, it | ||
| 913 | will search the enclosing scopes. If you want @ccmode to recognize | ||
| 914 | functions only at the top level@footnote{this was @ccmode{}'s | ||
| 915 | behaviour prior to version 5.32.}, set @code{c-defun-tatic} to | ||
| 916 | @code{t}. | ||
| 917 | |||
| 898 | These functions are analogous to the Emacs built-in commands | 918 | These functions are analogous to the Emacs built-in commands |
| 899 | @code{beginning-of-defun} and @code{end-of-defun}, except they | 919 | @code{beginning-of-defun} and @code{end-of-defun}, except they |
| 900 | eliminate the constraint that the top-level opening brace of the defun | 920 | eliminate the constraint that the top-level opening brace of the defun |
| @@ -6550,6 +6570,9 @@ custom line-up function associated with it. | |||
| 6550 | @section Other Special Indentations | 6570 | @section Other Special Indentations |
| 6551 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 6571 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 6552 | 6572 | ||
| 6573 | To configure macros which you invoke without a terminating @samp{;}, | ||
| 6574 | see @xref{Macros with ;}. | ||
| 6575 | |||
| 6553 | Here are the remaining odds and ends regarding indentation: | 6576 | Here are the remaining odds and ends regarding indentation: |
| 6554 | 6577 | ||
| 6555 | @defopt c-label-minimum-indentation | 6578 | @defopt c-label-minimum-indentation |
| @@ -6601,6 +6624,13 @@ functions to this hook, not remove them. @xref{Style Variables}. | |||
| 6601 | @cindex preprocessor directives | 6624 | @cindex preprocessor directives |
| 6602 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 6625 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 6603 | 6626 | ||
| 6627 | Preprocessor macros in C, C++, and Objective C (introduced by | ||
| 6628 | @code{#define}) have a syntax different from the main language---for | ||
| 6629 | example, a macro declaration is not terminated by a semicolon, and if | ||
| 6630 | it is more than a line long, line breaks in it must be escaped with | ||
| 6631 | backslashes. @ccmode{} has some commands to manipulate these, see | ||
| 6632 | @ref{Macro Backslashes}. | ||
| 6633 | |||
| 6604 | Normally, the lines in a multi-line macro are indented relative to | 6634 | Normally, the lines in a multi-line macro are indented relative to |
| 6605 | each other as though they were code. You can suppress this behavior | 6635 | each other as though they were code. You can suppress this behavior |
| 6606 | by setting the following user option: | 6636 | by setting the following user option: |
| @@ -6612,6 +6642,28 @@ is @code{nil}, all lines inside macro definitions are analyzed as | |||
| 6612 | @code{cpp-macro-cont}. | 6642 | @code{cpp-macro-cont}. |
| 6613 | @end defopt | 6643 | @end defopt |
| 6614 | 6644 | ||
| 6645 | Because a macro can expand into anything at all, near where one is | ||
| 6646 | invoked @ccmode{} can only indent and fontify code heuristically. | ||
| 6647 | Sometimes it gets it wrong. Usually you should try to design your | ||
| 6648 | macros so that they ''look like ordinary code'' when you invoke them. | ||
| 6649 | However, one situation is so common that @ccmode{} handles it | ||
| 6650 | specially: that is when certain macros needn't (or mustn't) be | ||
| 6651 | followed by a @samp{;}. You need to configure @ccmode{} to handle | ||
| 6652 | these macros properly, see @ref{Macros with ;}. | ||
| 6653 | |||
| 6654 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| 6655 | @menu | ||
| 6656 | * Macro Backslashes:: | ||
| 6657 | * Macros with ;:: | ||
| 6658 | @end menu | ||
| 6659 | |||
| 6660 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| 6661 | @node Macro Backslashes, Macros with ;, Custom Macros, Custom Macros | ||
| 6662 | @comment node-name, next, previous, up | ||
| 6663 | @section Customizing Macro Backslashes | ||
| 6664 | @cindex #define | ||
| 6665 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| 6666 | |||
| 6615 | @ccmode{} provides some tools to help keep the line continuation | 6667 | @ccmode{} provides some tools to help keep the line continuation |
| 6616 | backslashes in macros neat and tidy. Their precise action is | 6668 | backslashes in macros neat and tidy. Their precise action is |
| 6617 | customized with these variables: | 6669 | customized with these variables: |
| @@ -6654,6 +6706,62 @@ get aligned only when you explicitly invoke the command | |||
| 6654 | @end defopt | 6706 | @end defopt |
| 6655 | 6707 | ||
| 6656 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 6708 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 6709 | @node Macros with ;, , Macro Backslashes, Custom Macros | ||
| 6710 | @comment node-name, next, previous, up | ||
| 6711 | @section Macros with semicolons | ||
| 6712 | @cindex macros with semicolons | ||
| 6713 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| 6714 | Macros which needn't (or mustn't) be followed by a semicolon when you | ||
| 6715 | invoke them, @dfn{macros with semicolons}, are very common. These can | ||
| 6716 | cause @ccmode{} to parse the next line wrongly as a | ||
| 6717 | @code{statement-cont} (@pxref{Function Symbols}) and thus mis-indent | ||
| 6718 | it. | ||
| 6719 | |||
| 6720 | You can prevent this by specifying which macros have semicolons. It | ||
| 6721 | doesn't matter whether or not such a macro has a parameter list: | ||
| 6722 | |||
| 6723 | @defopt c-macro-names-with-semicolon | ||
| 6724 | @vindex macro-names-with-semicolon (c-) | ||
| 6725 | This buffer-local variable specifies which macros have semicolons. | ||
| 6726 | After setting its value, you need to call | ||
| 6727 | @code{c-make-macro-with-semi-re} for it to take effect. It should be | ||
| 6728 | set to one of these values: | ||
| 6729 | |||
| 6730 | @table @asis | ||
| 6731 | @item nil | ||
| 6732 | There are no macros with semicolons. | ||
| 6733 | @item a list of strings | ||
| 6734 | Each string is the name of a macro with a semicolon. Only valid | ||
| 6735 | @code{#define} names are allowed here. For example, to set the | ||
| 6736 | default value, you could write the following into your @file{.emacs}: | ||
| 6737 | |||
| 6738 | @example | ||
| 6739 | (setq c-macro-names-with-semicolon | ||
| 6740 | '("Q_OBJECT" "Q_PROPERTY" "Q_DECLARE" "Q_ENUMS")) | ||
| 6741 | @end example | ||
| 6742 | |||
| 6743 | @item a regular expression | ||
| 6744 | This matches each symbol which is a macro with a semicolon. It must | ||
| 6745 | not match any string which isn't a valid @code{#define} name. For | ||
| 6746 | example: | ||
| 6747 | |||
| 6748 | @example | ||
| 6749 | (setq c-macro-names-with-semicolon | ||
| 6750 | "\\<\\(CLEAN_UP_AND_RETURN\\|Q_[[:upper:]]+\\)\\>") | ||
| 6751 | @end example | ||
| 6752 | @end table | ||
| 6753 | @end defopt | ||
| 6754 | |||
| 6755 | @defun c-make-macro-with-semi-re | ||
| 6756 | @findex make-macro-with-semi-re (c-) | ||
| 6757 | Call this (non-interactive) function, which sets internal variables, | ||
| 6758 | each time you change the value of | ||
| 6759 | @code{c-macro-names-with-semicolon}. It takes no arguments, and its | ||
| 6760 | return value has no meaning. This function is called by @ccmode{}'s | ||
| 6761 | initialization code. | ||
| 6762 | @end defun | ||
| 6763 | |||
| 6764 | @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
| 6657 | @node Odds and Ends, Sample .emacs File, Custom Macros, Top | 6765 | @node Odds and Ends, Sample .emacs File, Custom Macros, Top |
| 6658 | @comment node-name, next, previous, up | 6766 | @comment node-name, next, previous, up |
| 6659 | @chapter Odds and Ends | 6767 | @chapter Odds and Ends |