diff options
| author | Glenn Morris | 2017-12-20 21:15:43 -0500 |
|---|---|---|
| committer | Glenn Morris | 2017-12-20 21:15:43 -0500 |
| commit | b1cf262a79463f28164ea1c2ffee3c657ce02ea4 (patch) | |
| tree | 4a428c5e0c026c1bb30e5972e78b145335b4b747 /doc | |
| parent | a415a97461cb10d2c6710871f90f57bd1ca34ec2 (diff) | |
| parent | b3f4a3a5aee93fa2f7ad2597383befbf7b242209 (diff) | |
| download | emacs-b1cf262a79463f28164ea1c2ffee3c657ce02ea4.tar.gz emacs-b1cf262a79463f28164ea1c2ffee3c657ce02ea4.zip | |
Merge from origin/emacs-26
b3f4a3a (origin/emacs-26) Special-case %DUMBFW for GnuTLS between 3.2...
c2ae057 Work around GnuTLS version issues with %DUMBFW (tiny change)
2f9d9ef ; Remove the mention of "plain C code" in the docstring as well
aca827b Merge branch 'widen-less' into emacs-26
87548f5 ; Rephrase NEWS entry a bit
da0d773 (emacs-26) ; * lisp/erc/erc.el: Update URL.
3a60515 * lisp/erc/erc.el (erc-shorten-server-name): Silence compiler...
471b6c1 ; Replace non-ascii quote characters in doc strings etc
7af7f5e Fix some more aliases to user options
79fb4b5 Fix some flymake aliases
b9fbc03 (origin/widen-less) Widen in indent-for-tab-command in the no...
446faf3 Replace the mention of c-indent-defun with js-indent-line
7e9eef0 Consolidate 'widen' calls
# Conflicts:
# etc/NEWS
# lisp/progmodes/flymake-proc.el
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/lispref/text.texi | 56 |
1 files changed, 10 insertions, 46 deletions
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index 9592702ef1c..561ad804344 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi | |||
| @@ -2397,57 +2397,31 @@ text at point (@pxref{Completion in Buffers}). | |||
| 2397 | syntax belongs to a different major mode. Examples include | 2397 | syntax belongs to a different major mode. Examples include |
| 2398 | @dfn{literate programming} source files that combine documentation and | 2398 | @dfn{literate programming} source files that combine documentation and |
| 2399 | snippets of source code, Yacc/Bison programs that include snippets of | 2399 | snippets of source code, Yacc/Bison programs that include snippets of |
| 2400 | plain C code, etc. To correctly indent the embedded chunks, the major | 2400 | Python or JS code, etc. To correctly indent the embedded chunks, the primary |
| 2401 | mode needs to delegate the indentation to another mode's indentation | 2401 | mode needs to delegate the indentation to another mode's indentation |
| 2402 | engine (e.g., call @code{c-indent-defun} for C code or | 2402 | engine (e.g., call @code{js-indent-line} for JS code or |
| 2403 | @code{python-indent-line} for Python), while providing it with some | 2403 | @code{python-indent-line} for Python), while providing it with some |
| 2404 | context to guide the indentation. The following facilities support | 2404 | context to guide the indentation. Major modes, for their part, should |
| 2405 | such multi-mode indentation. | 2405 | avoid calling @code{widen} in their indentation code and obey |
| 2406 | @code{prog-first-column}. | ||
| 2406 | 2407 | ||
| 2407 | @defvar prog-indentation-context | 2408 | @defvar prog-indentation-context |
| 2408 | This variable, when non-@code{nil}, holds the indentation context for | 2409 | This variable, when non-@code{nil}, holds the indentation context for |
| 2409 | the sub-mode's indentation engine provided by the superior major mode. | 2410 | the sub-mode's indentation engine provided by the superior major mode. |
| 2410 | The value should be a list of the form @code{(@var{first-column} | 2411 | The value should be a list of the form @code{(@var{first-column} . @var{rest}}. |
| 2411 | @w{(@var{start} . @var{end})} @code{prev-chunk})}. The members of the | 2412 | The members of the list have the following meaning: |
| 2412 | list have the following meaning: | ||
| 2413 | 2413 | ||
| 2414 | @table @var | 2414 | @table @var |
| 2415 | @item first-column | 2415 | @item first-column |
| 2416 | The column to be used for top-level constructs. This replaces the | 2416 | The column to be used for top-level constructs. This replaces the |
| 2417 | default value of the top-level column used by the sub-mode, usually | 2417 | default value of the top-level column used by the sub-mode, usually |
| 2418 | zero. | 2418 | zero. |
| 2419 | @item start | 2419 | @item rest |
| 2420 | @itemx end | 2420 | This value is currently unused. |
| 2421 | The region of the code chunk to be indented by the sub-mode. The | ||
| 2422 | value of @var{end} can be @code{nil}, which stands for the value of | ||
| 2423 | @code{point-max}. | ||
| 2424 | @item prev-chunk | ||
| 2425 | If this is non-@code{nil}, it should provide the sub-mode's | ||
| 2426 | indentation engine with a virtual context of the code chunk. Valid | ||
| 2427 | values include: | ||
| 2428 | |||
| 2429 | @itemize @minus | ||
| 2430 | @item | ||
| 2431 | A string whose contents is the text the sub-mode's indentation engine | ||
| 2432 | should consider to precede the code chunk. The sub-mode's indentation | ||
| 2433 | engine can add text properties to that string, to be reused in | ||
| 2434 | repeated calls with the same string, thus using it as a cache. An | ||
| 2435 | example where this is useful is code chunks that need to be indented | ||
| 2436 | as function bodies, but lack the function's preamble---the string | ||
| 2437 | could then include that missing preamble. | ||
| 2438 | @item | ||
| 2439 | A function. It is expected to be called with the start position of | ||
| 2440 | the current chunk, and should return a cons cell | ||
| 2441 | @w{@code{(@var{prev-start} . @var{prev-end})}} that specifies the | ||
| 2442 | region of the previous code chunk, or @code{nil} if there is no previous | ||
| 2443 | chunk. This is useful in literate-programming sources, where code is | ||
| 2444 | split into chunks, and correct indentation needs to access previous | ||
| 2445 | chunks. | ||
| 2446 | @end itemize | ||
| 2447 | @end table | 2421 | @end table |
| 2448 | @end defvar | 2422 | @end defvar |
| 2449 | 2423 | ||
| 2450 | The following convenience functions should be used by major mode's | 2424 | The following convenience function should be used by major mode's |
| 2451 | indentation engine in support of invocations as sub-modes of another | 2425 | indentation engine in support of invocations as sub-modes of another |
| 2452 | major mode. | 2426 | major mode. |
| 2453 | 2427 | ||
| @@ -2458,16 +2432,6 @@ function's value is the column number to use for top-level constructs. | |||
| 2458 | When no superior mode is in effect, this function returns zero. | 2432 | When no superior mode is in effect, this function returns zero. |
| 2459 | @end defun | 2433 | @end defun |
| 2460 | 2434 | ||
| 2461 | @defun prog-widen | ||
| 2462 | Call this function instead of @code{widen} to remove any restrictions | ||
| 2463 | imposed by the mode's indentation engine and restore the restrictions | ||
| 2464 | recorded in @code{prog-indentation-context}. This prevents the | ||
| 2465 | indentation engine of a sub-mode from inadvertently operating on text | ||
| 2466 | outside of the chunk it was supposed to indent, and preserves the | ||
| 2467 | restriction imposed by the superior mode. When no superior mode is in | ||
| 2468 | effect, this function just calls @code{widen}. | ||
| 2469 | @end defun | ||
| 2470 | |||
| 2471 | 2435 | ||
| 2472 | @node Region Indent | 2436 | @node Region Indent |
| 2473 | @subsection Indenting an Entire Region | 2437 | @subsection Indenting an Entire Region |