diff options
author | Eli Zaretskii <eliz@gnu.org> | 2017-10-20 12:36:12 +0300 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2017-10-20 12:36:12 +0300 |
commit | fd3d8610b27e26107ba15070aba0d488152f8f4d (patch) | |
tree | d62498e78ac088c6f992a1f0077951ea9db6ba08 /doc/lispref/display.texi | |
parent | 831eafc8ae201881e6449e2ab5d15d594573650b (diff) | |
download | emacs-fd3d8610b27e26107ba15070aba0d488152f8f4d.tar.gz |
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/lispref/display.texi')
-rw-r--r-- | doc/lispref/display.texi | 49 |
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. @defun line-number-display-width &optional pixelwise This function returns the width used for displaying the line numbers -in the selected window. Optional argument @var{pixelwise}, if -non-@code{nil}, means return the value in pixels; otherwise the value -is returned in column units of the font defined for the +in the selected window. If the optional argument @var{pixelwise} is +the symbol @code{columns}, the return value is a float number of the +frame's canonical columns; if @var{pixelwise} is @code{t} or any other +non-@code{nil} value, the value is an integer and is measured in +pixels. If @var{pixelwise} is omitted or @code{nil}, the value is the +integer number of columns of the font defined for the @code{line-number} face, and doesn't include the 2 columns used to pad -the numbers. If line numbers are not displayed in the selected -window, the value is zero. Use @code{with-selected-window} -(@pxref{Selecting Windows}) if you need this information about another -window. +the numbers on display. If line numbers are not displayed in the +selected window, the value is zero regardless of the value of +@var{pixelwise}. Use @code{with-selected-window} (@pxref{Selecting +Windows}) if you need this information about another window. @end defun @@ -4636,7 +4639,7 @@ as an absolute number of pixels. @smallexample @group - @var{expr} ::= @var{num} | (@var{num}) | @var{unit} | @var{elem} | @var{pos} | @var{image} | @var{form} + @var{expr} ::= @var{num} | (@var{num}) | @var{unit} | @var{elem} | @var{pos} | @var{image} | @var{xwidget} | @var{form} @var{num} ::= @var{integer} | @var{float} | @var{symbol} @var{unit} ::= in | mm | cm | width | height @end group @@ -4652,22 +4655,34 @@ as an absolute number of pixels. The form @var{num} specifies a fraction of the default frame font height or width. The form @code{(@var{num})} specifies an absolute number of pixels. If @var{num} is a symbol, @var{symbol}, its -buffer-local variable binding is used. +buffer-local variable binding is used; that binding can be either a +number or a cons cell of the forms shown above (including yet another +cons cell whose @code{car} is a symbol that has a buffer-local +binding). The @code{in}, @code{mm}, and @code{cm} units specify the number of pixels per inch, millimeter, and centimeter, respectively. The @code{width} and @code{height} units correspond to the default width -and height of the current face. An image specification @code{image} -corresponds to the width or height of the image. +and height of the current face. An image specification of the form +@w{@code{(image . @var{props})}} (@pxref{Image Descriptors}) +corresponds to the width or height of the specified image. Similarly, +an xwidget specification of the form @w{@code{(xwidget . @var{props})}} +stands for the width or height of the specified xwidget. +@xref{Xwidgets}. The elements @code{left-fringe}, @code{right-fringe}, @code{left-margin}, @code{right-margin}, @code{scroll-bar}, and -@code{text} specify to the width of the corresponding area of the -window. +@code{text} specify the width of the corresponding area of the window. +When the window displays line numbers (@pxref{Size of Displayed +Text}), the width of the @code{text} area is decreased by the screen +space taken by the line-number display. The @code{left}, @code{center}, and @code{right} positions can be used with @code{:align-to} to specify a position relative to the left -edge, center, or right edge of the text area. +edge, center, or right edge of the text area. When the window +displays line numbers, the @code{left} and the @code{center} positions +are offset to account for the screen space taken by the line-number +display. Any of the above window elements (except @code{text}) can also be used with @code{:align-to} to specify that the position is relative to @@ -4683,13 +4698,15 @@ the left-margin, use If no specific base offset is set for alignment, it is always relative to the left edge of the text area. For example, @samp{:align-to 0} in a -header-line aligns with the first text column in the text area. +header-line aligns with the first text column in the text area. When +the window displays line numbers, the text is considered to start where +the space used for line-number display ends. A value of the form @code{(@var{num} . @var{expr})} stands for the product of the values of @var{num} and @var{expr}. For example, @code{(2 . in)} specifies a width of 2 inches, while @code{(0.5 . @var{image})} specifies half the width (or height) of the specified -image. +@var{image} (which should be given by its image spec). The form @code{(+ @var{expr} ...)} adds up the value of the expressions. The form @code{(- @var{expr} ...)} negates or subtracts |