diff options
| -rw-r--r-- | doc/lispref/ChangeLog | 10 | ||||
| -rw-r--r-- | doc/lispref/frames.texi | 215 |
2 files changed, 171 insertions, 54 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 6b84026d2e5..356560f2576 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2014-10-22 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * frames.texi (Size Parameters): Replace "frame contents" by | ||
| 4 | "frame's text area". Add reference to Size and Position | ||
| 5 | section. | ||
| 6 | (Size and Position): Major rewrite. Add explanations for | ||
| 7 | frame's default font, text and display areas. Add descriptions | ||
| 8 | for `set-frame-font', `frame-text-height', `frame-text-width' | ||
| 9 | and `frame-inhibit-implied-resize'. | ||
| 10 | |||
| 1 | 2014-10-20 Glenn Morris <rgm@gnu.org> | 11 | 2014-10-20 Glenn Morris <rgm@gnu.org> |
| 2 | 12 | ||
| 3 | * Merge in all changes up to 24.4 release. | 13 | * Merge in all changes up to 24.4 release. |
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index a14702a7ce1..146170a967c 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi | |||
| @@ -709,13 +709,13 @@ pixel sizes of these character units (@pxref{Face Attributes}). | |||
| 709 | @table @code | 709 | @table @code |
| 710 | @vindex height, a frame parameter | 710 | @vindex height, a frame parameter |
| 711 | @item height | 711 | @item height |
| 712 | The height of the frame contents, in characters. (To get the height in | 712 | The height of the frame's text area (@pxref{Size and Position}), in |
| 713 | pixels, call @code{frame-pixel-height}; see @ref{Size and Position}.) | 713 | characters. |
| 714 | 714 | ||
| 715 | @vindex width, a frame parameter | 715 | @vindex width, a frame parameter |
| 716 | @item width | 716 | @item width |
| 717 | The width of the frame contents, in characters. (To get the width in | 717 | The width of the frame's text area (@pxref{Size and Position}), in |
| 718 | pixels, call @code{frame-pixel-width}; see @ref{Size and Position}.) | 718 | characters. |
| 719 | 719 | ||
| 720 | @vindex user-size, a frame parameter | 720 | @vindex user-size, a frame parameter |
| 721 | @item user-size | 721 | @item user-size |
| @@ -739,9 +739,9 @@ with the mouse, while the latter really covers the whole screen and | |||
| 739 | does not allow resizing by mouse dragging. | 739 | does not allow resizing by mouse dragging. |
| 740 | 740 | ||
| 741 | With some window managers you may have to customize the variable | 741 | With some window managers you may have to customize the variable |
| 742 | @code{frame-resize-pixelwise} to a non-@code{nil} value in order to make | 742 | @code{frame-resize-pixelwise} (@pxref{Size and Position}) to a |
| 743 | a frame appear ``maximized'' or ``fullscreen''. | 743 | non-@code{nil} value in order to make a frame appear ``maximized'' or |
| 744 | 744 | ``fullscreen''. | |
| 745 | @end table | 745 | @end table |
| 746 | 746 | ||
| 747 | @node Layout Parameters | 747 | @node Layout Parameters |
| @@ -1136,65 +1136,137 @@ equivalent to the @code{:background} attribute of the | |||
| 1136 | @code{scroll-bar} face. | 1136 | @code{scroll-bar} face. |
| 1137 | @end table | 1137 | @end table |
| 1138 | 1138 | ||
| 1139 | |||
| 1139 | @node Size and Position | 1140 | @node Size and Position |
| 1140 | @subsection Frame Size And Position | 1141 | @subsection Frame Size and Position |
| 1141 | @cindex size of frame | 1142 | @cindex size of frame |
| 1142 | @cindex screen size | 1143 | @cindex screen size |
| 1143 | @cindex frame size | 1144 | @cindex frame size |
| 1144 | @cindex resize frame | 1145 | @cindex resize frame |
| 1145 | 1146 | ||
| 1146 | You can read or change the size and position of a frame using the | 1147 | You can read or change the size and position of a frame using the frame |
| 1147 | frame parameters @code{left}, @code{top}, @code{height}, and | 1148 | parameters @code{left}, @code{top}, @code{height}, and @code{width}. |
| 1148 | @code{width}. Whatever geometry parameters you don't specify are chosen | 1149 | Whatever geometry parameters you don't specify are chosen by the window |
| 1149 | by the window manager in its usual fashion. | 1150 | manager in its usual fashion. |
| 1150 | 1151 | ||
| 1151 | Here are some special features for working with sizes and positions. | 1152 | Here are some special features for working with sizes and positions. |
| 1152 | (For the precise meaning of ``selected frame'' used by these functions, | 1153 | Most of the functions described below use a @var{frame} argument which |
| 1153 | see @ref{Input Focus}.) | 1154 | has to specify a live frame. If omitted or @code{nil}, it specifies the |
| 1155 | selected frame, see @ref{Input Focus}. | ||
| 1154 | 1156 | ||
| 1155 | @defun set-frame-position frame left top | 1157 | @defun set-frame-position frame left top |
| 1156 | This function sets the position of the top left corner of @var{frame} to | 1158 | This function sets the position of the top left corner of @var{frame} to |
| 1157 | @var{left} and @var{top}. These arguments are measured in pixels, and | 1159 | @var{left} and @var{top}. These arguments are measured in pixels, and |
| 1158 | normally count from the top left corner of the screen. | 1160 | normally count from the top left corner of the screen to the top left |
| 1161 | corner of the rectangle allotted to the frame by the window manager. | ||
| 1159 | 1162 | ||
| 1160 | Negative parameter values position the bottom edge of the window up from | 1163 | Negative parameter values position the bottom edge of that rectangle up |
| 1161 | the bottom edge of the screen, or the right window edge to the left of | 1164 | from the bottom edge of the screen, or the right rectangle edge to the |
| 1162 | the right edge of the screen. It would probably be better if the values | 1165 | left of the right edge of the screen. It would probably be better if |
| 1163 | were always counted from the left and top, so that negative arguments | 1166 | the values were always counted from the left and top, so that negative |
| 1164 | would position the frame partly off the top or left edge of the screen, | 1167 | arguments would position the frame partly off the top or left edge of |
| 1165 | but it seems inadvisable to change that now. | 1168 | the screen, but it seems inadvisable to change that now. |
| 1166 | @end defun | 1169 | @end defun |
| 1167 | 1170 | ||
| 1168 | @defun frame-height &optional frame | 1171 | @cindex frame default font |
| 1169 | @defunx frame-width &optional frame | 1172 | @cindex default font of a frame |
| 1170 | These functions return the height and width of @var{frame}, measured in | 1173 | Each frame has a @dfn{default font} which specifies the canonical height |
| 1171 | lines and columns. If you don't supply @var{frame}, they use the | 1174 | and width of a character on that frame. The default font is used when |
| 1172 | selected frame. | 1175 | retrieving or changing the size of a frame in terms of columns or lines. |
| 1173 | @end defun | 1176 | It is also used when resizing (@pxref{Window Sizes}) or splitting |
| 1177 | (@pxref{Splitting Windows}) windows. | ||
| 1178 | |||
| 1179 | @defun frame-char-height &optional frame | ||
| 1180 | @defunx frame-char-width &optional frame | ||
| 1181 | These functions return the canonical height and width of a character in | ||
| 1182 | @var{frame}, measured in pixels. Together, these values establish the | ||
| 1183 | size of the default font on @var{frame}. The values depend on the | ||
| 1184 | choice of font for @var{frame}, see @ref{Font and Color Parameters}. | ||
| 1185 | @end defun | ||
| 1186 | |||
| 1187 | The default font can be also set directly with the following function: | ||
| 1188 | |||
| 1189 | @deffn Command set-frame-font font &optional keep-size frames | ||
| 1190 | This sets the default font to @var{font}. When called interactively, it | ||
| 1191 | prompts for the name of a font, and uses that font on the selected | ||
| 1192 | frame. When called from Lisp, @var{font} should be a font name (a | ||
| 1193 | string), a font object, font entity, or a font spec. | ||
| 1194 | |||
| 1195 | If the optional argument @var{keep-size} is @code{nil}, this keeps the | ||
| 1196 | number of frame lines and columns fixed. (If non-@code{nil}, the option | ||
| 1197 | @code{frame-inhibit-implied-resize} described below will override this.) | ||
| 1198 | If @var{keep-size} is non-@code{nil} (or with a prefix argument), it | ||
| 1199 | tries to keep the size of the display area of the current frame fixed by | ||
| 1200 | adjusting the number of lines and columns. | ||
| 1201 | |||
| 1202 | If the optional argument @var{frames} is @code{nil}, this applies the | ||
| 1203 | font to the selected frame only. If @var{frames} is non-@code{nil}, it | ||
| 1204 | should be a list of frames to act upon, or @code{t} meaning all existing | ||
| 1205 | graphical frames. | ||
| 1206 | @end deffn | ||
| 1207 | |||
| 1208 | @cindex frame display area | ||
| 1209 | @cindex display area of a frame | ||
| 1210 | The @dfn{display area} of a frame is a rectangular area within the area | ||
| 1211 | allotted to the frame by the window manager. The display area neither | ||
| 1212 | includes the title bar (@pxref{Frame Titles}) nor any other decorations | ||
| 1213 | provided by the window manager (like an external border used for | ||
| 1214 | resizing frames via mouse dragging). | ||
| 1215 | |||
| 1216 | The actual height of the display area depends on the window-system | ||
| 1217 | and toolkit in use. With GTK+, the display area does not include any | ||
| 1218 | tool bar or menu bar. With the Motif or Lucid toolkits and with | ||
| 1219 | Windows, the display area includes the tool bar but not the menu bar. | ||
| 1220 | In a graphical version with no toolkit, it includes both the tool bar | ||
| 1221 | and menu bar. On a text terminal, the display area includes the menu | ||
| 1222 | bar. | ||
| 1174 | 1223 | ||
| 1175 | @defun frame-pixel-height &optional frame | 1224 | @defun frame-pixel-height &optional frame |
| 1176 | @defunx frame-pixel-width &optional frame | 1225 | @defunx frame-pixel-width &optional frame |
| 1177 | These functions return the height and width of the main display area | 1226 | These functions return the height and width of the display area of |
| 1178 | of @var{frame}, measured in pixels. If you don't supply @var{frame}, | 1227 | @var{frame}, measured in pixels. For a text terminal, the results are |
| 1179 | they use the selected frame. For a text terminal, the results are in | 1228 | in characters rather than pixels. |
| 1180 | characters rather than pixels. | 1229 | @end defun |
| 1181 | 1230 | ||
| 1182 | These values include the internal borders, and windows' scroll bars | 1231 | @cindex frame text area |
| 1183 | and fringes (which belong to individual windows, not to the frame | 1232 | @cindex text area of a frame |
| 1184 | itself). The exact value of the heights depends on the window-system | 1233 | The @dfn{text area} of a frame is a concept implicitly used by all |
| 1185 | and toolkit in use. With GTK+, the height does not include any tool | 1234 | functions that change a frame's height or width. It is a rectangle |
| 1186 | bar or menu bar. With the Motif or Lucid toolkits, it includes the | 1235 | located within the display area. Its size is obtained from that of the |
| 1187 | tool bar but not the menu bar. In a graphical version with no | 1236 | display area by subtracting the sizes of any tool or menu bars that are |
| 1188 | toolkit, it includes both the tool bar and menu bar. For a text | 1237 | part of the display area, any internal borders, one vertical and one |
| 1189 | terminal, the result includes the menu bar. | 1238 | horizontal scroll bar, and one left and one right fringe as specified |
| 1239 | for this frame, see @ref{Layout Parameters}. | ||
| 1240 | |||
| 1241 | @defun frame-text-height &optional frame | ||
| 1242 | @defunx frame-text-width &optional frame | ||
| 1243 | These functions return the height and width of the text area of | ||
| 1244 | @var{frame}, measured in pixels. For a text terminal, the results are | ||
| 1245 | in characters rather than pixels. | ||
| 1246 | |||
| 1247 | The value returned by @code{frame-text-height} differs from that | ||
| 1248 | returned by @code{frame-pixel-height} by not including the heights of | ||
| 1249 | any tool bar or menu bar, the height of one horizontal scroll bar and | ||
| 1250 | the widths of the internal border. | ||
| 1251 | |||
| 1252 | The value returned by @code{frame-text-width} differs from that returned | ||
| 1253 | by @code{frame-pixel-width} by not including the width of one vertical | ||
| 1254 | scroll bar, the widths of one left and one right fringe and the widths | ||
| 1255 | of the internal border. | ||
| 1190 | @end defun | 1256 | @end defun |
| 1191 | 1257 | ||
| 1192 | @defun frame-char-height &optional frame | 1258 | @defun frame-height &optional frame |
| 1193 | @defunx frame-char-width &optional frame | 1259 | @defunx frame-width &optional frame |
| 1194 | These functions return the height and width of a character in | 1260 | These functions return the height and width of the text area of |
| 1195 | @var{frame}, measured in pixels. The values depend on the choice of | 1261 | @var{frame}, measured in units of the default font height and width of |
| 1196 | font. If you don't supply @var{frame}, these functions use the selected | 1262 | @var{frame}. These functions are plain shorthands for writing |
| 1197 | frame. | 1263 | @code{(frame-parameter frame 'height)} and @code{(frame-parameter frame |
| 1264 | 'width)}. | ||
| 1265 | |||
| 1266 | If the text area of @var{frame} measured in pixles is not a multiple of | ||
| 1267 | its default font size, the values returned by this functions are rounded | ||
| 1268 | down to the number of characters of the default font that fully fit into | ||
| 1269 | the text area. | ||
| 1198 | @end defun | 1270 | @end defun |
| 1199 | 1271 | ||
| 1200 | @defopt frame-resize-pixelwise | 1272 | @defopt frame-resize-pixelwise |
| @@ -1220,9 +1292,9 @@ order to make a frame appear truly ``maximized'' or ``fullscreen''. | |||
| 1220 | @end defopt | 1292 | @end defopt |
| 1221 | 1293 | ||
| 1222 | @defun set-frame-size frame width height pixelwise | 1294 | @defun set-frame-size frame width height pixelwise |
| 1223 | This function sets the size of @var{frame}, measured in characters; | 1295 | This function sets the size of the text area of @var{frame}, measured in |
| 1224 | @var{width} and @var{height} specify the new width in columns and the | 1296 | characters; @var{width} and @var{height} specify the new width in |
| 1225 | new height in lines. | 1297 | columns and the new height in lines. |
| 1226 | 1298 | ||
| 1227 | The optional argument @var{pixelwise} non-@code{nil} means to measure | 1299 | The optional argument @var{pixelwise} non-@code{nil} means to measure |
| 1228 | the new width and height in units of pixels instead. Note that if | 1300 | the new width and height in units of pixels instead. Note that if |
| @@ -1232,9 +1304,9 @@ to a multiple of its character size. | |||
| 1232 | @end defun | 1304 | @end defun |
| 1233 | 1305 | ||
| 1234 | @defun set-frame-height frame height &optional pretend pixelwise | 1306 | @defun set-frame-height frame height &optional pretend pixelwise |
| 1235 | This function resizes @var{frame} to a height of @var{height} lines. The | 1307 | This function resizes the text area of @var{frame} to a height of |
| 1236 | sizes of existing windows in @var{frame} are altered proportionally to | 1308 | @var{height} lines. The sizes of existing windows in @var{frame} are |
| 1237 | fit. | 1309 | altered proportionally to fit. |
| 1238 | 1310 | ||
| 1239 | If @var{pretend} is non-@code{nil}, then Emacs displays @var{height} | 1311 | If @var{pretend} is non-@code{nil}, then Emacs displays @var{height} |
| 1240 | lines of output in @var{frame}, but does not change its value for the | 1312 | lines of output in @var{frame}, but does not change its value for the |
| @@ -1254,8 +1326,8 @@ height to a multiple of its character height. | |||
| 1254 | @end defun | 1326 | @end defun |
| 1255 | 1327 | ||
| 1256 | @defun set-frame-width frame width &optional pretend pixelwise | 1328 | @defun set-frame-width frame width &optional pretend pixelwise |
| 1257 | This function sets the width of @var{frame}, measured in characters. | 1329 | This function sets the width of the text area of @var{frame}, measured |
| 1258 | The argument @var{pretend} has the same meaning as in | 1330 | in characters. The argument @var{pretend} has the same meaning as in |
| 1259 | @code{set-frame-height}. | 1331 | @code{set-frame-height}. |
| 1260 | 1332 | ||
| 1261 | The optional fourth argument @var{pixelwise} non-@code{nil} means that | 1333 | The optional fourth argument @var{pixelwise} non-@code{nil} means that |
| @@ -1265,6 +1337,41 @@ fully honor the request if it does not increase/decrease the frame width | |||
| 1265 | to a multiple of its character width. | 1337 | to a multiple of its character width. |
| 1266 | @end defun | 1338 | @end defun |
| 1267 | 1339 | ||
| 1340 | None of these three functions will make a frame smaller than needed to | ||
| 1341 | display all of its windows together with their scroll bars, fringes, | ||
| 1342 | margins, dividers, mode and header lines. This contrasts with requests | ||
| 1343 | by the window manager triggered, for example, by dragging the external | ||
| 1344 | border of a frame with the mouse. Such requests are always honored by | ||
| 1345 | clipping, if necessary, portions that cannot be displayed at the right, | ||
| 1346 | bottom corner of the frame. | ||
| 1347 | |||
| 1348 | By default, Emacs tries to keep the number of lines and columns of a | ||
| 1349 | frame's text area unaltered when, for example, adding or removing a menu | ||
| 1350 | bar, changing the default font or setting the width of the frame's | ||
| 1351 | scroll bars. This means, however, that in such case Emacs must ask the | ||
| 1352 | window manager to resize the display area of the frame in order to | ||
| 1353 | accommodate the size change. (Note that with the exception of GTK+ | ||
| 1354 | builds, adding, removing or wrapping the tool bar usually do not resize | ||
| 1355 | the frame's display area, hence these may alter the number of displayed | ||
| 1356 | lines.) | ||
| 1357 | |||
| 1358 | Occasionally, such implied resizing of the display area may be | ||
| 1359 | unwanted, for example, when the frame is maximized or made fullscreen | ||
| 1360 | where it's turned off by default. In other cases you can disable | ||
| 1361 | implied resizing with the following option: | ||
| 1362 | |||
| 1363 | @defopt frame-inhibit-implied-resize | ||
| 1364 | If this option is @code{nil}, changing default font, menu bar mode, | ||
| 1365 | fringe width, or scroll bars of a specific frame may resize the frame's | ||
| 1366 | display area in order to preserve the number of columns or lines the | ||
| 1367 | frame displays. If this option is non-@code{nil}, no such resizing is | ||
| 1368 | done. | ||
| 1369 | |||
| 1370 | When you add a tool bar or scroll bar to a frame that is not large | ||
| 1371 | enough to accommodate one, Emacs will try to enlarge the frame even if | ||
| 1372 | this option is non-@code{nil}. | ||
| 1373 | @end defopt | ||
| 1374 | |||
| 1268 | @c FIXME? Belongs more in Emacs manual than here? | 1375 | @c FIXME? Belongs more in Emacs manual than here? |
| 1269 | @c But, e.g., fit-window-to-buffer is in this manual. | 1376 | @c But, e.g., fit-window-to-buffer is in this manual. |
| 1270 | If you have a frame that displays only one window, you can fit that | 1377 | If you have a frame that displays only one window, you can fit that |