aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorEli Zaretskii2017-10-20 12:36:12 +0300
committerEli Zaretskii2017-10-20 12:36:12 +0300
commitfd3d8610b27e26107ba15070aba0d488152f8f4d (patch)
treed62498e78ac088c6f992a1f0077951ea9db6ba08 /doc
parent831eafc8ae201881e6449e2ab5d15d594573650b (diff)
downloademacs-fd3d8610b27e26107ba15070aba0d488152f8f4d.tar.gz
emacs-fd3d8610b27e26107ba15070aba0d488152f8f4d.zip
Make :align-to account for display-line-numbers
These changes also update the various bundled packages to use new feature, and better support customizations of the line-number face. * src/xdisp.c (calc_pixel_width_or_height): Improve commentary. Make :align-to count from the end of the line-number display when the offset or the width form reference that of the text area. (Bug#28855) * src/indent.c (Fline_number_display_width): Implement support for the PIXELWISE argument being 'columns'. Update the doc string. (syms_of_indent): New symbol 'columns'. * lisp/ruler-mode.el (ruler-mode-window-col, ruler-mode-ruler): Call line-number-display-width with last argument 'columns'. * lisp/proced.el (proced-header-line): Call line-number-display-width with 2nd arg 'columns', which also fixes a problem when display-line-numbers is nil. * lisp/emacs-lisp/tabulated-list.el (tabulated-list-line-number-width): Call line-number-display-width with 2nd arg 'columns. (tabulated-list-entry-lnum-width): Remove unneeded defvar. (tabulated-list-print, tabulated-list-print-entry): No need to account for the value of tabulated-list-entry-lnum-width. (tabulated-list--current-lnum-width): New defvar. (tabulated-list-watch-line-number-width): New function. (tabulated-list-mode): Bind tabulated-list--current-lnum-width locally, and set up tabulated-list-watch-line-number-width as pre-redisplay-functions hook. * doc/lispref/display.texi (Size of Displayed Text): Document the 'columns' value of the PIXELWISE argument. (Pixel Specification): Update and improve the documentation of the supported forms.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/display.texi49
1 files changed, 33 insertions, 16 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index fbdd810247d..17126ce72b9 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -2050,14 +2050,17 @@ calculations.
2050 2050
2051@defun line-number-display-width &optional pixelwise 2051@defun line-number-display-width &optional pixelwise
2052This function returns the width used for displaying the line numbers 2052This function returns the width used for displaying the line numbers
2053in the selected window. Optional argument @var{pixelwise}, if 2053in the selected window. If the optional argument @var{pixelwise} is
2054non-@code{nil}, means return the value in pixels; otherwise the value 2054the symbol @code{columns}, the return value is a float number of the
2055is returned in column units of the font defined for the 2055frame's canonical columns; if @var{pixelwise} is @code{t} or any other
2056non-@code{nil} value, the value is an integer and is measured in
2057pixels. If @var{pixelwise} is omitted or @code{nil}, the value is the
2058integer number of columns of the font defined for the
2056@code{line-number} face, and doesn't include the 2 columns used to pad 2059@code{line-number} face, and doesn't include the 2 columns used to pad
2057the numbers. If line numbers are not displayed in the selected 2060the numbers on display. If line numbers are not displayed in the
2058window, the value is zero. Use @code{with-selected-window} 2061selected window, the value is zero regardless of the value of
2059(@pxref{Selecting Windows}) if you need this information about another 2062@var{pixelwise}. Use @code{with-selected-window} (@pxref{Selecting
2060window. 2063Windows}) if you need this information about another window.
2061@end defun 2064@end defun
2062 2065
2063 2066
@@ -4636,7 +4639,7 @@ as an absolute number of pixels.
4636 4639
4637@smallexample 4640@smallexample
4638@group 4641@group
4639 @var{expr} ::= @var{num} | (@var{num}) | @var{unit} | @var{elem} | @var{pos} | @var{image} | @var{form} 4642 @var{expr} ::= @var{num} | (@var{num}) | @var{unit} | @var{elem} | @var{pos} | @var{image} | @var{xwidget} | @var{form}
4640 @var{num} ::= @var{integer} | @var{float} | @var{symbol} 4643 @var{num} ::= @var{integer} | @var{float} | @var{symbol}
4641 @var{unit} ::= in | mm | cm | width | height 4644 @var{unit} ::= in | mm | cm | width | height
4642@end group 4645@end group
@@ -4652,22 +4655,34 @@ as an absolute number of pixels.
4652 The form @var{num} specifies a fraction of the default frame font 4655 The form @var{num} specifies a fraction of the default frame font
4653height or width. The form @code{(@var{num})} specifies an absolute 4656height or width. The form @code{(@var{num})} specifies an absolute
4654number of pixels. If @var{num} is a symbol, @var{symbol}, its 4657number of pixels. If @var{num} is a symbol, @var{symbol}, its
4655buffer-local variable binding is used. 4658buffer-local variable binding is used; that binding can be either a
4659number or a cons cell of the forms shown above (including yet another
4660cons cell whose @code{car} is a symbol that has a buffer-local
4661binding).
4656 4662
4657 The @code{in}, @code{mm}, and @code{cm} units specify the number of 4663 The @code{in}, @code{mm}, and @code{cm} units specify the number of
4658pixels per inch, millimeter, and centimeter, respectively. The 4664pixels per inch, millimeter, and centimeter, respectively. The
4659@code{width} and @code{height} units correspond to the default width 4665@code{width} and @code{height} units correspond to the default width
4660and height of the current face. An image specification @code{image} 4666and height of the current face. An image specification of the form
4661corresponds to the width or height of the image. 4667@w{@code{(image . @var{props})}} (@pxref{Image Descriptors})
4668corresponds to the width or height of the specified image. Similarly,
4669an xwidget specification of the form @w{@code{(xwidget . @var{props})}}
4670stands for the width or height of the specified xwidget.
4671@xref{Xwidgets}.
4662 4672
4663 The elements @code{left-fringe}, @code{right-fringe}, 4673 The elements @code{left-fringe}, @code{right-fringe},
4664@code{left-margin}, @code{right-margin}, @code{scroll-bar}, and 4674@code{left-margin}, @code{right-margin}, @code{scroll-bar}, and
4665@code{text} specify to the width of the corresponding area of the 4675@code{text} specify the width of the corresponding area of the window.
4666window. 4676When the window displays line numbers (@pxref{Size of Displayed
4677Text}), the width of the @code{text} area is decreased by the screen
4678space taken by the line-number display.
4667 4679
4668 The @code{left}, @code{center}, and @code{right} positions can be 4680 The @code{left}, @code{center}, and @code{right} positions can be
4669used with @code{:align-to} to specify a position relative to the left 4681used with @code{:align-to} to specify a position relative to the left
4670edge, center, or right edge of the text area. 4682edge, center, or right edge of the text area. When the window
4683displays line numbers, the @code{left} and the @code{center} positions
4684are offset to account for the screen space taken by the line-number
4685display.
4671 4686
4672 Any of the above window elements (except @code{text}) can also be 4687 Any of the above window elements (except @code{text}) can also be
4673used with @code{:align-to} to specify that the position is relative to 4688used with @code{:align-to} to specify that the position is relative to
@@ -4683,13 +4698,15 @@ the left-margin, use
4683 4698
4684 If no specific base offset is set for alignment, it is always relative 4699 If no specific base offset is set for alignment, it is always relative
4685to the left edge of the text area. For example, @samp{:align-to 0} in a 4700to the left edge of the text area. For example, @samp{:align-to 0} in a
4686header-line aligns with the first text column in the text area. 4701header-line aligns with the first text column in the text area. When
4702the window displays line numbers, the text is considered to start where
4703the space used for line-number display ends.
4687 4704
4688 A value of the form @code{(@var{num} . @var{expr})} stands for the 4705 A value of the form @code{(@var{num} . @var{expr})} stands for the
4689product of the values of @var{num} and @var{expr}. For example, 4706product of the values of @var{num} and @var{expr}. For example,
4690@code{(2 . in)} specifies a width of 2 inches, while @code{(0.5 . 4707@code{(2 . in)} specifies a width of 2 inches, while @code{(0.5 .
4691@var{image})} specifies half the width (or height) of the specified 4708@var{image})} specifies half the width (or height) of the specified
4692image. 4709@var{image} (which should be given by its image spec).
4693 4710
4694 The form @code{(+ @var{expr} ...)} adds up the value of the 4711 The form @code{(+ @var{expr} ...)} adds up the value of the
4695expressions. The form @code{(- @var{expr} ...)} negates or subtracts 4712expressions. The form @code{(- @var{expr} ...)} negates or subtracts