Now on revision 106600. ------------------------------------------------------------ revno: 106600 committer: Chong Yidong branch nick: trunk timestamp: Sun 2011-12-04 13:55:36 +0800 message: More updates to Text chapter of Emacs manual. * text.texi (Nroff Mode): Mention what nroff is. (Text Based Tables, Table Recognition): Don't say "Table mode" since it's not a major or minor mode. (Text Based Tables): Reduce the size of the example. (Table Definition): Clarify definitions. (Table Creation): Add key table. (Cell Commands): Use kbd for commands. (Table Rows and Columns): Combine nodes Row Commands and Column Commands. (Fixed Width Mode): Node deleted; contents moved to parent. (Table Conversion): Shorten example. (Measuring Tables): Merge into Table Misc. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2011-12-03 16:17:29 +0000 +++ doc/emacs/ChangeLog 2011-12-04 05:55:36 +0000 @@ -1,3 +1,18 @@ +2011-12-04 Chong Yidong + + * text.texi (Nroff Mode): Mention what nroff is. + (Text Based Tables, Table Recognition): Don't say "Table mode" + since it's not a major or minor mode. + (Text Based Tables): Reduce the size of the example. + (Table Definition): Clarify definitions. + (Table Creation): Add key table. + (Cell Commands): Use kbd for commands. + (Table Rows and Columns): Combine nodes Row Commands and Column + Commands. + (Fixed Width Mode): Node deleted; contents moved to parent. + (Table Conversion): Shorten example. + (Measuring Tables): Merge into Table Misc. + 2011-12-03 Chong Yidong * text.texi (TeX Mode): Mention AUCTeX package. === modified file 'doc/emacs/emacs.texi' --- doc/emacs/emacs.texi 2011-12-03 16:17:29 +0000 +++ doc/emacs/emacs.texi 2011-12-04 05:55:36 +0000 @@ -39,7 +39,7 @@ @c in general, keep the following line commented out, unless doing a @c copy of this manual that will be published. The manual should go @c onto the distribution in the full, 8.5 x 11" size. -@c @smallbook +@smallbook @ifset smallbook @smallbook @@ -602,11 +602,8 @@ * Table Recognition:: How to activate and deactivate tables. * Cell Commands:: Cell-oriented commands in a table. * Cell Justification:: Justifying cell contents. -* Row Commands:: Manipulating rows of table cell. -* Column Commands:: Manipulating columns of table cell. -* Fixed Width Mode:: Fixing cell width. +* Table Rows and Columns:: Inserting and deleting rows and columns. * Table Conversion:: Converting between plain text and tables. -* Measuring Tables:: Analyzing table dimension. * Table Misc:: Table miscellany. Editing Programs === modified file 'doc/emacs/text.texi' --- doc/emacs/text.texi 2011-12-03 16:17:29 +0000 +++ doc/emacs/text.texi 2011-12-04 05:55:36 +0000 @@ -1298,8 +1298,8 @@ @code{bibtex-mode}. @item -The Ref@TeX{} package provides a minor mode which can be used in -conjunction with La@TeX{} mode to manage bibliographic references. +The Ref@TeX{} package provides a minor mode which can be used with +La@TeX{} mode to manage bibliographic references. @ifinfo @xref{Top,The Ref@TeX{} Manual,,reftex}. @end ifinfo @@ -1781,13 +1781,16 @@ @cindex nroff @findex nroff-mode - Nroff mode is a mode like Text mode but modified to handle nroff commands -present in the text. Invoke @kbd{M-x nroff-mode} to enter this mode. It -differs from Text mode in only a few ways. All nroff command lines are -considered paragraph separators, so that filling will never garble the -nroff commands. Pages are separated by @samp{.bp} commands. Comments -start with backslash-doublequote. Also, three special commands are -provided that are not in Text mode: +@vindex nroff-mode-hook + Nroff mode is a major mode derived from Text mode, which is +specialized for editing nroff files (e.g.@: Unix man pages). Type +@kbd{M-x nroff-mode} to enter this mode. Entering Nroff mode runs the +hook @code{text-mode-hook}, followed by @code{nroff-mode-hook} +(@pxref{Hooks}). + + In Nroff mode, nroff command lines are treated as paragraph +separators, pages are separated by @samp{.bp} commands, and comments +start with backslash-doublequote. It also defines these commands: @findex forward-text-line @findex backward-text-line @@ -1807,23 +1810,16 @@ @end table @findex electric-nroff-mode - The other feature of Nroff mode is that you can turn on Electric Nroff -mode. This is a minor mode that you can turn on or off with @kbd{M-x + Electric Nroff mode is a buffer-local minor mode that can be used +with Nroff mode. To toggle this minor mode, type @kbd{M-x electric-nroff-mode} (@pxref{Minor Modes}). When the mode is on, each -time you use @key{RET} to end a line that contains an nroff command that -opens a kind of grouping, the matching nroff command to close that -grouping is automatically inserted on the following line. For example, -if you are at the beginning of a line and type @kbd{.@: ( b @key{RET}}, -this inserts the matching command @samp{.)b} on a new line following -point. - - If you use Outline minor mode with Nroff mode (@pxref{Outline Mode}), -heading lines are lines of the form @samp{.H} followed by a number (the -header level). - -@vindex nroff-mode-hook - Entering Nroff mode runs the hook @code{text-mode-hook}, followed by -the hook @code{nroff-mode-hook} (@pxref{Hooks}). +time you type @key{RET} to end a line containing an nroff command that +opens a kind of grouping, the nroff command to close that grouping is +automatically inserted on the following line. + + If you use Outline minor mode with Nroff mode (@pxref{Outline +Mode}), heading lines are lines of the form @samp{.H} followed by a +number (the header level). @node Enriched Text @section Enriched Text @@ -2149,18 +2145,16 @@ within the text). The @samp{Remove Special} menu item removes all of these special properties from the text in the region. - The @code{invisible} and @code{intangible} properties are @emph{not} -saved in the text/enriched format. The @code{read-only} property is -saved, but it is not a standard part of the text/enriched format, so -other editors may not respect it. + The @code{invisible} and @code{intangible} properties are not saved +in the @samp{text/enriched} format. @node Text Based Tables @section Editing Text-based Tables @cindex table mode @cindex text-based tables - Table mode provides an easy and intuitive way to create and edit -text-based tables. Here is an example of such a table: + The @code{table} package provides commands to easily edit text-based +tables. Here is an example of what such a table looks like: @smallexample @group @@ -2170,27 +2164,23 @@ | forward-char |Move point right N characters | C-f | | |(left if N is negative). | | | | | | -| |On reaching end of buffer, stop | | -| |and signal error. | | +-----------------+--------------------------------+-----------------+ | backward-char |Move point left N characters | C-b | | |(right if N is negative). | | | | | | -| |On attempt to pass beginning or | | -| |end of buffer, stop and signal | | -| |error. | | +-----------------+--------------------------------+-----------------+ @end group @end smallexample - Table mode allows the contents of the table such as this one to be -easily manipulated by inserting or deleting characters inside a cell. -A cell is effectively a localized rectangular edit region and edits to -a cell do not affect the contents of the surrounding cells. If the -contents do not fit into a cell, then the cell is automatically -expanded in the vertical and/or horizontal directions and the rest of -the table is restructured and reformatted in accordance with the -growth of the cell. + When Emacs recognizes such a stretch of text as a table +(@pxref{Table Recognition}), editing the contents of each table cell +will automatically resize the table, whenever the contents become too +large to fit in the cell. You can use the commands defined in the +following sections for navigating and editing the table layout. + +@findex table-fixed-width-mode + To toggle the automatic table resizing feature, type @kbd{M-x +table-fixed-width-mode}. @menu * Table Definition:: What is a text based table. @@ -2198,102 +2188,87 @@ * Table Recognition:: How to activate and deactivate tables. * Cell Commands:: Cell-oriented commands in a table. * Cell Justification:: Justifying cell contents. -* Row Commands:: Manipulating rows of table cell. -* Column Commands:: Manipulating columns of table cell. -* Fixed Width Mode:: Fixing cell width. +* Table Rows and Columns:: Inserting and deleting rows and columns. * Table Conversion:: Converting between plain text and tables. -* Measuring Tables:: Analyzing table dimension. * Table Misc:: Table miscellany. @end menu @node Table Definition @subsection What is a Text-based Table? - - Keep the following examples of valid tables in mind as a reference -while you read this section: - -@example - +--+----+---+ +-+ +--+-----+ - | | | | | | | | | - +--+----+---+ +-+ | +--+--+ - | | | | | | | | - +--+----+---+ +--+--+ | - | | | - +-----+--+ -@end example - - A table consists of a rectangular frame whose inside is divided into -cells. Each cell must be at least one character wide and one -character high, not counting its border lines. A cell can be -subdivided into multiple rectangular cells, but cells cannot overlap. - - The table frame and cell border lines are made of three special -characters. These variables specify those characters: +@cindex cells, for text-based tables + + A @dfn{table} consists of a rectangular text area which is divided +into @dfn{cells}. Each cell must be at least one character wide and +one character high, not counting its border lines. A cell can be +subdivided into more cells, but they cannot overlap. + + Cell border lines are drawn with three special characters, specified +by the following variables: @table @code @vindex table-cell-vertical-char @item table-cell-vertical-char -Holds the character used for vertical lines. The default value is -@samp{|}. +The character used for vertical lines. The default is @samp{|}. @vindex table-cell-horizontal-chars @item table-cell-horizontal-chars -Holds the characters used for horizontal lines. The default value is -@samp{"-="}. +The characters used for horizontal lines. The default is @samp{"-="}. @vindex table-cell-intersection-char @item table-cell-intersection-char -Holds the character used at where horizontal line and vertical line -meet. The default value is @samp{+}. +The character used for the intersection of horizontal and vertical +lines. The default is @samp{+}. @end table @noindent -Based on this definition, the following five tables are examples of invalid -tables: +The following are examples of @emph{invalid} tables: @example - +-----+ +-----+ +--+ +-++--+ ++ - | | | | | | | || | ++ - | +-+ | | | | | | || | - | | | | +--+ | +--+--+ +-++--+ - | +-+ | | | | | | | +-++--+ - | | | | | | | | | || | - +-----+ +--+--+ +--+--+ +-++--+ - a b c d e + +-----+ +--+ +-++--+ + | | | | | || | + | | | | | || | + +--+ | +--+--+ +-++--+ + | | | | | | +-++--+ + | | | | | | | || | + +--+--+ +--+--+ +-++--+ + a b c @end example +@noindent From left to right: @enumerate a @item Overlapped cells or non-rectangular cells are not allowed. @item -Same as a. -@item The border must be rectangular. @item Cells must have a minimum width/height of one character. -@item -Same as d. @end enumerate @node Table Creation -@subsection How to Create a Table? +@subsection Creating a Table @cindex create a text-based table @cindex table creation @findex table-insert - The command to create a table is @code{table-insert}. When called -interactively, it asks for the number of columns, number of rows, cell -width and cell height. The number of columns is the number of cells -horizontally side by side. The number of rows is the number of cells -vertically within the table's height. The cell width is a number of -characters that each cell holds, left to right. The cell height is a -number of lines each cell holds. The cell width and the cell height -can be either an integer (when the value is constant across the table) -or a series of integer, separated by spaces or commas, where each -number corresponds to the next cell within a row from left to right, -or the next cell within a column from top to bottom. + To create a text-based table from scratch, type @kbd{M-x +table-insert}. This command prompts for the number of table columns, +the number of table rows, cell width and cell height. The cell width +and cell height do not include the cell borders; each can be specified +as a single integer (which means each cell is given the same +width/height), or as a sequence of integers separated by spaces or +commas (which specify the width/height of the individual table +columns/rows, counting from left to right for table columns and from +top to bottom for table rows). The specified table is then inserted +at point. + + The table inserted by @kbd{M-x table-insert} contains special text +properties, which tell Emacs to treat it specially as a text-based +table. If you save the buffer to a file and visit it again later, +those properties are lost, and the table appears to Emacs as an +ordinary piece of text. See the next section, for how to convert it +back into a table. @node Table Recognition @subsection Table Recognition @@ -2301,103 +2276,97 @@ @findex table-recognize @findex table-unrecognize - Table mode maintains special text properties in the buffer to allow -editing in a convenient fashion. When a buffer with tables is saved -to its file, these text properties are lost, so when you visit this -file again later, Emacs does not see a table, but just formatted text. -To resurrect the table text properties, issue the @kbd{M-x -table-recognize} command. It scans the current buffer, recognizes -valid table cells, and attaches appropriate text properties to allow -for table editing. The converse command, @code{table-unrecognize}, is -used to remove the special text properties and convert the buffer back -to plain text. + Existing text-based tables in a buffer, which lack the special text +properties applied by @kbd{M-x table-insert}, are not treated +specially as tables. To apply those text properties, type @kbd{M-x +table-recognize}. This command scans the current buffer, +@dfn{recognizes} valid table cells, and applies the relevant text +properties. Conversely, type @kbd{M-x table-unrecognize} to +@dfn{unrecognize} all tables in the current buffer, removing the +special text properties and converting tables back to plain text. - Special commands exist to enable or disable tables within a region, -enable or disable individual tables, and enable/disable individual -cells. These commands are: + You can also use the following commands to selectively recognize or +unrecognize tables: @table @kbd @findex table-recognize-region @item M-x table-recognize-region -Recognize tables within the current region and activate them. +Recognize tables within the current region. + @findex table-unrecognize-region @item M-x table-unrecognize-region -Deactivate tables within the current region. +Unrecognize tables within the current region. + @findex table-recognize-table @item M-x table-recognize-table Recognize the table at point and activate it. + @findex table-unrecognize-table @item M-x table-unrecognize-table Deactivate the table at point. + @findex table-recognize-cell @item M-x table-recognize-cell Recognize the cell at point and activate it. + @findex table-unrecognize-cell @item M-x table-unrecognize-cell Deactivate the cell at point. @end table - For another way of converting text into tables, see @ref{Table -Conversion}. + @xref{Table Conversion}, for another way to recognize a table. @node Cell Commands @subsection Commands for Table Cells @findex table-forward-cell @findex table-backward-cell - The commands @code{table-forward-cell} and -@code{table-backward-cell} move point from the current cell to an -adjacent cell forward and backward respectively. The order of the -cells is cyclic: when point is in the last cell of a table, typing -@kbd{M-x table-forward-cell} moves to the first cell in the table. -Likewise @kbd{M-x table-backward-cell} from the first cell in a table -moves to the last cell. + The commands @kbd{M-x table-forward-cell} and @kbd{M-x +table-backward-cell} move point from the current cell to an adjacent +cell. The order is cyclic: when point is in the last cell of a table, +@kbd{M-x table-forward-cell} moves to the first cell. Likewise, when +point is on the first cell, @kbd{M-x table-backward-cell} moves to the +last cell. @findex table-span-cell - The command @code{table-span-cell} merges the current cell with the -adjacent cell in a specified direction---right, left, above or below. -You specify the direction with the minibuffer. It does not allow -merges which don't result in a legitimate cell layout. + @kbd{M-x table-span-cell} prompts for a direction---right, left, +above, or below---and merges the current cell with the adjacent cell +in that direction. This command signals an error if the merge would +result in an illegitimate cell layout. @findex table-split-cell -@cindex text-based tables, split a cell -@cindex split table cell - The command @code{table-split-cell} splits the current cell -vertically or horizontally. This command is a wrapper to the -direction specific commands @code{table-split-cell-vertically} and -@code{table-split-cell-horizontally}. You specify the direction with -a minibuffer argument. - @findex table-split-cell-vertically - The command @code{table-split-cell-vertically} splits the current -cell vertically and creates a pair of cells above and below where -point is located. The content in the original cell is split as well. - @findex table-split-cell-horizontally - The command @code{table-split-cell-horizontally} splits the current -cell horizontally and creates a pair of cells right and left of where -point is located. If the cell being split is not empty, this asks you -how to handle the cell contents. The three options are: @code{split}, -@code{left}, or @code{right}. @code{split} splits the contents at -point literally, while the @code{left} and @code{right} options move -the entire contents into the left or right cell respectively. +@cindex text-based tables, splitting cells +@cindex splitting table cells + @kbd{M-x table-split-cell} splits the current cell vertically or +horizontally, prompting for the direction with the minibuffer. The +commands @kbd{M-x table-split-cell-vertically} and @kbd{M-x +table-split-cell-horizontally} split in a specific direction. When +splitting vertically, the old cell contents are automatically split +between the two new cells. When splitting horizontally, you are +prompted for how to divide the cell contents, if the cell is +non-empty; the options are @samp{split} (divide the contents at +point), @samp{left} (put all the contents in the left cell), and +@samp{right} (put all the contents in the right cell). -@cindex enlarge a table cell -@cindex shrink a table cell - The next four commands enlarge or shrink a cell. They use numeric -arguments (@pxref{Arguments}) to specify how many columns or rows to -enlarge or shrink a particular table. + The following commands enlarge or shrink a cell. By default, they +resize by one row or column; if a numeric argument is supplied, that +specifies the number of rows or columns to resize by. @table @kbd @findex table-heighten-cell @item M-x table-heighten-cell Enlarge the current cell vertically. + @findex table-shorten-cell @item M-x table-shorten-cell Shrink the current cell vertically. + @findex table-widen-cell @item M-x table-widen-cell Enlarge the current cell horizontally. + @findex table-narrow-cell @item M-x table-narrow-cell Shrink the current cell horizontally. @@ -2405,107 +2374,76 @@ @node Cell Justification @subsection Cell Justification -@cindex cell text justification +@cindex justification in text-based tables - You can specify text justification for each cell. The justification -is remembered independently for each cell and the subsequent editing -of cell contents is subject to the specified justification. + The command @kbd{M-x table-justify} imposes @dfn{justification} on +one or more cells in a text-based table. Justification determines how +the text in the cell is aligned, relative to the edges of the cell. +Each cell in a table can be separately justified. @findex table-justify - The command @code{table-justify} ask you to specify what to justify: -a cell, a column, or a row. If you select cell justification, this -command sets the justification only for the current cell. Selecting -column or row justification sets the justification for all the cells -within a column or row respectively. The command then ask you which -kind of justification to apply: @code{left}, @code{center}, -@code{right}, @code{top}, @code{middle}, @code{bottom}, or -@code{none}. Horizontal justification and vertical justification are -specified independently. The options @code{left}, @code{center}, and -@code{right} specify horizontal justification while the options -@code{top}, @code{middle}, @code{bottom}, and @code{none} specify -vertical justification. The vertical justification @code{none} -effectively removes vertical justification. Horizontal justification -must be one of @code{left}, @code{center}, or @code{right}. + @kbd{M-x table-justify} first prompts for what to justify; the +options are @samp{cell} (just the current cell), @samp{column} (all +cells in the current table column) and @samp{row} (all cells in the +current table row). The command then prompts for the justification +style; the options are @code{left}, @code{center}, @code{right}, +@code{top}, @code{middle}, @code{bottom}, or @code{none} (meaning no +vertical justification). + + Horizontal and vertical justification styles are specified +independently, and both types can be in effect simultaneously; for +instance, you can call @kbd{M-x table-justify} twice, once to specify +@code{right} justification and once to specify @code{bottom} +justification, to align the contents of a cell to the bottom right. @vindex table-detect-cell-alignment - Justification information is stored in the buffer as a part of text -property. Therefore, this information is ephemeral and does not -survive through the loss of the buffer (closing the buffer and -revisiting the buffer erase any previous text properties). To -countermand for this, the command @code{table-recognize} and other -recognition commands (@pxref{Table Recognition}) are equipped with a -convenience feature (turned on by default). During table recognition, -the contents of a cell are examined to determine which justification -was originally applied to the cell and then applies this justification -to the cell. This is a speculative algorithm and is therefore not -perfect, however, the justification is deduced correctly most of the -time. To disable this feature, customize the variable -@code{table-detect-cell-alignment} and set it to @code{nil}. - -@node Row Commands -@subsection Commands for Table Rows -@cindex table row commands - -@cindex insert row in table + The justification style is stored in the buffer as a text property, +and is lost when you kill the buffer or exit Emacs. However, the +table recognition commands, such as @kbd{M-x table-recognize} +(@pxref{Table Recognition}), attempt to determine and re-apply each +cell's justification style, by examining its contents. To disable +this feature, change the variable @code{table-detect-cell-alignment} +to @code{nil}. + +@node Table Rows and Columns +@subsection Table Rows and Columns +@cindex inserting rows and columns in text-based tables + @findex table-insert-row - The command @code{table-insert-row} inserts a row of cells before -the current row in a table. The current row where point is located is -pushed down after the newly inserted row. A numeric prefix argument -specifies the number of rows to insert. Note that in order to insert -rows @emph{after} the last row at the bottom of a table, you must -place point below the table---that is, outside the table---prior to -invoking this command. - -@cindex delete row in table -@findex table-delete-row - The command @code{table-delete-row} deletes a row of cells at point. -A numeric prefix argument specifies the number of rows to delete. - -@node Column Commands -@subsection Commands for Table Columns -@cindex table column commands - -@cindex insert column in table + @kbd{M-x table-insert-row} inserts a row of cells before the current +table row. The current row, together with point, is pushed down past +the new row. To insert rows after the last row at the bottom of a +table, invoke this command with point below the table, just below the +bottom edge. A numeric prefix argument specifies the number of rows +to insert. + @findex table-insert-column - The command @code{table-insert-column} inserts a column of cells to -the left of the current row in a table. This pushes the current -column to the right. To insert a column to the right side of the -rightmost column, place point to the right of the rightmost column, -which is outside of the table, prior to invoking this command. A -numeric prefix argument specifies the number of columns to insert. - -@cindex delete column in table - A command @code{table-delete-column} deletes a column of cells at -point. A numeric prefix argument specifies the number of columns to -delete. - -@node Fixed Width Mode -@subsection Fix Width of Cells -@cindex fix width of table cells - -@findex table-fixed-width-mode - The command @code{table-fixed-width-mode} toggles fixed width mode -on and off. When fixed width mode is turned on, editing inside a -cell never changes the cell width; when it is off, the cell width -expands automatically in order to prevent a word from being folded -into multiple lines. By default, fixed width mode is disabled. + Similarly, @kbd{M-x table-insert-column} inserts a column of cells +to the left of the current table column. To insert a column to the +right side of the rightmost column, invoke this command with point to +the right of the rightmost column, outside the table. A numeric +prefix argument specifies the number of columns to insert. + +@cindex deleting rows and column in text-based tables + @kbd{M-x table-delete-column} deletes the column of cells at point. +Similarly, @kbd{M-x table-delete-row} deletes the row of cells at +point. A numeric prefix argument to either command specifies the +number of columns or rows to delete. @node Table Conversion -@subsection Conversion Between Plain Text and Tables +@subsection Converting Between Plain Text and Tables @cindex text to table @cindex table to text @findex table-capture - The command @code{table-capture} captures plain text in a region and -turns it into a table. Unlike @code{table-recognize} (@pxref{Table -Recognition}), the original text does not have a table appearance but -may hold a logical table structure. For example, some elements -separated by known patterns form a two dimensional structure which can -be turned into a table. + The command @kbd{M-x table-capture} captures plain text in a region +and turns it into a table. Unlike @kbd{M-x table-recognize} +(@pxref{Table Recognition}), the original text does not need to have a +table appearance; it only needs to have a logical table-like +structure. - Here's an example of data that @code{table-capture} can operate on. -The numbers are horizontally separated by a comma and vertically -separated by a newline character. + For example, suppose we have the following numbers, which are +divided into three lines and separated horizontally by commas: @example 1, 2, 3, 4 @@ -2526,136 +2464,92 @@ +-----+-----+-----+-----+ @end example -@noindent -The conversion uses @samp{,} for the column delimiter and newline for -a row delimiter, cells are left justified, and minimum cell width is -5. - @findex table-release - The command @code{table-release} does the opposite of -@code{table-capture}. It releases a table by removing the table frame -and cell borders. This leaves the table contents as plain text. One -of the useful applications of @code{table-capture} and -@code{table-release} is to edit a text in layout. Look at the -following three paragraphs (the latter two are indented with header -lines): + @kbd{M-x table-release} does the opposite: it converts a table back +to plain text, removing its cell borders. + + One application of this pair of commands is to edit a text in +layout. Look at the following three paragraphs (the latter two are +indented with header lines): @example table-capture is a powerful command. Here are some things it can do: -Parse Cell Items By using column delimiter regular - expression and raw delimiter regular - expression, it parses the specified text - area and extracts cell items from - non-table text and then forms a table out - of them. - -Capture Text Area When no delimiters are specified it - creates a single cell table. The text in - the specified region is placed in that - cell. +Parse Cell Items Using row and column delimiter regexps, + it parses the specified text area and + extracts cell items into a table. @end example @noindent -Applying @code{table-capture} to a region containing the above three -paragraphs, with empty strings for column delimiter regexp and row -delimiter regexp, creates a table with a single cell like the -following one. +Applying @code{table-capture} to a region containing the above text, +with empty strings for the column and row delimiter regexps, creates a +table with a single cell like the following one. -@c The first line's right-hand frame in the following two examples -@c sticks out to accommodate for the removal of @samp in the -@c produced output!! @smallexample @group -+-------------------------------------------------------------+ -|table-capture is a powerful command. | -|Here are some things it can do: | -| | -|Parse Cell Items By using column delimiter regular | -| expression and raw delimiter regular | -| expression, it parses the specified text | -| area and extracts cell items from | -| non-table text and then forms a table out | -| of them. | -| | -|Capture Text Area When no delimiters are specified it | -| creates a single cell table. The text in | -| the specified region is placed in that | -| cell. | -+-------------------------------------------------------------+ ++----------------------------------------------------------+ +|table-capture is a powerful command. | +|Here are some things it can do: | +| | +|Parse Cell Items Using row and column delimiter regexps,| +| it parses the specified text area and | +| extracts cell items into a table. | ++----------------------------------------------------------+ @end group @end smallexample @noindent -By splitting the cell appropriately we now have a table consisting of -paragraphs occupying its own cell. Each cell can now be edited -independently without affecting the layout of other cells. +We can then use the cell splitting commands (@pxref{Cell Commands}) to +subdivide the table so that each paragraph occupies a cell: @smallexample -+--------------------------------------------------------------+ -|table-capture is a powerful command. | -|Here are some things it can do: | -+------------------+-------------------------------------------+ -|Parse Cell Items |By using column delimiter regular | -| |expression and raw delimiter regular | -| |expression, it parses the specified text | -| |area and extracts cell items from | -| |non-table text and then forms a table out | -| |of them. | -+------------------+-------------------------------------------+ -|Capture Text Area |When no delimiters are specified it | -| |creates a single cell table. The text in | -| |the specified region is placed in that | -| |cell. | -+------------------+-------------------------------------------+ ++----------------------------------------------------------+ +|table-capture is a powerful command. | +|Here are some things it can do: | ++-----------------+----------------------------------------+ +|Parse Cell Items | Using row and column delimiter regexps,| +| | it parses the specified text area and | +| | extracts cell items into a table. | ++-----------------+----------------------------------------+ @end smallexample @noindent -By applying @code{table-release}, which does the opposite process, the -contents become once again plain text. @code{table-release} works as -a companion command to @code{table-capture}. - -@node Measuring Tables -@subsection Analyzing Table Dimensions +Each cell can now be edited independently without affecting the layout +of other cells. When finished, we can invoke @kbd{M-x table-release} +to convert the table back to plain text. + +@node Table Misc +@subsection Table Miscellany + @cindex table dimensions - @findex table-query-dimension - The command @code{table-query-dimension} analyzes a table structure -and reports information regarding its dimensions. In case of the -above example table, the @code{table-query-dimension} command displays -in echo area: + The command @code{table-query-dimension} reports the layout of the +table and table cell at point. Here is an example of its output: @smallexample Cell: (21w, 6h), Table: (67w, 16h), Dim: (2c, 3r), Total Cells: 5 @end smallexample @noindent -This indicates that the current cell is 21 character wide and 6 lines -high, the entire table is 67 characters wide and 16 lines high. The -table has 2 columns and 3 rows. It has a total of 5 cells, since the -first row has a spanned cell. - -@node Table Misc -@subsection Table Miscellany - -@cindex insert string into table cells +This indicates that the current cell is 21 characters wide and 6 lines +high, the table is 67 characters wide and 16 lines high with 2 columns +and 3 rows, and a total of 5 cells. + @findex table-insert-sequence - The command @code{table-insert-sequence} inserts a string into each -cell. Each string is a part of a sequence i.e.@: a series of -increasing integer numbers. + @kbd{M-x table-insert-sequence} inserts a string into each cell. +Each string is a part of a sequence i.e.@: a series of increasing +integer numbers. -@cindex table in language format @cindex table for HTML and LaTeX @findex table-generate-source - The command @code{table-generate-source} generates a table formatted -for a specific markup language. It asks for a language (which must be -one of @code{html}, @code{latex}, or @code{cals}), a destination -buffer where to put the result, and the table caption (a string), and -then inserts the generated table in the proper syntax into the -destination buffer. The default destination buffer is -@code{table.@var{lang}}, where @var{lang} is the language you -specified. + @kbd{M-x table-generate-source} generates a table formatted for a +specific markup language. It asks for a language (which must be one +of @code{html}, @code{latex}, or @code{cals}), a destination buffer in +which to put the result, and a table caption, and then inserts the +generated table into the specified buffer. The default destination +buffer is @code{table.@var{lang}}, where @var{lang} is the language +you specified. @node Two-Column @section Two-Column Editing @@ -2663,11 +2557,9 @@ @cindex splitting columns @cindex columns, splitting - Two-column mode lets you conveniently edit two side-by-side columns of -text. It uses two side-by-side windows, each showing its own -buffer. - - There are three ways to enter two-column mode: + Two-column mode lets you conveniently edit two side-by-side columns +of text. It uses two side-by-side windows, each showing its own +buffer. There are three ways to enter two-column mode: @table @asis @item @kbd{@key{F2} 2} or @kbd{C-x 6 2} ------------------------------------------------------------ revno: 106599 committer: Chong Yidong branch nick: trunk timestamp: Sun 2011-12-04 10:02:45 +0800 message: message.el (message-pop-to-buffer): Use pop-to-buffer-same-window for last change. diff: === modified file 'lisp/gnus/message.el' --- lisp/gnus/message.el 2011-12-04 01:55:49 +0000 +++ lisp/gnus/message.el 2011-12-04 02:02:45 +0000 @@ -6344,7 +6344,7 @@ "Message already being composed; erase? ") (message nil)))) (error "Message being composed"))) - (funcall (or switch-function #'switch-to-buffer) name) + (funcall (or switch-function #'pop-to-buffer-same-window) name) (set-buffer name)) (erase-buffer) (message-mode))) ------------------------------------------------------------ revno: 106598 committer: Chong Yidong branch nick: trunk timestamp: Sun 2011-12-04 09:55:49 +0800 message: * message.el (message-pop-to-buffer): Partially revert 2011-11-30 change (Bug#10200). diff: === modified file 'lisp/gnus/ChangeLog' --- lisp/gnus/ChangeLog 2011-12-02 04:00:32 +0000 +++ lisp/gnus/ChangeLog 2011-12-04 01:55:49 +0000 @@ -1,3 +1,8 @@ +2011-12-04 Chong Yidong + + * message.el (message-pop-to-buffer): Partially revert 2011-11-30 + change (Bug#10200). + 2011-12-02 Katsumi Yamaoka * compface.el (uncompface): === modified file 'lisp/gnus/message.el' --- lisp/gnus/message.el 2011-12-01 04:55:39 +0000 +++ lisp/gnus/message.el 2011-12-04 01:55:49 +0000 @@ -6327,7 +6327,6 @@ (defun message-pop-to-buffer (name &optional switch-function) "Pop to buffer NAME, and warn if it already exists and is modified." - (unless switch-function (setq switch-function #'pop-to-buffer)) (let ((buffer (get-buffer name))) (if (and buffer (buffer-name buffer)) @@ -6337,7 +6336,7 @@ (progn (gnus-select-frame-set-input-focus (window-frame window)) (select-window window)) - (funcall switch-function buffer) + (funcall (or switch-function #'pop-to-buffer) buffer) (set-buffer buffer)) (when (and (buffer-modified-p) (not (prog1 @@ -6345,7 +6344,7 @@ "Message already being composed; erase? ") (message nil)))) (error "Message being composed"))) - (funcall switch-function name) + (funcall (or switch-function #'switch-to-buffer) name) (set-buffer name)) (erase-buffer) (message-mode))) ------------------------------------------------------------ revno: 106597 fixes bug(s): http://debbugs.gnu.org/10207 committer: Glenn Morris branch nick: trunk timestamp: Sat 2011-12-03 12:44:19 -0800 message: * lisp/textmodes/texinfmt.el (batch-texinfo-format): Doc fix. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-12-03 05:01:41 +0000 +++ lisp/ChangeLog 2011-12-03 20:44:19 +0000 @@ -1,3 +1,7 @@ +2011-12-03 Glenn Morris + + * textmodes/texinfmt.el (batch-texinfo-format): Doc fix. (Bug#10207) + 2011-12-03 Stefan Monnier * electric.el: Streamline electric-indent's hook. === modified file 'lisp/textmodes/texinfmt.el' --- lisp/textmodes/texinfmt.el 2011-11-30 16:33:05 +0000 +++ lisp/textmodes/texinfmt.el 2011-12-03 20:44:19 +0000 @@ -4238,7 +4238,7 @@ Must be used only with -batch, and kills Emacs on completion. Each file will be processed even if an error occurred previously. For example, invoke - \"emacs -batch -funcall batch-texinfo-format $docs/ ~/*.texinfo\"." + \"emacs -batch -l texinfmt -f batch-texinfo-format $docs/ ~/*.texinfo\"." (if (not noninteractive) (error "batch-texinfo-format may only be used -batch")) (let ((version-control t) ------------------------------------------------------------ revno: 106596 committer: Paul Eggert branch nick: trunk timestamp: Sat 2011-12-03 12:28:21 -0800 message: * INSTALL.BZR: Mention configure -C, --disable-maintainer-mode. diff: === modified file 'ChangeLog' --- ChangeLog 2011-12-03 20:23:44 +0000 +++ ChangeLog 2011-12-03 20:28:21 +0000 @@ -1,5 +1,7 @@ 2011-12-03 Paul Eggert + * INSTALL.BZR: Mention configure -C, --disable-maintainer-mode. + Propagate configure flags to sub-configures. * Makefile.in (cache_file, MAINTAINER_MODE_FLAG, CONFIGUREFLAGS): New macros. === modified file 'INSTALL.BZR' --- INSTALL.BZR 2011-06-25 17:51:03 +0000 +++ INSTALL.BZR 2011-12-03 20:28:21 +0000 @@ -28,6 +28,10 @@ $ ./configure +If you want later builds to go faster, at the expense of sometimes +doing the wrong thing if you update the build procedure, you can +invoke "./configure -C --disable-maintainer-mode" instead. + Some of the files that are included in the Emacs tarball, such as byte-compiled Lisp files, are not stored in Bazaar. Therefore, to build from Bazaar you must run "make bootstrap" instead of just "make": ------------------------------------------------------------ revno: 106595 committer: Paul Eggert branch nick: trunk timestamp: Sat 2011-12-03 12:23:44 -0800 message: Fix typo in my most-recent ChangeLog entry. diff: === modified file 'ChangeLog' --- ChangeLog 2011-12-03 20:19:03 +0000 +++ ChangeLog 2011-12-03 20:23:44 +0000 @@ -1,7 +1,7 @@ 2011-12-03 Paul Eggert Propagate configure flags to sub-configures. - * Makefile.in (cache_file, ENABLE_MAINTAINER_MODE, CONFIGUREFLAGS): + * Makefile.in (cache_file, MAINTAINER_MODE_FLAG, CONFIGUREFLAGS): New macros. (config.status, bootstrap): Use them to propagate configure flags to sub-configures. ------------------------------------------------------------ revno: 106594 committer: Paul Eggert branch nick: trunk timestamp: Sat 2011-12-03 12:19:03 -0800 message: Propagate configure flags to sub-configures. * Makefile.in (cache_file, ENABLE_MAINTAINER_MODE, CONFIGUREFLAGS): New macros. (config.status, bootstrap): Use them to propagate configure flags to sub-configures. * configure.in (cache_file): AC_SUBST this, for Makefile.in. diff: === modified file 'ChangeLog' --- ChangeLog 2011-12-03 04:06:45 +0000 +++ ChangeLog 2011-12-03 20:19:03 +0000 @@ -1,5 +1,14 @@ 2011-12-03 Paul Eggert + Propagate configure flags to sub-configures. + * Makefile.in (cache_file, ENABLE_MAINTAINER_MODE, CONFIGUREFLAGS): + New macros. + (config.status, bootstrap): Use them to propagate configure flags + to sub-configures. + * configure.in (cache_file): AC_SUBST this, for Makefile.in. + +2011-12-03 Paul Eggert + * .bzrignore: Add config.cache. 2011-11-27 Jan Djärv === modified file 'Makefile.in' --- Makefile.in 2011-11-22 01:56:49 +0000 +++ Makefile.in 2011-12-03 20:19:03 +0000 @@ -66,6 +66,11 @@ # ==================== Things `configure' Might Edit ==================== +MAINTAINER_MODE_FLAG = --disable-maintainer-mode +@MAINT@MAINTAINER_MODE_FLAG = --enable-maintainer-mode +cache_file = @cache_file@ +CONFIGURE_FLAGS = --cache-file=$(cache_file) $(MAINTAINER_MODE_FLAG) + CC=@CC@ CFLAGS=@CFLAGS@ LDFLAGS=@LDFLAGS@ @@ -404,7 +409,7 @@ if [ -x ./config.status ]; then \ ./config.status --recheck; \ else \ - ./configure; \ + ./configure $(CONFIGURE_FLAGS); \ fi AUTOCONF_INPUTS = @MAINT@ $(srcdir)/configure.in $(srcdir)/aclocal.m4 @@ -936,7 +941,7 @@ if [ -x ./config.status ]; then \ ./config.status; \ else \ - ./configure --enable-maintainer-mode; \ + ./configure $(CONFIGURE_FLAGS); \ fi $(MAKE) $(MFLAGS) info all === modified file 'configure.in' --- configure.in 2011-11-30 16:23:05 +0000 +++ configure.in 2011-12-03 20:19:03 +0000 @@ -182,6 +182,9 @@ dnl http://lists.gnu.org/archive/html/emacs-devel/2008-04/msg01844.html OPTION_DEFAULT_ON([makeinfo],[don't require makeinfo for building manuals]) +## Makefile.in needs the cache file name. +AC_SUBST(cache_file) + ## This is an option because I do not know if all info/man support ## compressed files, nor how to test if they do so. OPTION_DEFAULT_ON([compress-info],[don't compress the installed Info pages]) ------------------------------------------------------------ revno: 106593 fixes bug(s): http://debbugs.gnu.org/10104 committer: Jan D. branch nick: trunk timestamp: Sat 2011-12-03 20:15:20 +0100 message: * widget.c (update_wm_hints): Return if wmshell is null. (widget_update_wm_size_hints): New function. * widget.h (widget_update_wm_size_hints): Declare. * xterm.c (x_wm_set_size_hint): If USE_X_TOOLKIT, call widget_update_wm_size_hints. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-12-03 09:55:27 +0000 +++ src/ChangeLog 2011-12-03 19:15:20 +0000 @@ -1,3 +1,13 @@ +2011-12-03 Jan Djärv + + * widget.c (update_wm_hints): Return if wmshell is null. + (widget_update_wm_size_hints): New function. + + * widget.h (widget_update_wm_size_hints): Declare. + + * xterm.c (x_wm_set_size_hint): If USE_X_TOOLKIT, call + widget_update_wm_size_hints (Bug#10104). + 2011-12-03 Eli Zaretskii * xdisp.c (handle_invisible_prop): If the invisible text ends just === modified file 'src/widget.c' --- src/widget.c 2011-11-27 04:43:11 +0000 +++ src/widget.c 2011-12-03 19:15:20 +0000 @@ -476,6 +476,9 @@ int base_height; int min_rows = 0, min_cols = 0; + /* This happens when the frame is just created. */ + if (! wmshell) return; + #if 0 check_frame_size (ew->emacs_frame.frame, &min_rows, &min_cols); #endif @@ -506,6 +509,14 @@ NULL); } +void +widget_update_wm_size_hints (Widget widget) +{ + EmacsFrame ew = (EmacsFrame)widget; + update_wm_hints (ew); +} + + #if 0 static void === modified file 'src/widget.h' --- src/widget.h 2011-11-27 04:43:11 +0000 +++ src/widget.h 2011-12-03 19:15:20 +0000 @@ -95,5 +95,6 @@ /* Special entry points */ void EmacsFrameSetCharSize (Widget, int, int); void widget_store_internal_border (Widget widget); +void widget_update_wm_size_hints (Widget widget); #endif /* _EmacsFrame_h */ === modified file 'src/xterm.c' --- src/xterm.c 2011-11-29 18:08:53 +0000 +++ src/xterm.c 2011-12-03 19:15:20 +0000 @@ -9561,6 +9561,14 @@ XSizeHints size_hints; Window window = FRAME_OUTER_WINDOW (f); +#ifdef USE_X_TOOLKIT + if (f->output_data.x->widget) + { + widget_update_wm_size_hints (f->output_data.x->widget); + return; + } +#endif + /* Setting PMaxSize caused various problems. */ size_hints.flags = PResizeInc | PMinSize /* | PMaxSize */; ------------------------------------------------------------ revno: 106592 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-12-03 18:25:26 +0200 message: admin/MAINTAINERS: Update Eli Z.'s responsibilities & interests. diff: === modified file 'admin/MAINTAINERS' --- admin/MAINTAINERS 2011-07-28 17:03:01 +0000 +++ admin/MAINTAINERS 2011-12-03 16:25:26 +0000 @@ -99,6 +99,7 @@ src/xfaces.c src/xdisp.c src/term.c + src/dispnew.c src/frame.c src/dired.c @@ -108,6 +109,7 @@ lisp/info.el lisp/ls-lisp.el lisp/startup.el + lisp/w32*.el Stefan Monnier src/intervals.c @@ -148,7 +150,6 @@ src/composite.c src/config.in src/data.c -src/dispnew.c src/doc.c src/doprnt.c src/ecrt0.c @@ -214,7 +215,6 @@ src/w32xfns.c src/widget.c src/window.c -src/xdisp.c src/xfns.c src/xmenu.c src/xrdb.c ------------------------------------------------------------ revno: 106591 committer: Chong Yidong branch nick: trunk timestamp: Sun 2011-12-04 00:17:29 +0800 message: More updates to the Text chapter of the Emacs manual, and related nodes. Make the documentation of Enriched Mode shorter, since it's practically unused. * text.texi (TeX Mode): Mention AUCTeX package. (TeX Editing): Add xref to documentation for Occur. (LaTeX Editing): Add xref to Completion node. (TeX Print): Fix description of tex-directory. (Enriched Text): Renamed from Formatted Text. Make this node and its subnodes less verbose, since text/enriched files are practically unused. (Enriched Mode): Renamed from Requesting Formatted Text. (Format Colors): Node deleted. (Enriched Faces): Renamed from Format Faces. Describe commands for applying colors too. (Forcing Enriched Mode): Node deleted; merged into Enriched Mode. * frames.texi (Menu Mouse Clicks): Tweak description of C-Mouse-2. * display.texi (Colors): New node. * cmdargs.texi (Colors X): * xresources.texi (GTK styles): * custom.texi (Face Customization): Reference it. * glossary.texi (Glossary): Remove "formatted text" and "WYSIWYG". Link to Fill Commands for Justification entry. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2011-12-03 13:32:29 +0000 +++ doc/emacs/ChangeLog 2011-12-03 16:17:29 +0000 @@ -1,3 +1,29 @@ +2011-12-03 Chong Yidong + + * text.texi (TeX Mode): Mention AUCTeX package. + (TeX Editing): Add xref to documentation for Occur. + (LaTeX Editing): Add xref to Completion node. + (TeX Print): Fix description of tex-directory. + (Enriched Text): Renamed from Formatted Text. Make this node and + its subnodes less verbose, since text/enriched files are + practically unused. + (Enriched Mode): Renamed from Requesting Formatted Text. + (Format Colors): Node deleted. + (Enriched Faces): Renamed from Format Faces. Describe commands + for applying colors too. + (Forcing Enriched Mode): Node deleted; merged into Enriched Mode. + + * frames.texi (Menu Mouse Clicks): Tweak description of C-Mouse-2. + + * display.texi (Colors): New node. + + * cmdargs.texi (Colors X): + * xresources.texi (GTK styles): + * custom.texi (Face Customization): Reference it. + + * glossary.texi (Glossary): Remove "formatted text" and "WYSIWYG". + Link to Fill Commands for Justification entry. + 2011-12-03 Eli Zaretskii * display.texi (Auto Scrolling): More accurate description of what === modified file 'doc/emacs/cmdargs.texi' --- doc/emacs/cmdargs.texi 2011-09-18 20:01:37 +0000 +++ doc/emacs/cmdargs.texi 2011-12-03 16:17:29 +0000 @@ -69,7 +69,7 @@ * Environment:: Environment variables that Emacs uses. * Display X:: Changing the default display and using remote login. * Font X:: Choosing a font for text, under X. -* Colors:: Choosing display colors. +* Colors X:: Choosing display colors. * Window Size X:: Start-up window size, under X. * Borders X:: Internal and external borders, under X. * Title X:: Specifying the initial frame's title. @@ -784,7 +784,7 @@ When passing a font specification to Emacs on the command line, you may need to ``quote'' it, by enclosing it in quotation marks, if it -contains characters that the shell treats specially (e.g. spaces). +contains characters that the shell treats specially (e.g.@: spaces). For example: @smallexample @@ -794,27 +794,14 @@ @xref{Fonts}, for other ways to specify the default font and font name formats. -@node Colors +@node Colors X @appendixsec Window Color Options @cindex color of window, from command line @cindex text colors, from command line -@findex list-colors-display -@cindex available colors - On a color display, you can specify which color to use for various -parts of the Emacs display. To find out what colors are available on -your system, type @kbd{M-x list-colors-display}, or press -@kbd{C-Mouse-2} and select @samp{Display Colors} from the pop-up menu. -(A particular window system might support many more colors, but the -list displayed by @code{list-colors-display} shows their portable -subset that can be safely used on any display supported by Emacs.) -If you do not specify colors, on windowed displays the default for the -background is white and the default for all other colors is black. On a -monochrome display, the foreground is black, the background is white, -and the border is gray if the display supports that. On terminals, the -background is usually black and the foreground is white. - - Here is a list of the command-line options for specifying colors: + You can use the following command-line options to specify the colors +to use for various parts of the Emacs display. Colors may be +specified using either color names or RGB triplets (@pxref{Colors}). @table @samp @item -fg @var{color} @@ -822,15 +809,15 @@ @itemx --foreground-color=@var{color} @opindex --foreground-color @cindex foreground color, command-line argument -Specify the foreground color. @var{color} should be a standard color -name, or a numeric specification of the color's red, green, and blue -components as in @samp{#4682B4} or @samp{RGB:46/82/B4}. +Specify the foreground color, overriding the color specified by the +@code{default} face (@pxref{Faces}). @item -bg @var{color} @opindex -bg @itemx --background-color=@var{color} @opindex --background-color @cindex background color, command-line argument -Specify the background color. +Specify the background color, overriding the color specified by the +@code{default} face. @item -bd @var{color} @opindex -bd @itemx --border-color=@var{color} === modified file 'doc/emacs/custom.texi' --- doc/emacs/custom.texi 2011-11-14 06:27:12 +0000 +++ doc/emacs/custom.texi 2011-12-03 16:17:29 +0000 @@ -430,15 +430,8 @@ clicking that button. When the attribute is enabled, you can change the attribute value in the usual ways. - You can specify a color name (use @kbd{M-x list-colors-display} for -a list of them) or a hexadecimal color specification of the form -@samp{#@var{rr}@var{gg}@var{bb}}. (@samp{#000000} is black, -@samp{#ff0000} is red, @samp{#00ff00} is green, @samp{#0000ff} is -blue, and @samp{#ffffff} is white.) On a black-and-white display, the -colors you can use for the background are @samp{black}, @samp{white}, -@samp{gray}, @samp{gray1}, and @samp{gray3}. Emacs supports these -shades of gray by using background stipple patterns instead of a -color. + The foreground and background colors can be specified using color +names or RGB triplets. @xref{Colors}. Setting, saving and resetting a face work like the same operations for variables (@pxref{Changing a Variable}). === modified file 'doc/emacs/display.texi' --- doc/emacs/display.texi 2011-12-03 13:32:29 +0000 +++ doc/emacs/display.texi 2011-12-03 16:17:29 +0000 @@ -21,6 +21,7 @@ * View Mode:: Viewing read-only buffers. * Follow Mode:: Follow mode lets two windows scroll as one. * Faces:: How to change the display style using faces. +* Colors:: Specifying colors for faces. * Standard Faces:: Emacs' predefined faces. * Text Scale:: Increasing or decreasing text size in a buffer. * Font Lock:: Minor mode for syntactic highlighting using faces. @@ -461,7 +462,7 @@ To turn off Follow mode, type @kbd{M-x follow-mode} a second time. @node Faces -@section Faces: Controlling Text Display Style +@section Text Faces @cindex faces Emacs can display text in several different styles, called @@ -480,10 +481,8 @@ It's possible for a given face to look different in different frames. For instance, some text-only terminals do not support all face attributes, particularly font, height, and width, and some -support a limited range of colors. The @code{list-faces-display} -command shows the appearance for the selected frame. +support a limited range of colors. -@cindex face colors, setting @cindex background color @cindex default face You can customize a face to alter its appearance, and save those @@ -498,25 +497,58 @@ You can also use X resources to specify attributes of any particular face. @xref{Resources}. + Emacs can display variable-width fonts, but some Emacs commands, +particularly indentation commands, do not account for variable +character display widths. Therefore, we recommend not using +variable-width fonts for most faces, particularly those assigned by +Font Lock mode. + +@node Colors +@section Colors for Faces +@cindex color name +@cindex RGB triplet + + Faces can have various foreground and background colors. When you +specify a color for a face---for instance, when customizing the face +(@pxref{Face Customization})---you can use either a @dfn{color name} +or an @dfn{RGB triplet}. + +@findex list-colors-display + A color name is a pre-defined name, such as @samp{dark orange} or +@samp{medium sea green}. To view a list of color names, type @kbd{M-x +list-colors-display}. If you run this command on a graphical display, +it shows the full range of color names known to Emacs (these are the +standard X11 color names, defined in X's @file{rgb.txt} file). If you +run the command on a text-only terminal, it shows only a small subset +of colors that can be safely displayed on such terminals. However, +Emacs understands X11 color names even on text-only terminals; if a +face is given a color specified by an X11 color name, it is displayed +using the closest-matching terminal color. + + An RGB triplet is a string of the form @samp{#RRGGBB}. Each of the +R, G, and B components is a hexadecimal number specifying the +component's relative intensity, one to four digits long (usually two +digits are used). The components must have the same number of digits. +For hexadecimal values A to F, either upper or lower case are +acceptable. + + The @kbd{M-x list-colors-display} command also shows the equivalent +RGB triplet for each named color. For instance, @samp{medium sea +green} is equivalent to @samp{#3CB371}. + +@cindex face colors, setting @findex set-face-foreground @findex set-face-background - You can also change the foreground and background colors of a face -with @kbd{M-x set-face-foreground} and @kbd{M-x set-face-background}. -These commands prompt in the minibuffer for a face name and a color -name, with completion, and then set that face to use the specified -color (@pxref{Face Customization}, for information about color names). + You can change the foreground and background colors of a face with +@kbd{M-x set-face-foreground} and @kbd{M-x set-face-background}. +These commands prompt in the minibuffer for a face name and a color, +with completion, and then set that face to use the specified color. They affect the face colors on all frames, but their effects do not persist for future Emacs sessions, unlike using the customization buffer or X resources. You can also use frame parameters to set -foreground and background colors for a specific frame; see @ref{Frame +foreground and background colors for a specific frame; @xref{Frame Parameters}. - Emacs can display variable-width fonts, but some Emacs commands, -particularly indentation commands, do not account for variable -character display widths. Therefore, we recommend not using -variable-width fonts for most faces, particularly those assigned by -Font Lock mode. - @node Standard Faces @section Standard Faces @@ -1022,13 +1054,13 @@ @cindex fringes, and unused line indication On graphical displays, Emacs can indicate unused lines at the end of the window with a small image in the left fringe (@pxref{Fringes}). -The image appears for window lines that do not correspond to any -buffer text. Blank lines at the end of the buffer then stand out -because they do not have this image in the fringe. To enable this -feature, set the buffer-local variable @code{indicate-empty-lines} to -a non-@code{nil} value. You can enable or disable this feature for -all new buffers by setting the default value of this variable, -e.g.@:@code{(setq-default indicate-empty-lines t)}. +The image appears for screen lines that do not correspond to any +buffer text, so blank lines at the end of the buffer stand out because +they lack this image. To enable this feature, set the buffer-local +variable @code{indicate-empty-lines} to a non-@code{nil} value. You +can enable or disable this feature for all new buffers by setting the +default value of this variable, e.g.@: @code{(setq-default +indicate-empty-lines t)}. @node Selective Display @section Selective Display @@ -1257,7 +1289,7 @@ Some non-@acronym{ASCII} characters have the same appearance as an @acronym{ASCII} space or hyphen (minus) character. Such characters can cause problems if they are entered into a buffer without your -realization, e.g. by yanking; for instance, source code compilers +realization, e.g.@: by yanking; for instance, source code compilers typically do not treat non-@acronym{ASCII} spaces as whitespace characters. To deal with this problem, Emacs displays such characters specially: it displays @code{U+00A0} (no-break space) with the === modified file 'doc/emacs/emacs.texi' --- doc/emacs/emacs.texi 2011-11-28 11:12:00 +0000 +++ doc/emacs/emacs.texi 2011-12-03 16:17:29 +0000 @@ -113,25 +113,6 @@ @insertcopying @end ifnottex -@ignore -These subcategories have been deleted for simplicity -and to avoid conflicts. -Completion -Backup Files -Auto-Saving: Protection Against Disasters -Tags -Text Mode -Outline Mode -@TeX{} Mode -Formatted Text -Shell Command History - -The ones for Dired and Rmail have had the items turned into :: items -to avoid conflicts. -Also Running Shell Commands from Emacs -and Sending Mail and Registers and Minibuffer. -@end ignore - @menu * Distrib:: How to get the latest Emacs distribution. * Intro:: An introduction to Emacs concepts. @@ -350,6 +331,7 @@ * View Mode:: Viewing read-only buffers. * Follow Mode:: Follow mode lets two windows scroll as one. * Faces:: How to change the display style using faces. +* Colors:: Specifying colors for faces. * Standard Faces:: Emacs' predefined faces. * Text Scale:: Increasing or decreasing text size in a buffer. * Font Lock:: Minor mode for syntactic highlighting using faces. @@ -569,8 +551,8 @@ * TeX Mode:: Editing input to the formatter TeX. * HTML Mode:: Editing HTML and SGML files. * Nroff Mode:: Editing input to the formatter nroff. -* Formatted Text:: Editing formatted text directly in WYSIWYG fashion. -* Text Based Tables:: Editing text-based tables in WYSIWYG fashion. +* Enriched Text:: Editing text ``enriched'' with fonts, colors, etc. +* Text Based Tables:: Commands for editing text-based tables. * Two-Column:: Splitting text columns into separate windows. Filling Text @@ -597,18 +579,16 @@ * TeX Print:: Commands for printing part of a file with TeX. * TeX Misc:: Customization of TeX mode, and related features. -Editing Formatted Text +Editing Enriched Text -* Requesting Formatted Text:: Entering and exiting Enriched mode. -* Hard and Soft Newlines:: There are two different kinds of newlines. -* Editing Format Info:: How to edit text properties. -* Format Faces:: Bold, italic, underline, etc. -* Format Colors:: Changing the color of text. -* Format Indentation:: Changing the left and right margins. -* Format Justification:: Centering, setting text flush with the - left or right margin, etc. -* Format Properties:: The "special" text properties submenu. -* Forcing Enriched Mode:: How to force use of Enriched mode. +* Enriched Mode:: Entering and exiting Enriched mode. +* Hard and Soft Newlines:: There are two different kinds of newlines. +* Editing Format Info:: How to edit text properties. +* Enriched Faces:: Bold, italic, underline, etc. +* Enriched Indentation:: Changing the left and right margins. +* Enriched Justification:: Centering, setting text flush with the + left or right margin, etc. +* Enriched Properties:: The "special" text properties submenu. @c The automatic texinfo menu update inserts some duplicate items here @c (faces, colors, indentation, justification, properties), because @@ -1150,7 +1130,7 @@ * Environment:: Environment variables that Emacs uses. * Display X:: Changing the default display and using remote login. * Font X:: Choosing a font for text, under X. -* Colors:: Choosing display colors. +* Colors X:: Choosing display colors. * Window Size X:: Start-up window size, under X. * Borders X:: Internal and external borders, under X. * Title X:: Specifying the initial frame's title. === modified file 'doc/emacs/files.texi' --- doc/emacs/files.texi 2011-11-25 15:43:34 +0000 +++ doc/emacs/files.texi 2011-12-03 16:17:29 +0000 @@ -297,8 +297,9 @@ If you wish to edit a file as a sequence of @acronym{ASCII} characters with no special encoding or conversion, use the @kbd{M-x find-file-literally} command. This visits a file, like @kbd{C-x C-f}, -but does not do format conversion (@pxref{Formatted Text}), character -code conversion (@pxref{Coding Systems}), or automatic uncompression +but does not do format conversion (@pxref{Format Conversion,, Format +Conversion, elisp, the Emacs Lisp Reference Manual}), character code +conversion (@pxref{Coding Systems}), or automatic uncompression (@pxref{Compressed Files}), and does not add a final newline because of @code{require-final-newline} (@pxref{Customize Save}). If you have already visited the same file in the usual (non-literal) manner, this === modified file 'doc/emacs/frames.texi' --- doc/emacs/frames.texi 2011-11-27 08:22:37 +0000 +++ doc/emacs/frames.texi 2011-12-03 16:17:29 +0000 @@ -6,7 +6,7 @@ @chapter Frames and Graphical Displays @cindex frames - When Emacs is started on a graphical display, e.g. on the X Window + When Emacs is started on a graphical display, e.g.@: on the X Window System, it occupies a graphical system-level ``window''. In this manual, we call this a @dfn{frame}, reserving the word ``window'' for the part of the frame used for displaying a buffer. A frame initially @@ -245,8 +245,8 @@ @vindex mouse-highlight Some Emacs buffers include @dfn{buttons}, or @dfn{hyperlinks}: -pieces of text that perform some action (e.g. following a reference) -when activated (e.g. by clicking on them). Usually, a button's text +pieces of text that perform some action (e.g.@: following a reference) +when activated (e.g.@: by clicking on them). Usually, a button's text is visually highlighted: it is underlined, or a box is drawn around it. If you move the mouse over a button, the shape of the mouse cursor changes and the button lights up. If you change the variable @@ -302,8 +302,9 @@ @item C-Mouse-2 @kindex C-Mouse-2 -This menu is for specifying faces and other text properties -for editing formatted text. @xref{Formatted Text}. +This menu contains entries for examining faces and other text +properties, and well as for setting them (the latter is mainly useful +when editing enriched text; @pxref{Enriched Text}). @item C-Mouse-3 @kindex C-Mouse-3 @@ -657,7 +658,7 @@ @item maker The name of the font manufacturer. @item family -The name of the font family (e.g. @samp{courier}). +The name of the font family (e.g.@: @samp{courier}). @item weight The font weight---normally either @samp{bold}, @samp{medium} or @samp{light}. Some font names support other values. === modified file 'doc/emacs/glossary.texi' --- doc/emacs/glossary.texi 2011-07-10 03:11:47 +0000 +++ doc/emacs/glossary.texi 2011-12-03 16:17:29 +0000 @@ -509,11 +509,6 @@ make it easy to change several fonts at once by specifying the name of a fontset, rather than changing each font separately. @xref{Fontsets}. -@item Formatted Text -Formatted text is text that displays with formatting information while -you edit. Formatting information includes fonts, colors, and specified -margins. @xref{Formatted Text}. - @item Formfeed Character See `page.' @@ -702,9 +697,8 @@ See `incremental search.' @item Justification -Justification means adding extra spaces within lines of text -in order to adjust the position of the text edges. -@xref{Format Justification}. +Justification means adding extra spaces within lines of text in order +to adjust the position of the text edges. @xref{Fill Commands}. @item Key Binding See `binding.' @@ -1362,12 +1356,6 @@ Word search is searching for a sequence of words, considering the punctuation between them as insignificant. @xref{Word Search}. -@item WYSIWYG -WYSIWYG stands for ``What you see is what you get.'' Emacs generally -provides WYSIWYG editing for files of characters; in Enriched mode -(@pxref{Formatted Text}), it provides WYSIWYG editing for files that -include text formatting information. - @item Yanking Yanking means reinserting text previously killed (q.v.@:). It can be used to undo a mistaken kill, or for copying or moving text. Some === modified file 'doc/emacs/modes.texi' --- doc/emacs/modes.texi 2011-12-02 16:50:10 +0000 +++ doc/emacs/modes.texi 2011-12-03 16:17:29 +0000 @@ -202,7 +202,7 @@ @item Enriched mode enables editing and saving of formatted text. -@xref{Formatted Text}. +@xref{Enriched Text}. @item Flyspell mode automatically highlights misspelled words. === modified file 'doc/emacs/text.texi' --- doc/emacs/text.texi 2011-12-02 16:50:10 +0000 +++ doc/emacs/text.texi 2011-12-03 16:17:29 +0000 @@ -32,10 +32,9 @@ @findex nxml-mode Emacs has other major modes for text which contains ``embedded'' commands, such as @TeX{} and La@TeX{} (@pxref{TeX Mode}); HTML and -SGML (@pxref{HTML Mode}); XML (@pxref{Top, nXML Mode,,nxml-mode, nXML -Mode}); and Groff and Nroff (@pxref{Nroff Mode}). In addition, you -can edit formatted text in WYSIWYG style (``what you see is what you -get''), using Enriched mode (@pxref{Formatted Text}). +SGML (@pxref{HTML Mode}); XML (@pxref{Top,The nXML Mode +Manual,,nxml-mode, nXML Mode}); and Groff and Nroff (@pxref{Nroff +Mode}). @cindex ASCII art If you need to edit pictures made out of text characters (commonly @@ -48,13 +47,14 @@ @xref{Picture Mode}. @end ifnottex - +@ifinfo @cindex skeletons @cindex templates @cindex autotyping @cindex automatic typing The ``automatic typing'' features may be useful when writing text. -@inforef{Top,, autotype}. +@inforef{Top,The Autotype Manual,autotype}. +@end ifinfo @menu * Words:: Moving over and killing words. @@ -68,8 +68,8 @@ * TeX Mode:: Editing input to the formatter TeX. * HTML Mode:: Editing HTML and SGML files. * Nroff Mode:: Editing input to the formatter nroff. -* Formatted Text:: Editing formatted text directly in WYSIWYG fashion. -* Text Based Tables:: Editing text-based tables in WYSIWYG fashion. +* Enriched Text:: Editing text ``enriched'' with fonts, colors, etc. +* Text Based Tables:: Commands for editing text-based tables. * Two-Column:: Splitting text columns into separate windows. @end menu @@ -651,7 +651,8 @@ but there is a default value which you can change as well. @xref{Locals}. The @code{indentation} text property provides another way to control -the amount of indentation paragraphs receive. @xref{Format Indentation}. +the amount of indentation paragraphs receive. @xref{Enriched +Indentation}. @node Adaptive Fill @subsection Adaptive Filling @@ -808,10 +809,10 @@ Text mode turns off the features concerned with comments except when you explicitly invoke them. It changes the syntax table so that -single-quotes are considered part of words (e.g. @samp{don't} is +single-quotes are considered part of words (e.g.@: @samp{don't} is considered one word). However, if a word starts with a single-quote, it is treated as a prefix for the purposes of capitalization -(e.g. @kbd{M-c} converts @samp{'hello'} into @samp{'Hello'}, as +(e.g.@: @kbd{M-c} converts @samp{'hello'} into @samp{'Hello'}, as expected). @cindex Paragraph-Indent Text mode @@ -1086,9 +1087,9 @@ current heading line as well as all the bodies in its subtree; the subheadings themselves are left visible. The command @kbd{C-c C-k} (@code{show-branches}) reveals the subheadings, if they had previously -been hidden (e.g. by @kbd{C-c C-d}). The command @kbd{C-c C-i} +been hidden (e.g.@: by @kbd{C-c C-d}). The command @kbd{C-c C-i} (@code{show-children}) is a weaker version of this; it reveals just -the direct subheadings, i.e. those one level down. +the direct subheadings, i.e.@: those one level down. @findex hide-other @kindex C-c C-o @r{(Outline mode)} @@ -1285,18 +1286,48 @@ @TeX{} mode using the command @kbd{M-x plain-tex-mode}, @kbd{M-x latex-mode}, @kbd{M-x slitex-mode}, or @kbd{doctex-mode}. - Emacs also provides Bib@TeX{} mode, a major mode for editing -Bib@TeX{} files. Bib@TeX{} is a tool for storing and formatting -bibliographic references, which is commonly used together with -La@TeX{}. In addition, the Ref@TeX{} package provides a minor mode -which can be used in conjunction with La@TeX{} mode to manage -bibliographic references. @inforef{Top,, reftex}. + The following sections document the features of @TeX{} mode and its +variants. There are several other @TeX{}-related Emacs packages, +which are not documented in this manual: + +@itemize @bullet +@item +Bib@TeX{} mode is a major mode for Bib@TeX{} files, which are commonly +used for keeping bibliographic references for La@TeX{} documents. For +more information, see the documentation string for the command +@code{bibtex-mode}. + +@item +The Ref@TeX{} package provides a minor mode which can be used in +conjunction with La@TeX{} mode to manage bibliographic references. +@ifinfo +@xref{Top,The Ref@TeX{} Manual,,reftex}. +@end ifinfo +@ifnotinfo +For more information, see the Ref@TeX{} Info manual, which is +distributed with Emacs. +@end ifnotinfo + +@item +The AUC@TeX{} package provides more advanced features for editing +@TeX{} and its related formats, including the ability to preview +@TeX{} equations within Emacs buffers. Unlike Bib@TeX{} mode and the +Ref@TeX{} package, AUC@TeX{} is not distributed with Emacs by default. +It can be downloaded via the Package Menu (@pxref{Packages}); once +installed, see +@ifinfo +@ref{Top,The AUC@TeX{} Manual,,auctex}. +@end ifinfo +@ifnotinfo +the AUC@TeX{} manual, which is included with the package. +@end ifnotinfo +@end itemize @menu -* Editing: TeX Editing. Special commands for editing in TeX mode. -* LaTeX: LaTeX Editing. Additional commands for LaTeX input files. -* Printing: TeX Print. Commands for printing part of a file with TeX. -* Misc: TeX Misc. Customization of TeX mode, and related features. +* TeX Editing:: Special commands for editing in TeX mode. +* LaTeX Editing:: Additional commands for LaTeX input files. +* TeX Print:: Commands for printing part of a file with TeX. +* TeX Misc:: Customization of TeX mode, and related features. @end menu @node TeX Editing @@ -1321,12 +1352,10 @@ @findex tex-insert-quote @kindex " @r{(@TeX{} mode)} In @TeX{}, the character @samp{"} is not normally used; instead, -quotations begin with @samp{``} and end with @samp{''}. For -convenience, @TeX{} mode overrides the normal meaning of the key -@kbd{"} with a command that inserts a pair of single-quotes or -backquotes (@code{tex-insert-quote}). To be precise, it inserts -@samp{``} after whitespace or an open brace, @samp{"} after a -backslash, and @samp{''} after any other character. +quotations begin with @samp{``} and end with @samp{''}. @TeX{} mode +therefore binds the @kbd{"} key to the @code{tex-insert-quote} +command. This inserts @samp{``} after whitespace or an open brace, +@samp{"} after a backslash, and @samp{''} after any other character. As a special exception, if you type @kbd{"} when the text before point is either @samp{``} or @samp{''}, Emacs replaces that preceding @@ -1334,9 +1363,6 @@ @kbd{""} to insert @samp{"}, should you ever need to do so. (You can also use @kbd{C-q "} to insert this character.) - To disable the @kbd{"} expansion feature, eliminate that binding in -the local map (@pxref{Key Bindings}). - In @TeX{} mode, @samp{$} has a special syntax code which attempts to understand the way @TeX{} math mode delimiters match. When you insert a @samp{$} that is meant to exit math mode, the position of the matching @@ -1361,13 +1387,14 @@ @findex tex-validate-region @findex tex-terminate-paragraph @kindex C-j @r{(@TeX{} mode)} - There are two commands for checking the matching of braces. @kbd{C-j} -(@code{tex-terminate-paragraph}) checks the paragraph before point, and -inserts two newlines to start a new paragraph. It outputs a message in -the echo area if any mismatch is found. @kbd{M-x tex-validate-region} -checks a region, paragraph by paragraph. The errors are listed in the -@samp{*Occur*} buffer, and you can use @kbd{C-c C-c} or @kbd{Mouse-2} in -that buffer to go to a particular mismatch. + There are two commands for checking the matching of braces. +@kbd{C-j} (@code{tex-terminate-paragraph}) checks the paragraph before +point, and inserts two newlines to start a new paragraph. It outputs +a message in the echo area if any mismatch is found. @kbd{M-x +tex-validate-region} checks a region, paragraph by paragraph. The +errors are listed in an @samp{*Occur*} buffer; you can use the usual +Occur mode commands in that buffer, such as @kbd{C-c C-c}, to visit a +particular mismatch (@pxref{Other Repeating Search}). Note that Emacs commands count square brackets and parentheses in @TeX{} mode, not just braces. This is not strictly correct for the @@ -1379,8 +1406,8 @@ @node LaTeX Editing @subsection La@TeX{} Editing Commands - La@TeX{} mode (and its obsolete variant, Sli@TeX{} mode) provide a -few extra features not applicable to plain @TeX{}: + La@TeX{} mode provides a few extra features not applicable to plain +@TeX{}: @table @kbd @item C-c C-o @@ -1393,60 +1420,59 @@ @findex tex-latex-block @kindex C-c C-o @r{(La@TeX{} mode)} + In La@TeX{} input, @samp{\begin} and @samp{\end} tags are used to +group blocks of text. To insert a block, type @kbd{C-c C-o} +(@code{tex-latex-block}). This prompts for a block type, and inserts +the appropriate matching @samp{\begin} and @samp{\end} tags, leaving a +blank line between the two and moving point there. + @vindex latex-block-names - In La@TeX{} input, @samp{\begin} and @samp{\end} commands are used to -group blocks of text. To insert a @samp{\begin} and a matching -@samp{\end} (on a new line following the @samp{\begin}), use @kbd{C-c -C-o} (@code{tex-latex-block}). A blank line is inserted between the -two, and point is left there. You can use completion when you enter the -block type; to specify additional block type names beyond the standard -list, set the variable @code{latex-block-names}. For example, here's -how to add @samp{theorem}, @samp{corollary}, and @samp{proof}: - -@example -(setq latex-block-names '("theorem" "corollary" "proof")) -@end example + When entering the block type argument to @kbd{C-c C-o}, you can use +the usual completion commands (@pxref{Completion}). The default +completion list contains the standard La@TeX{} block types. If you +want additional block types for completion, customize the list +variable @code{latex-block-names}. @findex tex-close-latex-block @kindex C-c C-e @r{(La@TeX{} mode)} - In La@TeX{} input, @samp{\begin} and @samp{\end} commands must -balance. You can use @kbd{C-c C-e} (@code{tex-close-latex-block}) to -insert automatically a matching @samp{\end} to match the last unmatched -@samp{\begin}. It indents the @samp{\end} to match the corresponding -@samp{\begin}. It inserts a newline after @samp{\end} if point is at -the beginning of a line. + In La@TeX{} input, @samp{\begin} and @samp{\end} tags must balance. +You can use @kbd{C-c C-e} (@code{tex-close-latex-block}) to insert an +@samp{\end} tag which matches the last unmatched @samp{\begin}. It +also indents the @samp{\end} to match the corresponding @samp{\begin}, +and inserts a newline after the @samp{\end} tag if point is at the +beginning of a line. @node TeX Print @subsection @TeX{} Printing Commands - You can invoke @TeX{} as an inferior of Emacs on either the entire -contents of the buffer or just a region at a time. Running @TeX{} in -this way on just one chapter is a good way to see what your changes -look like without taking the time to format the entire file. + You can invoke @TeX{} as an subprocess of Emacs, supplying either +the entire contents of the buffer or just part of it (e.g.@: one +chapter of a larger document). @table @kbd +@item C-c C-b +Invoke @TeX{} on the entire current buffer (@code{tex-buffer}). @item C-c C-r Invoke @TeX{} on the current region, together with the buffer's header (@code{tex-region}). -@item C-c C-b -Invoke @TeX{} on the entire current buffer (@code{tex-buffer}). +@item C-c C-f +Invoke @TeX{} on the current file (@code{tex-file}). + +@item C-c C-v +Preview the output from the last @kbd{C-c C-r}, @kbd{C-c C-b}, or @kbd{C-c +C-f} command (@code{tex-view}). + +@item C-c C-p +Print the output from the last @kbd{C-c C-b}, @kbd{C-c C-r}, or +@kbd{C-c C-f} command (@code{tex-print}). + @item C-c @key{TAB} Invoke Bib@TeX{} on the current file (@code{tex-bibtex-file}). -@item C-c C-f -Invoke @TeX{} on the current file (@code{tex-file}). @item C-c C-l -Recenter the window showing output from the inferior @TeX{} so that -the last line can be seen (@code{tex-recenter-output-buffer}). +Recenter the window showing output from @TeX{} so that the last line +can be seen (@code{tex-recenter-output-buffer}). @item C-c C-k Kill the @TeX{} subprocess (@code{tex-kill-job}). -@item C-c C-p -Print the output from the last @kbd{C-c C-r}, @kbd{C-c C-b}, or @kbd{C-c -C-f} command (@code{tex-print}). -@item C-c C-v -Preview the output from the last @kbd{C-c C-r}, @kbd{C-c C-b}, or @kbd{C-c -C-f} command (@code{tex-view}). -@item C-c C-q -Show the printer queue (@code{tex-show-print-queue}). @item C-c C-c Invoke some other compilation command on the entire current buffer (@code{tex-compile}). @@ -1454,49 +1480,51 @@ @findex tex-buffer @kindex C-c C-b @r{(@TeX{} mode)} +@findex tex-view +@kindex C-c C-v @r{(@TeX{} mode)} @findex tex-print @kindex C-c C-p @r{(@TeX{} mode)} -@findex tex-view -@kindex C-c C-v @r{(@TeX{} mode)} -@findex tex-show-print-queue -@kindex C-c C-q @r{(@TeX{} mode)} - You can pass the current buffer through an inferior @TeX{} by means of -@kbd{C-c C-b} (@code{tex-buffer}). The formatted output appears in a -temporary file; to print it, type @kbd{C-c C-p} (@code{tex-print}). -Afterward, you can use @kbd{C-c C-q} (@code{tex-show-print-queue}) to -view the progress of your output towards being printed. If your terminal -has the ability to display @TeX{} output files, you can preview the -output on the terminal with @kbd{C-c C-v} (@code{tex-view}). + To pass the current buffer through @TeX{}, type @kbd{C-c C-b} +(@code{tex-buffer}). The formatted output goes in a temporary file, +normally a @file{.dvi} file. Afterwards, you can type @kbd{C-c C-v} +(@code{tex-view}) to launch an external program, such as +@command{xdvi}, to view this output file. You can also type @kbd{C-c +C-p} (@code{tex-print}) to print a hardcopy of the output file. @cindex @env{TEXINPUTS} environment variable @vindex tex-directory - You can specify the directory to use for running @TeX{} by setting the -variable @code{tex-directory}. @code{"."} is the default value. If -your environment variable @env{TEXINPUTS} contains relative directory -names, or if your files contains @samp{\input} commands with relative -file names, then @code{tex-directory} @emph{must} be @code{"."} or you -will get the wrong results. Otherwise, it is safe to specify some other -directory, such as @code{"/tmp"}. + By default, @kbd{C-c C-b} runs @TeX{} in the current directory. The +output of @TeX{} also goes in this directory. To run @TeX{} in a +different directory, change the variable @code{tex-directory} to the +desired directory name. If your environment variable @env{TEXINPUTS} +contains relative directory names, or if your files contains +@samp{\input} commands with relative file names, then +@code{tex-directory} @emph{must} be @code{"."} or you will get the +wrong results. Otherwise, it is safe to specify some other directory, +such as @code{"/tmp"}. @vindex tex-run-command @vindex latex-run-command -@vindex slitex-run-command +@vindex tex-dvi-view-command @vindex tex-dvi-print-command -@vindex tex-dvi-view-command -@vindex tex-show-queue-command - If you want to specify which shell commands are used in the inferior @TeX{}, -you can do so by setting the values of the variables @code{tex-run-command}, -@code{latex-run-command}, @code{slitex-run-command}, -@code{tex-dvi-print-command}, @code{tex-dvi-view-command}, and -@code{tex-show-queue-command}. The default values may -(or may not) be appropriate for your system. + The buffer's @TeX{} variant determines what shell command @kbd{C-c +C-b} actually runs. In Plain @TeX{} mode, it is specified by the +variable @code{tex-run-command}, which defaults to @code{"tex"}. In +La@TeX{} mode, it is specified by @code{latex-run-command}, which +defaults to @code{"latex"}. The shell command that @kbd{C-c C-v} runs +to view the @file{.dvi} output is determined by the variable +@code{tex-dvi-view-command}, regardless of the @TeX{} variant. The +shell command that @kbd{C-c C-p} runs to print the output is +determined by the variable @code{tex-dvi-print-command}. - Normally, the file name given to these commands comes at the end of -the command string; for example, @samp{latex @var{filename}}. In some -cases, however, the file name needs to be embedded in the command; an -example is when you need to provide the file name as an argument to one -command whose output is piped to another. You can specify where to put -the file name with @samp{*} in the command string. For example, + Normally, Emacs automatically appends the output file name to the +shell command strings described in the preceding paragraph. For +example, if @code{tex-dvi-view-command} is @code{"xdvi"}, @kbd{C-c +C-v} runs @command{xdvi @var{output-file-name}}. In some cases, +however, the file name needs to be embedded in the command, e.g.@: if +you need to provide the file name as an argument to one command whose +output is piped to another. You can specify where to put the file +name with @samp{*} in the command string. For example, @example (setq tex-dvi-print-command "dvips -f * | lpr") @@ -1506,12 +1534,12 @@ @kindex C-c C-k @r{(@TeX{} mode)} @findex tex-recenter-output-buffer @kindex C-c C-l @r{(@TeX{} mode)} - The terminal output from @TeX{}, including any error messages, appears -in a buffer called @samp{*tex-shell*}. If @TeX{} gets an error, you can -switch to this buffer and feed it input (this works as in Shell mode; -@pxref{Interactive Shell}). Without switching to this buffer you can -scroll it so that its last line is visible by typing @kbd{C-c -C-l}. + The terminal output from @TeX{}, including any error messages, +appears in a buffer called @samp{*tex-shell*}. If @TeX{} gets an +error, you can switch to this buffer and feed it input (this works as +in Shell mode; @pxref{Interactive Shell}). Without switching to this +buffer you can scroll it so that its last line is visible by typing +@kbd{C-c C-l}. Type @kbd{C-c C-k} (@code{tex-kill-job}) to kill the @TeX{} process if you see that its output is no longer useful. Using @kbd{C-c C-b} or @@ -1519,14 +1547,14 @@ @findex tex-region @kindex C-c C-r @r{(@TeX{} mode)} - You can also pass an arbitrary region through an inferior @TeX{} by typing -@kbd{C-c C-r} (@code{tex-region}). This is tricky, however, because most files -of @TeX{} input contain commands at the beginning to set parameters and -define macros, without which no later part of the file will format -correctly. To solve this problem, @kbd{C-c C-r} allows you to designate a -part of the file as containing essential commands; it is included before -the specified region as part of the input to @TeX{}. The designated part -of the file is called the @dfn{header}. + You can also pass an arbitrary region through @TeX{} by typing +@kbd{C-c C-r} (@code{tex-region}). This is tricky, however, because +most files of @TeX{} input contain commands at the beginning to set +parameters and define macros, without which no later part of the file +will format correctly. To solve this problem, @kbd{C-c C-r} allows +you to designate a part of the file as containing essential commands; +it is included before the specified region as part of the input to +@TeX{}. The designated part of the file is called the @dfn{header}. @cindex header (@TeX{} mode) To indicate the bounds of the header in Plain @TeX{} mode, you insert two @@ -1624,29 +1652,6 @@ The commands @kbd{M-x iso-iso2tex}, @kbd{M-x iso-tex2iso}, @kbd{M-x iso-iso2gtex} and @kbd{M-x iso-gtex2iso} can be used to convert between Latin-1 encoded files and @TeX{}-encoded equivalents. -@ignore -@c Too cryptic to be useful, too cryptic for me to make it better -- rms. - They -are included by default in the @code{format-alist} variable, so they -can be used with @kbd{M-x format-find-file}, for instance. -@end ignore - -@ignore @c Not worth documenting if it is only for Czech -- rms. -@findex tildify-buffer -@findex tildify-region -@cindex ties, @TeX{}, inserting -@cindex hard spaces, @TeX{}, inserting - The commands @kbd{M-x tildify-buffer} and @kbd{M-x tildify-region} -insert @samp{~} (@dfn{tie}) characters where they are conventionally -required. This is set up for Czech---customize the group -@samp{tildify} for other languages or for other sorts of markup. -@end ignore - -@cindex Ref@TeX{} package -@cindex references, La@TeX{} -@cindex La@TeX{} references - For managing all kinds of references for La@TeX{}, you can use -Ref@TeX{}. @inforef{Top,, reftex}. @node HTML Mode @section SGML and HTML Modes @@ -1749,22 +1754,27 @@ @cindex mode, nXML @findex nxml-mode @cindex XML schema - The default mode for editing XML documents is called nXML mode -(@code{xml-mode} or @code{nxml-mode}). This is a powerful major mode -that can recognize many existing XML schema and use them to provide -completion of XML elements via @kbd{C-@key{RET}} or @kbd{M-@key{TAB}}, -as well as ``on-the-fly'' XML validation with error highlighting. It -is described in its own manual. @xref{Top, nXML Mode,,nxml-mode, nXML -Mode}. + The major mode for editing XML documents is called nXML mode. This +is a powerful major mode that can recognize many existing XML schema +and use them to provide completion of XML elements via +@kbd{C-@key{RET}} or @kbd{M-@key{TAB}}, as well as ``on-the-fly'' XML +validation with error highlighting. To enable nXML mode in an +existing buffer, type @kbd{M-x nxml-mode}, or, equivalently, @kbd{M-x +xml-mode}. Emacs uses nXML mode for files which have the extension +@file{.xml}. For XHTML files, which have the extension @file{.xhtml}, +Emacs uses HTML mode by default; you can make it use nXML mode by +customizing the variable @code{auto-mode-alist} (@pxref{Choosing +Modes}). nXML mode is described in its own manual: @xref{Top, nXML +Mode,,nxml-mode, nXML Mode}. @vindex sgml-xml-mode - However, you can also use SGML mode to edit XML, since XML is a -strict subset of SGML. In XML, every opening tag must have an -explicit closing tag. When the variable @code{sgml-xml-mode} is -non-@code{nil}, the tag insertion commands described above always -insert explicit closing tags as well. When you visit a file in SGML -mode, Emacs determines whether it is XML by examining the file -contents, and sets @code{sgml-xml-mode} accordingly. + You may choose to use the less powerful SGML mode for editing XML, +since XML is a strict subset of SGML. To enable SGML mode in an +existing buffer, type @kbd{M-x sgml-mode}. On enabling SGML mode, +Emacs examines the buffer to determine whether it is XML; if so, it +sets the variable @code{sgml-xml-mode} to a non-@code{nil} value. +This causes SGML mode's tag insertion commands, described above, to +always insert explicit closing tags as well. @node Nroff Mode @section Nroff Mode @@ -1815,86 +1825,84 @@ Entering Nroff mode runs the hook @code{text-mode-hook}, followed by the hook @code{nroff-mode-hook} (@pxref{Hooks}). -@node Formatted Text -@section Editing Formatted Text - +@node Enriched Text +@section Enriched Text @cindex Enriched mode @cindex mode, Enriched -@cindex formatted text +@cindex enriched text @cindex WYSIWYG @cindex word processing - @dfn{Enriched mode} is a minor mode for editing files that contain -formatted text in WYSIWYG fashion, as in a word processor. Currently, -formatted text in Enriched mode can specify fonts, colors, underlining, -margins, and types of filling and justification. In the future, we plan -to implement other formatting features as well. - - Enriched mode is a minor mode (@pxref{Minor Modes}). It is -typically used in conjunction with Text mode (@pxref{Text Mode}), but -you can also use it with other major modes such as Outline mode and -Paragraph-Indent Text mode. - @cindex text/enriched MIME format - Potentially, Emacs can store formatted text files in various file -formats. Currently, only one format is implemented: @dfn{text/enriched} -format, which is defined by the MIME protocol. @xref{Format -Conversion,, Format Conversion, elisp, the Emacs Lisp Reference Manual}, -for details of how Emacs recognizes and converts file formats. - - The Emacs distribution contains a formatted text file that can serve as -an example. Its name is @file{etc/enriched.doc}. It contains samples -illustrating all the features described in this section. It also -contains a list of ideas for future enhancements. + + Enriched mode is a minor mode for editing formatted text files in a +WYSIWYG (``what you see is what you get'') fashion. When Enriched +mode is enabled, you can apply various formatting properties to the +text in the buffer, such as fonts and colors; upon saving the buffer, +those properties are saved together with the text, using the MIME +@samp{text/enriched} file format. + + Enriched mode is typically used with Text mode (@pxref{Text Mode}). +It is @emph{not} compatible with Font Lock mode, which is used by many +major modes, including most programming language modes, for syntax +highlighting (@pxref{Font Lock}). Unlike Enriched mode, Font Lock +mode assigns text properties automatically, based on the current +buffer contents; those properties are not saved to disk. + + The file @file{etc/enriched.doc} in the Emacs distribution serves as +an example of the features of Enriched mode. @menu -* Requesting Formatted Text:: Entering and exiting Enriched mode. -* Hard and Soft Newlines:: There are two different kinds of newlines. -* Editing Format Info:: How to edit text properties. -* Faces: Format Faces. Bold, italic, underline, etc. -* Color: Format Colors. Changing the color of text. -* Indent: Format Indentation. Changing the left and right margins. -* Justification: Format Justification. - Centering, setting text flush with the - left or right margin, etc. -* Special: Format Properties. The "special" text properties submenu. -* Forcing Enriched Mode:: How to force use of Enriched mode. +* Enriched Mode:: Entering and exiting Enriched mode. +* Hard and Soft Newlines:: There are two different kinds of newlines. +* Editing Format Info:: How to edit text properties. +* Enriched Faces:: Bold, italic, underline, etc. +* Enriched Indentation:: Changing the left and right margins. +* Enriched Justification:: Centering, setting text flush with the + left or right margin, etc. +* Enriched Properties:: The "special" text properties submenu. @end menu -@node Requesting Formatted Text -@subsection Requesting to Edit Formatted Text +@node Enriched Mode +@subsection Enriched Mode - Whenever you visit a file that Emacs saved in the text/enriched -format, Emacs automatically converts the formatting information in the -file into Emacs's own internal format (known as @dfn{text -properties}), and turns on Enriched mode. + Enriched mode is a buffer-local minor mode (@pxref{Minor Modes}). +When you visit a file that has been saved in the @samp{text/enriched} +format, Emacs automatically enables Enriched mode, and applies the +formatting information in the file to the buffer text. When you save +a buffer with Enriched mode enabled, it is saved using the +@samp{text/enriched} format, including the formatting information. @findex enriched-mode - To create a new file of formatted text, first visit the nonexistent -file, then type @kbd{M-x enriched-mode} before you start inserting text. -This command turns on Enriched mode. Do this before you begin inserting -text, to ensure that the text you insert is handled properly. - - More generally, the command @code{enriched-mode} turns Enriched mode -on if it was off, and off if it was on. With a prefix argument, this -command turns Enriched mode on if the argument is positive, and turns -the mode off otherwise. - - When you save a buffer while Enriched mode is enabled in it, Emacs -automatically converts the text to text/enriched format while writing it -into the file. When you visit the file again, Emacs will automatically -recognize the format, reconvert the text, and turn on Enriched mode -again. + To create a new file of formatted text, visit the nonexistent file +and type @kbd{M-x enriched-mode}. This command actually toggles +Enriched mode. With a prefix argument, it enables Enriched mode if +the argument is positive, and disables Enriched mode otherwise. If +you disable Enriched mode, Emacs no longer saves the buffer using the +@samp{text/enriched} format; any formatting properties that have been +added to the buffer remain in the buffer, but they are not saved to +disk. @vindex enriched-translations - You can add annotations for saving additional text properties, which -Emacs normally does not save, by adding to @code{enriched-translations}. -Note that the text/enriched standard requires any non-standard -annotations to have names starting with @samp{x-}, as in -@samp{x-read-only}. This ensures that they will not conflict with -standard annotations that may be added later. - - @xref{Text Properties,,, elisp, the Emacs Lisp Reference Manual}, -for more information about text properties. + Enriched mode does not save all Emacs text properties, only those +specified in the variable @code{enriched-translations}. These include +properties for fonts, colors, indentation, and justification. + +@findex format-decode-buffer + If you visit a file and Emacs fails to recognize that it is in the +@samp{text/enriched} format, type @kbd{M-x format-decode-buffer}. +This command prompts for a file format, and re-reads the file in that +format. Specifying the @samp{text/enriched} format automatically +enables Enriched mode. + + To view a @samp{text/enriched} file in raw form (as plain text with +markup tags rather than formatted text), use @kbd{M-x +find-file-literally} (@pxref{Visiting}). + + @xref{Format Conversion,, Format Conversion, elisp, the Emacs Lisp +Reference Manual}, for details of how Emacs recognizes and converts +file formats like @samp{text/enriched}. @xref{Text Properties,,, +elisp, the Emacs Lisp Reference Manual}, for more information about +text properties. @node Hard and Soft Newlines @subsection Hard and Soft Newlines @@ -1903,56 +1911,44 @@ @cindex newlines, hard and soft @cindex use-hard-newlines - In formatted text, Emacs distinguishes between two different kinds of -newlines, @dfn{hard} newlines and @dfn{soft} newlines. (You can enable -or disable this feature separately in any buffer with the command -@code{use-hard-newlines}.) - - Hard newlines are used to separate paragraphs, or items in a list, or -anywhere that there should always be a line break regardless of the -margins. The @key{RET} command (@code{newline}) and @kbd{C-o} -(@code{open-line}) insert hard newlines. - - Soft newlines are used to make text fit between the margins. All the -fill commands, including Auto Fill, insert soft newlines---and they -delete only soft newlines. - - Although hard and soft newlines look the same, it is important to bear -the difference in mind. Do not use @key{RET} to break lines in the -middle of filled paragraphs, or else you will get hard newlines that are -barriers to further filling. Instead, let Auto Fill mode break lines, -so that if the text or the margins change, Emacs can refill the lines -properly. @xref{Auto Fill}. - - On the other hand, in tables and lists, where the lines should always -remain as you type them, you can use @key{RET} to end lines. For these -lines, you may also want to set the justification style to -@code{unfilled}. @xref{Format Justification}. + In Enriched mode, Emacs distinguishes between two different kinds of +newlines, @dfn{hard} newlines and @dfn{soft} newlines. You can also +enable or disable this feature in other buffers, by typing @kbd{M-x +use-hard-newlines}. + + Hard newlines are used to separate paragraphs, or anywhere there +needs to be a line break regardless of how the text is filled; soft +newlines are used for filling. The @key{RET} (@code{newline}) and +@kbd{C-o} (@code{open-line}) commands insert hard newlines. The fill +commands, including Auto Fill (@pxref{Auto Fill}), insert only soft +newlines and delete only soft newlines, leaving hard newlines alone. + + Thus, when editing with Enriched mode, you should not use @key{RET} +or @kbd{C-o} to break lines in the middle of filled paragraphs. Use +Auto Fill mode or explicit fill commands (@pxref{Fill Commands}) +instead. Use @key{RET} or @kbd{C-o} where line breaks should always +remain, such as in tables and lists. For such lines, you may also +want to set the justification style to @code{unfilled} +(@pxref{Enriched Justification}). @node Editing Format Info @subsection Editing Format Information - There are two ways to alter the formatting information for a formatted -text file: with keyboard commands, and with the mouse. - - The easiest way to add properties to your document is with the Text -Properties menu. You can get to this menu in two ways: from the Edit -menu in the menu bar (use @kbd{@key{F10} e t} if you have no mouse), -or with @kbd{C-Mouse-2} (hold the @key{CTRL} key and press the middle -mouse button). There are also keyboard commands described in the -following section. - - These items in the Text Properties menu run commands directly: + The easiest way to alter properties is with the Text Properties +menu. You can get to this menu from the Edit menu in the menu bar +(@pxref{Menu Bar}), or with @kbd{C-Mouse-2} (@pxref{Menu Mouse +Clicks}). Some of the commands in the Text Properties menu are listed +below (you can also invoke them with @kbd{M-x}): @table @code @findex facemenu-remove-face-props @item Remove Face Properties -Delete from the region all face and color text properties +Remove face properties from the region (@code{facemenu-remove-face-props}). @findex facemenu-remove-all @item Remove Text Properties -Delete @emph{all} text properties from the region +Remove all text properties from the region, including face properties (@code{facemenu-remove-all}). @findex describe-text-properties @@ -1961,168 +1957,98 @@ @cindex widgets at buffer position @cindex buttons at buffer position @item Describe Properties -List all the text properties, widgets, buttons, and overlays of the -character following point (@code{describe-text-properties}). +List all text properties and other information about the character +following point (@code{describe-text-properties}). @item Display Faces -Display a list of all the defined faces (@code{list-faces-display}). +Display a list of defined faces (@code{list-faces-display}). +@xref{Faces}. @item Display Colors -Display a list of all the defined colors (@code{list-colors-display}). +Display a list of defined colors (@code{list-colors-display}). +@xref{Colors}. @end table -@ifinfo - Other items in the Text Properties menu lead to submenus: - -@menu -* Faces: Format Faces. Bold, italic, underline, etc. -* Color: Format Colors. Changing the color of text. -* Indent: Format Indentation. Changing the left and right margins. -* Justification: Format Justification. - Centering, setting text flush with the - left or right margin, etc. -* Special: Format Properties. The "special" text properties submenu. -@end menu -@end ifinfo -@ifnotinfo - The rest lead to submenus which are described in the following sections. -@end ifnotinfo - -@node Format Faces -@subsection Faces in Formatted Text - - The Faces submenu under Text Properties lists various Emacs faces -including @code{bold}, @code{italic}, and @code{underline} -(@pxref{Faces}). These menu items operate on the region if it is -active and nonempty. Otherwise, they specify to use that face for an -immediately following self-inserting character. There is also an item -@samp{Other} with which you can enter a face name through the -minibuffer (@pxref{Standard Faces}). - - Instead of the Faces submenu, you can use these keyboard commands: +@noindent +The other menu entries are described in the following sections. + +@node Enriched Faces +@subsection Faces in Enriched Text + + The following commands can be used to add or remove faces +(@pxref{Faces}). Each applies to the text in the region if the mark +is active, and to the next self-inserting character if the mark is +inactive. With a prefix argument, each command applies to the next +self-inserting character even if the region is active. @table @kbd @kindex M-o d @r{(Enriched mode)} @findex facemenu-set-default @item M-o d -Remove all @code{face} properties from the region (which includes -specified colors), or force the following inserted character to have no -@code{face} property (@code{facemenu-set-default}). +Remove all @code{face} properties (@code{facemenu-set-default}). + @kindex M-o b @r{(Enriched mode)} @findex facemenu-set-bold @item M-o b -Add the face @code{bold} to the region or to the following inserted -character (@code{facemenu-set-bold}). +Apply the @code{bold} face (@code{facemenu-set-bold}). + @kindex M-o i @r{(Enriched mode)} @findex facemenu-set-italic @item M-o i -Add the face @code{italic} to the region or to the following inserted -character (@code{facemenu-set-italic}). +Apply the @code{italic} face (@code{facemenu-set-italic}). + @kindex M-o l @r{(Enriched mode)} @findex facemenu-set-bold-italic @item M-o l -Add the face @code{bold-italic} to the region or to the following -inserted character (@code{facemenu-set-bold-italic}). +Apply the @code{bold-italic} face (@code{facemenu-set-bold-italic}). + @kindex M-o u @r{(Enriched mode)} @findex facemenu-set-underline @item M-o u -Add the face @code{underline} to the region or to the following inserted -character (@code{facemenu-set-underline}). +Apply the @code{underline} face (@code{facemenu-set-underline}). + @kindex M-o o @r{(Enriched mode)} @findex facemenu-set-face @item M-o o @var{face} @key{RET} -Add the face @var{face} to the region or to the following inserted -character (@code{facemenu-set-face}). -@end table - - With a prefix argument, all these commands apply to an immediately -following self-inserting character, disregarding the region. - - A self-inserting character normally inherits the @code{face} -property (and most other text properties) from the preceding character -in the buffer. If you use the above commands to specify face for the -next self-inserting character, or the next section's commands to -specify a foreground or background color for it, then it does not -inherit the @code{face} property from the preceding character; instead -it uses whatever you specified. It will still inherit other text -properties, though. - - Strictly speaking, these commands apply only to the first following -self-inserting character that you type. But if you insert additional -characters after it, they will inherit from the first one. So it -appears that these commands apply to all of them. - - Enriched mode defines two additional faces: @code{excerpt} and -@code{fixed}. These correspond to codes used in the text/enriched file -format. - - The @code{excerpt} face is intended for quotations. This face is the -same as @code{italic} unless you customize it (@pxref{Face Customization}). - - The @code{fixed} face means, ``Use a fixed-width font for this part -of the text.'' Applying the @code{fixed} face to a part of the text -will cause that part of the text to appear in a fixed-width font, even -if the default font is variable-width. This applies to Emacs and to -other systems that display text/enriched format. So if you -specifically want a certain part of the text to use a fixed-width -font, you should specify the @code{fixed} face for that part. - - By default, the @code{fixed} face looks the same as @code{bold}. -This is an attempt to distinguish it from @code{default}. You may -wish to customize @code{fixed} to some other fixed-width medium font. -@xref{Face Customization}. - - If your terminal cannot display different faces, you will not be -able to see them, but you can still edit documents containing faces, -and even add faces and colors to documents. The faces you specify -will be visible when the file is viewed on a terminal that can display -them. - -@node Format Colors -@subsection Colors in Formatted Text - - You can specify foreground and background colors for portions of the -text. Under Text Properties, there is a submenu for specifying the -foreground color, and a submenu for specifying the background color. -Each one lists all the colors that you have used in Enriched mode in -the current Emacs session. - - If the region is active, the command applies to the text in the -region; otherwise, it applies to any immediately following -self-inserting input. When Transient Mark mode is off -(@pxref{Disabled Transient Mark}), it always applies to the region -unless a prefix argument is given, in which case it applies to the -following input. - - Each of the two color submenus contains one additional item: -@samp{Other}. You can use this item to specify a color that is not -listed in the menu; it reads the color name with the minibuffer. To -display a list of available colors and their names, use the -@samp{Display Colors} menu item in the Text Properties menu -(@pxref{Editing Format Info}). - - Any color that you specify in this way, or that is mentioned in a -formatted text file that you read in, is added to the corresponding -color menu for the duration of the Emacs session. +Apply the face @var{face} (@code{facemenu-set-face}). @findex facemenu-set-foreground +@item M-x facemenu-set-foreground +Prompt for a color (@pxref{Colors}), and apply it as a foreground +color. + @findex facemenu-set-background - There are no predefined key bindings for specifying colors, but you can do so -with the extended commands @kbd{M-x facemenu-set-foreground} and -@kbd{M-x facemenu-set-background}. Both of these commands read the name -of the color with the minibuffer. - -@node Format Indentation -@subsection Indentation in Formatted Text - - When editing formatted text, you can specify different amounts of -indentation for the right or left margin of an entire paragraph or a -part of a paragraph. The margins you specify automatically affect the -Emacs fill commands (@pxref{Filling}) and line-breaking commands. - - The Indentation submenu of Text Properties provides a convenient -interface for specifying these properties. The submenu contains four -items: +@item M-x facemenu-set-background +Prompt for a color, and apply it as a background color. +@end table + +@noindent +These command are also available via the Text Properties menu. + + A self-inserting character normally inherits the face properties +(and most other text properties) from the preceding character in the +buffer. If you use one of the above commands to specify the face for +the next self-inserting character, that character will not inherit the +faces properties from the preceding character, but it will still +inherit other text properties. + + Enriched mode defines two additional faces: @code{excerpt} and +@code{fixed}. These correspond to codes used in the text/enriched +file format. The @code{excerpt} face is intended for quotations; by +default, it appears the same as @code{italic}. The @code{fixed} face +specifies fixed-width text; by default, it appears the same as +@code{bold}. + +@node Enriched Indentation +@subsection Indentation in Enriched Text + + In Enriched mode, you can specify different amounts of indentation +for the right or left margin of a paragraph or a part of a paragraph. +These margins also affect fill commands such as @kbd{M-q} +(@pxref{Filling}). + + The Indentation submenu of Text Properties provides four commands +for specifying indentation: @table @code @kindex C-x TAB @r{(Enriched mode)} @@ -2143,44 +2069,20 @@ Remove 4 columns of indentation from the right margin. @end table - You can use these commands repeatedly to increase or decrease the -indentation. - - The most common way to use them is to change the indentation of an -entire paragraph. For other uses, the effects of refilling can be -hard to predict, except in some special cases like the one described -next. - - The most common other use is to format paragraphs with @dfn{hanging -indents}, which means that the first line is indented less than -subsequent lines. To set up a hanging indent, increase the -indentation of the region starting after the first word of the -paragraph and running until the end of the paragraph. - - Indenting the first line of a paragraph is easier. Set the margin for -the whole paragraph where you want it to be for the body of the -paragraph, then indent the first line by inserting extra spaces or tabs. - @vindex standard-indent The variable @code{standard-indent} specifies how many columns these commands should add to or subtract from the indentation. The default -value is 4. The overall default right margin for Enriched mode is -controlled by the variable @code{fill-column}, as usual. +value is 4. The default right margin for Enriched mode is controlled +by the variable @code{fill-column}, as usual. @kindex C-c [ @r{(Enriched mode)} @kindex C-c ] @r{(Enriched mode)} @findex set-left-margin @findex set-right-margin - There are also two commands for setting the left or right margin of -the region absolutely: @code{set-left-margin} and -@code{set-right-margin}. Enriched mode binds these commands to -@kbd{C-c [} and @kbd{C-c ]}, respectively. You can specify the -margin width either with a numeric argument or in the minibuffer. - - Sometimes, as a result of editing, the filling of a paragraph becomes -messed up---parts of the paragraph may extend past the left or right -margins. When this happens, use @kbd{M-q} (@code{fill-paragraph}) to -refill the paragraph. + You can also type @kbd{C-c [} (@code{set-left-margin}) and @kbd{C-c +]} (@code{set-right-margin}) to set the left and right margins. You +can specify the margin width with a numeric argument; otherwise these +commands prompt for a value via the minibuffer. The fill prefix, if any, works in addition to the specified paragraph indentation: @kbd{C-x .} does not include the specified indentation's @@ -2188,148 +2090,76 @@ look for the fill prefix after the indentation on each line. @xref{Fill Prefix}. -@node Format Justification -@subsection Justification in Formatted Text - - When editing formatted text, you can specify various styles of -justification for a paragraph. The style you specify automatically -affects the Emacs fill commands. - - The Justification submenu of Text Properties provides a convenient -interface for specifying the style. The submenu contains five items: - -@table @code -@item Left -This is the most common style of justification (at least for English). -Lines are aligned at the left margin but left uneven at the right. - -@item Right -This aligns each line with the right margin. Spaces and tabs are added -on the left, if necessary, to make lines line up on the right. - -@item Full -This justifies the text, aligning both edges of each line. Justified -text looks very nice in a printed book, where the spaces can all be -adjusted equally, but it does not look as nice with a fixed-width font -on the screen. Perhaps a future version of Emacs will be able to adjust -the width of spaces in a line to achieve elegant justification. - -@item Center -This centers every line between the current margins. - -@item Unfilled -This turns off filling entirely. Each line will remain as you wrote it; -the fill and auto-fill functions will have no effect on text which has -this setting. You can, however, still indent the left margin. In -unfilled regions, all newlines are treated as hard newlines (@pxref{Hard -and Soft Newlines}) . -@end table - - In Enriched mode, you can also specify justification from the keyboard -using the @kbd{M-j} prefix character: +@node Enriched Justification +@subsection Justification in Enriched Text + + In Enriched mode, you can use the following commands to specify +various @dfn{justification styles} for filling. These commands apply +to the paragraph containing point, or, if the region is active, to all +paragraphs overlapping the region. @table @kbd @kindex M-j l @r{(Enriched mode)} @findex set-justification-left @item M-j l -Make the region left-filled (@code{set-justification-left}). +Align lines to the left margin (@code{set-justification-left}). + @kindex M-j r @r{(Enriched mode)} @findex set-justification-right @item M-j r -Make the region right-filled (@code{set-justification-right}). +Align lines to the right margin (@code{set-justification-right}). + @kindex M-j b @r{(Enriched mode)} @findex set-justification-full @item M-j b -Make the region fully justified (@code{set-justification-full}). +Align lines to both margins, inserting spaces in the middle of the +line to achieve this (@code{set-justification-full}). + @kindex M-j c @r{(Enriched mode)} @kindex M-S @r{(Enriched mode)} @findex set-justification-center @item M-j c @itemx M-S -Make the region centered (@code{set-justification-center}). +Center lines between the margins (@code{set-justification-center}). + @kindex M-j u @r{(Enriched mode)} @findex set-justification-none @item M-j u -Make the region unfilled (@code{set-justification-none}). +Turn off filling entirely (@code{set-justification-none}). The fill +commands do nothing on text with this setting. You can, however, +still indent the left margin. @end table - Justification styles apply to entire paragraphs. All the -justification-changing commands operate on the paragraph containing -point, or, if the region is active, on all paragraphs which overlap the -region. + You can also specify justification styles using the Justification +submenu in the Text Properties menu. @vindex default-justification - The default justification style is specified by the variable -@code{default-justification}. Its value should be one of the symbols -@code{left}, @code{right}, @code{full}, @code{center}, or @code{none}. -This is a per-buffer variable. Setting the variable directly affects -only the current buffer. However, customizing it in a Custom buffer -sets (as always) the default value for buffers that do not override it. -@xref{Locals}, and @ref{Easy Customization}. + The default justification style is specified by the per-buffer +variable @code{default-justification}. Its value should be one of the +symbols @code{left}, @code{right}, @code{full}, @code{center}, or +@code{none}. -@node Format Properties +@node Enriched Properties @subsection Setting Other Text Properties - The Special Properties submenu of Text Properties can add or remove -three other useful text properties: @code{read-only}, @code{invisible} -and @code{intangible}. The @code{intangible} property disallows -moving point within the text, the @code{invisible} text property hides -text from display, and the @code{read-only} property disallows -alteration of the text. - - Each of these special properties has a menu item to add it to the -region. The last menu item, @samp{Remove Special}, removes all of these -special properties from the text in the region. - - Currently, the @code{invisible} and @code{intangible} properties are -@emph{not} saved in the text/enriched format. The @code{read-only} -property is saved, but it is not a standard part of the text/enriched -format, so other editors may not respect it. - -@node Forcing Enriched Mode -@subsection Forcing Enriched Mode - - Normally, Emacs knows when you are editing formatted text because it -recognizes the special annotations used in the file that you visited. -However, sometimes you must take special actions to convert file -contents or turn on Enriched mode: - -@itemize @bullet -@item -When you visit a file that was created with some other editor, Emacs may -not recognize the file as being in the text/enriched format. In this -case, when you visit the file you will see the formatting commands -rather than the formatted text. Type @kbd{M-x format-decode-buffer} to -translate it. This also automatically turns on Enriched mode. - -@item -When you @emph{insert} a file into a buffer, rather than visiting it, -Emacs does the necessary conversions on the text which you insert, but -it does not enable Enriched mode. If you wish to do that, type @kbd{M-x -enriched-mode}. -@end itemize - - The command @code{format-decode-buffer} translates text in various -formats into Emacs's internal format. It asks you to specify the format -to translate from; however, normally you can type just @key{RET}, which -tells Emacs to guess the format. - -@findex format-find-file - If you wish to look at a text/enriched file in its raw form, as a -sequence of characters rather than as formatted text, use the @kbd{M-x -find-file-literally} command. This visits a file, like -@code{find-file}, but does not do format conversion. It also inhibits -character code conversion (@pxref{Coding Systems}) and automatic -uncompression (@pxref{Compressed Files}). To disable format conversion -but allow character code conversion and/or automatic uncompression if -appropriate, use @code{format-find-file} with suitable arguments. + The Special Properties submenu of Text Properties has entries for +adding or removing three other text properties: @code{read-only}, +(which disallows alteration of the text), @code{invisible} (which +hides text), and @code{intangible} (which disallows moving point +within the text). The @samp{Remove Special} menu item removes all of +these special properties from the text in the region. + + The @code{invisible} and @code{intangible} properties are @emph{not} +saved in the text/enriched format. The @code{read-only} property is +saved, but it is not a standard part of the text/enriched format, so +other editors may not respect it. @node Text Based Tables @section Editing Text-based Tables @cindex table mode @cindex text-based tables - Table mode provides an easy and intuitive way to create and edit WYSIWYG + Table mode provides an easy and intuitive way to create and edit text-based tables. Here is an example of such a table: @smallexample === modified file 'doc/emacs/xresources.texi' --- doc/emacs/xresources.texi 2011-09-18 20:01:37 +0000 +++ doc/emacs/xresources.texi 2011-12-03 16:17:29 +0000 @@ -306,14 +306,14 @@ @item @code{toolBar} (class @code{ToolBar}) @cindex tool bar Number of lines to reserve for the tool bar. A zero value suppresses -the tool bar. For the Emacs tool bar (i.e. not Gtk+), if the value is -non-zero and @code{auto-resize-tool-bars} is non-@code{nil}, the tool bar's -size will be changed automatically so that all tool bar items are visible. - If the value of @code{auto-resize-tool-bars} is @code{grow-only}, -the tool bar expands automatically, but does not contract automatically. -To contract the tool bar, you must redraw the frame by entering @kbd{C-l}. -For the Gtk+ tool bar, any non-zero value means on and -@code{auto-resize-tool-bars} has no effect. +the tool bar. For the Emacs tool bar (i.e.@: not Gtk+), if the value +is non-zero and @code{auto-resize-tool-bars} is non-@code{nil}, the +tool bar's size will be changed automatically so that all tool bar +items are visible. If the value of @code{auto-resize-tool-bars} is +@code{grow-only}, the tool bar expands automatically, but does not +contract automatically. To contract the tool bar, you must redraw the +frame by entering @kbd{C-l}. For the Gtk+ tool bar, any non-zero +value means on and @code{auto-resize-tool-bars} has no effect. @item @code{useXIM} (class @code{UseXIM}) @cindex XIM @@ -641,17 +641,18 @@ @node GTK resources @appendixsec GTK resources @iftex - The most common way to customize the GTK widgets Emacs uses (menus, dialogs -tool bars and scroll bars) is by choosing an appropriate theme, for example -with the GNOME theme selector. + The most common way to customize the GTK widgets Emacs uses (menus, +dialogs tool bars and scroll bars) is by choosing an appropriate +theme, for example with the GNOME theme selector. -You can also do Emacs specific customization -by inserting GTK style directives in the file @file{~/.emacs.d/gtkrc}, -but only if you have a Gtk+ version earlier than 3 (i.e. 2). Some GTK -themes ignore customizations in @file{~/.emacs.d/gtkrc} so not everything -works with all themes. To customize Emacs font, background, faces, etc., use -the normal X resources (@pxref{Resources}). We will present some examples of -customizations here, but for a more detailed description, see the online manual +You can also do Emacs specific customization by inserting GTK style +directives in the file @file{~/.emacs.d/gtkrc}, but only if you have a +Gtk+ version earlier than 3 (i.e.@: 2). Some GTK themes ignore +customizations in @file{~/.emacs.d/gtkrc} so not everything works with +all themes. To customize Emacs font, background, faces, etc., use the +normal X resources (@pxref{Resources}). We will present some examples +of customizations here, but for a more detailed description, see the +online manual The first example is just one line. It changes the font on all GTK widgets to courier with size 12: @@ -1065,7 +1066,7 @@ This is the default state for widgets. @item ACTIVE This is the state for a widget that is ready to do something. It is -also for the trough of a scroll bar, i.e. @code{bg[ACTIVE] = "red"} +also for the trough of a scroll bar, i.e.@: @code{bg[ACTIVE] = "red"} sets the scroll bar trough to red. Buttons that have been pressed but not released yet (``armed'') are in this state. @item PRELIGHT @@ -1109,7 +1110,7 @@ the pixmap file in directories specified in @code{pixmap_path}. @code{pixmap_path} is a colon-separated list of directories within double quotes, specified at the top level in a @file{gtkrc} file -(i.e. not inside a style definition; see example above): +(i.e.@: not inside a style definition; see example above): @smallexample pixmap_path "/usr/share/pixmaps:/usr/include/X11/pixmaps" @@ -1131,19 +1132,18 @@ syntax. The names are case insensitive. @end table - There are three ways to specify a color: by name, in hexadecimal -form, and with an RGB triplet. - -@noindent -A color name is written within double quotes, for example @code{"red"}. - -@noindent -Hexadecimal form is the same as in X: -@code{#@var{rrrr}@var{gggg}@var{bbbb}}, where all three color specs -must have the same number of hex digits (1, 2, 3 or 4). - -@noindent -An RGB triplet looks like @code{@{ @var{r}, @var{g}, @var{b} @}}, + There are three ways to specify a color: a color name, an RGB +triplet, or a GTK-style RGB triplet. @xref{Colors}, for a description +of color names and RGB triplets. Color names should be enclosed with +double quotes, e.g.@: @samp{"red"}. RGB triplets should be written +without double quotes, e.g.@: @samp{#ff0000}. GTK-style RGB triplets +have the form + +@smallexample +@code{@{ @var{r}, @var{g}, @var{b} @}} +@end smallexample + +@noindent where @var{r}, @var{g} and @var{b} are either integers in the range 0-65535 or floats in the range 0.0-1.0. ------------------------------------------------------------ revno: 106590 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-12-03 15:32:29 +0200 message: Minor doc fixes in doc/emacs/display.texi. doc/emacs/display.texi (Auto Scrolling): More accurate description of what scroll-*-aggressively does, including the effect of non-zero margin. Fix "i.e." markup. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2011-12-02 16:50:10 +0000 +++ doc/emacs/ChangeLog 2011-12-03 13:32:29 +0000 @@ -1,3 +1,9 @@ +2011-12-03 Eli Zaretskii + + * display.texi (Auto Scrolling): More accurate description of what + scroll-*-aggressively does, including the effect of non-zero + margin. Fix "i.e." markup. + 2011-12-02 Chong Yidong * text.texi (Pages): Mention how formfeed chars are displayed. === modified file 'doc/emacs/display.texi' --- doc/emacs/display.texi 2011-11-27 08:22:37 +0000 +++ doc/emacs/display.texi 2011-12-03 13:32:29 +0000 @@ -238,26 +238,32 @@ @cindex aggressive scrolling @vindex scroll-up-aggressively @vindex scroll-down-aggressively - When the window does scroll by a longer distance, you can control -how aggressively it scrolls by setting the variables -@code{scroll-up-aggressively} and @code{scroll-down-aggressively}. -The value of @code{scroll-up-aggressively} should be either -@code{nil}, or a fraction @var{f} between 0 and 1. A fraction -specifies where on the screen to put point when scrolling upward, -i.e. forward. When point goes off the window end, the new start -position is chosen to put point @var{f} parts of the window height -from the bottom. Thus, larger @var{f} means more aggressive -scrolling: more new text is brought into view. The default value, -@code{nil}, is equivalent to 0.5. + When the window does scroll by a distance longer than +@code{scroll-step}, you can control how aggressively it scrolls by +setting the variables @code{scroll-up-aggressively} and +@code{scroll-down-aggressively}. The value of +@code{scroll-up-aggressively} should be either @code{nil}, or a +fraction @var{f} between 0 and 1. A fraction specifies where on the +screen to put point when scrolling upward, i.e.@: forward. When point +goes off the window end, the new start position is chosen to put point +@var{f} parts of the window height from the bottom margin. Thus, +larger @var{f} means more aggressive scrolling: more new text is +brought into view. The default value, @code{nil}, is equivalent to +0.5. Likewise, @code{scroll-down-aggressively} is used for scrolling -down, i.e. backward. The value specifies how far point should be -placed from the top of the window; thus, as with +down, i.e.@: backward. The value specifies how far point should be +placed from the top margin of the window; thus, as with @code{scroll-up-aggressively}, a larger value is more aggressive. These two variables are ignored if either @code{scroll-step} or @code{scroll-conservatively} are set to a non-zero value. + Note that @code{scroll-margin}, described below, limits the amount +of scrolling so as to put point outside of the top or bottom margin, +even if aggressive scrolling specifies a fraction @var{f} that is +larger than the window portion between the top and the bottom margins. + @vindex scroll-margin The variable @code{scroll-margin} restricts how close point can come to the top or bottom of a window. Its value is a number of screen ------------------------------------------------------------ revno: 106589 committer: Glenn Morris branch nick: trunk timestamp: Sat 2011-12-03 06:18:40 -0500 message: Auto-commit of loaddefs files. diff: === modified file 'lisp/dired.el' --- lisp/dired.el 2011-11-19 09:18:31 +0000 +++ lisp/dired.el 2011-12-03 11:18:40 +0000 @@ -3667,7 +3667,7 @@ ;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command ;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown ;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff -;;;;;; dired-diff) "dired-aux" "dired-aux.el" "2026ac587f0d9e893bae7662ff9d9318") +;;;;;; dired-diff) "dired-aux" "dired-aux.el" "2301de52aab0488c60d2b4841b6f597f") ;;; Generated autoloads from dired-aux.el (autoload 'dired-diff "dired-aux" "\ ------------------------------------------------------------ revno: 106588 fixes bug(s): http://debbugs.gnu.org/10192 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-12-03 11:55:27 +0200 message: Fix bug #10192 with assertion violation when scrolling. src/xdisp.c (redisplay_window): Don't let `margin' become negative. This could happen when scroll-margin is zero and scroll-*-aggressively is a small float number. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-12-03 07:59:23 +0000 +++ src/ChangeLog 2011-12-03 09:55:27 +0000 @@ -3,6 +3,7 @@ * xdisp.c (handle_invisible_prop): If the invisible text ends just before a newline, prepare the bidi iterator for consuming the newline, and keep the current paragraph direction. (Bug#10183) + (redisplay_window): Don't let `margin' become negative. (Bug#10192) 2011-12-02 Juri Linkov === modified file 'src/xdisp.c' --- src/xdisp.c 2011-12-03 07:59:23 +0000 +++ src/xdisp.c 2011-12-03 09:55:27 +0000 @@ -15617,7 +15617,7 @@ pt_offset = float_amount * WINDOW_BOX_TEXT_HEIGHT (w); if (pt_offset == 0 && float_amount > 0) pt_offset = 1; - if (pt_offset) + if (pt_offset && margin > 0) margin -= 1; } /* Compute how much to move the window start backward from ------------------------------------------------------------ revno: 106587 fixes bug(s): http://debbugs.gnu.org/10183 committer: Eli Zaretskii branch nick: trunk timestamp: Sat 2011-12-03 09:59:23 +0200 message: Fix parts 1 & 2 of bug #10183 with RTL headings in Org mode. src/xdisp.c (handle_invisible_prop): If the invisible text ends just before a newline, prepare the bidi iterator for consuming the newline, and keep the current paragraph direction. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2011-12-02 10:19:49 +0000 +++ src/ChangeLog 2011-12-03 07:59:23 +0000 @@ -1,3 +1,9 @@ +2011-12-03 Eli Zaretskii + + * xdisp.c (handle_invisible_prop): If the invisible text ends just + before a newline, prepare the bidi iterator for consuming the + newline, and keep the current paragraph direction. (Bug#10183) + 2011-12-02 Juri Linkov * search.c (Fword_search_regexp): New Lisp function created from === modified file 'src/xdisp.c' --- src/xdisp.c 2011-11-27 04:43:11 +0000 +++ src/xdisp.c 2011-12-03 07:59:23 +0000 @@ -4093,26 +4093,37 @@ if (it->bidi_p && newpos < ZV) { EMACS_INT bpos = CHAR_TO_BYTE (newpos); + int on_newline = FETCH_BYTE (bpos) == '\n'; + int after_newline = + newpos <= BEGV || FETCH_BYTE (bpos - 1) == '\n'; - if (FETCH_BYTE (bpos) == '\n' - || (newpos > BEGV && FETCH_BYTE (bpos - 1) == '\n')) + /* If the invisible text ends on a newline or on a + character after a newline, we can avoid the costly, + character by character, bidi iteration to NEWPOS, and + instead simply reseat the iterator there. That's + because all bidi reordering information is tossed at + the newline. This is a big win for modes that hide + complete lines, like Outline, Org, etc. */ + if (on_newline || after_newline) { - /* If the invisible text ends on a newline or the - character after a newline, we can avoid the - costly, character by character, bidi iteration to - newpos, and instead simply reseat the iterator - there. That's because all bidi reordering - information is tossed at the newline. This is a - big win for modes that hide complete lines, like - Outline, Org, etc. (Implementation note: the - call to reseat_1 is necessary, because it signals - to the bidi iterator that it needs to reinit its - internal information when the next element for - display is requested. */ struct text_pos tpos; + bidi_dir_t pdir = it->bidi_it.paragraph_dir; SET_TEXT_POS (tpos, newpos, bpos); reseat_1 (it, tpos, 0); + /* If we reseat on a newline, we need to prep the + bidi iterator for advancing to the next character + after the newline, keeping the current paragraph + direction (so that PRODUCE_GLYPHS does TRT wrt + prepending/appending glyphs to a glyph row). */ + if (on_newline) + { + it->bidi_it.first_elt = 0; + it->bidi_it.paragraph_dir = pdir; + it->bidi_it.ch = '\n'; + it->bidi_it.nchars = 1; + it->bidi_it.ch_len = 1; + } } else /* Must use the slow method. */ { @@ -4121,11 +4132,11 @@ non-base embedding level. Therefore, we need to skip invisible text using the bidi iterator, starting at IT's current position, until we find - ourselves outside the invisible text. Skipping - invisible text _after_ bidi iteration avoids - affecting the visual order of the displayed text - when invisible properties are added or - removed. */ + ourselves outside of the invisible text. + Skipping invisible text _after_ bidi iteration + avoids affecting the visual order of the + displayed text when invisible properties are + added or removed. */ if (it->bidi_it.first_elt && it->bidi_it.charpos < ZV) { /* If we were `reseat'ed to a new paragraph, ------------------------------------------------------------ revno: 106586 committer: Stefan Monnier branch nick: trunk timestamp: Sat 2011-12-03 00:01:41 -0500 message: * lisp/electric.el: Streamline electric-indent's hook. (electric-indent-chars): Revert to simple list. (electric-indent-functions): New var. (electric-indent-post-self-insert-function): Use it. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2011-12-03 04:12:11 +0000 +++ lisp/ChangeLog 2011-12-03 05:01:41 +0000 @@ -1,5 +1,10 @@ 2011-12-03 Stefan Monnier + * electric.el: Streamline electric-indent's hook. + (electric-indent-chars): Revert to simple list. + (electric-indent-functions): New var. + (electric-indent-post-self-insert-function): Use it. + * progmodes/prolog.el (prolog-find-value-by-system): Avoid error when there's no inferior buffer (bug#10196). (prolog-consult-compile): Don't use toggle-read-only. === modified file 'lisp/electric.el' --- lisp/electric.el 2011-11-20 06:29:57 +0000 +++ lisp/electric.el 2011-12-03 05:01:41 +0000 @@ -197,11 +197,13 @@ ;; value, which only works well if the variable is preloaded. ;;;###autoload (defvar electric-indent-chars '(?\n) - "Characters that should cause automatic reindentation. -Each entry of the list can be either a character or a cons of the -form (CHAR . PREDICATE) which means that CHAR should cause reindentation -only if PREDICATE returns non-nil. PREDICATE is called with no arguments -and with point before the inserted char.") + "Characters that should cause automatic reindentation.") + +(defvar electric-indent-functions nil + "Special hook run to decide whether to auto-indent. +Each function is called with one argument (the inserted char), with +point right after that char, and it should return t to cause indentation, +`no-indent' to prevent indentation or nil to let other functions decide.") (defun electric-indent-post-self-insert-function () ;; FIXME: This reindents the current line, but what we really want instead is @@ -212,18 +214,21 @@ ;; There might be a way to get it working by analyzing buffer-undo-list, but ;; it looks challenging. (let (pos) - (when (and (or (memq last-command-event electric-indent-chars) - (let ((cp (assq last-command-event electric-indent-chars))) - (and cp (setq pos (electric--after-char-pos)) - (save-excursion - (goto-char (1- pos)) - (funcall (cdr cp)))))) - ;; Don't reindent while inserting spaces at beginning of line. - (or (not (memq last-command-event '(?\s ?\t))) - (save-excursion (skip-chars-backward " \t") (not (bolp)))) - (setq pos (electric--after-char-pos)) - ;; Not in a string or comment. - (not (nth 8 (save-excursion (syntax-ppss pos))))) + (when (and + ;; Don't reindent while inserting spaces at beginning of line. + (or (not (memq last-command-event '(?\s ?\t))) + (save-excursion (skip-chars-backward " \t") (not (bolp)))) + (setq pos (electric--after-char-pos)) + (save-excursion + (goto-char pos) + (let ((act (or (run-hook-with-args-until-success + 'electric-indent-functions + last-command-event) + (memq last-command-event electric-indent-chars)))) + (not + (or (memq act '(nil no-indent)) + ;; In a string or comment. + (unless (eq act 'do-indent) (nth 8 (syntax-ppss)))))))) ;; For newline, we want to reindent both lines and basically behave like ;; reindent-then-newline-and-indent (whose code we hence copied). (when (< (1- pos) (line-beginning-position)) @@ -231,7 +236,7 @@ (save-excursion (unless (memq indent-line-function '(indent-relative indent-to-left-margin - indent-relative-maybe)) + indent-relative-maybe)) ;; Don't reindent the previous line if the indentation function ;; is not a real one. (goto-char before)