diff options
| author | Eli Zaretskii | 2017-10-20 12:36:12 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2017-10-20 12:36:12 +0300 |
| commit | fd3d8610b27e26107ba15070aba0d488152f8f4d (patch) | |
| tree | d62498e78ac088c6f992a1f0077951ea9db6ba08 /doc | |
| parent | 831eafc8ae201881e6449e2ab5d15d594573650b (diff) | |
| download | emacs-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.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. | |||
| 2050 | 2050 | ||
| 2051 | @defun line-number-display-width &optional pixelwise | 2051 | @defun line-number-display-width &optional pixelwise |
| 2052 | This function returns the width used for displaying the line numbers | 2052 | This function returns the width used for displaying the line numbers |
| 2053 | in the selected window. Optional argument @var{pixelwise}, if | 2053 | in the selected window. If the optional argument @var{pixelwise} is |
| 2054 | non-@code{nil}, means return the value in pixels; otherwise the value | 2054 | the symbol @code{columns}, the return value is a float number of the |
| 2055 | is returned in column units of the font defined for the | 2055 | frame's canonical columns; if @var{pixelwise} is @code{t} or any other |
| 2056 | non-@code{nil} value, the value is an integer and is measured in | ||
| 2057 | pixels. If @var{pixelwise} is omitted or @code{nil}, the value is the | ||
| 2058 | integer 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 |
| 2057 | the numbers. If line numbers are not displayed in the selected | 2060 | the numbers on display. If line numbers are not displayed in the |
| 2058 | window, the value is zero. Use @code{with-selected-window} | 2061 | selected 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 |
| 2060 | window. | 2063 | Windows}) 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 |
| 4653 | height or width. The form @code{(@var{num})} specifies an absolute | 4656 | height or width. The form @code{(@var{num})} specifies an absolute |
| 4654 | number of pixels. If @var{num} is a symbol, @var{symbol}, its | 4657 | number of pixels. If @var{num} is a symbol, @var{symbol}, its |
| 4655 | buffer-local variable binding is used. | 4658 | buffer-local variable binding is used; that binding can be either a |
| 4659 | number or a cons cell of the forms shown above (including yet another | ||
| 4660 | cons cell whose @code{car} is a symbol that has a buffer-local | ||
| 4661 | binding). | ||
| 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 |
| 4658 | pixels per inch, millimeter, and centimeter, respectively. The | 4664 | pixels 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 |
| 4660 | and height of the current face. An image specification @code{image} | 4666 | and height of the current face. An image specification of the form |
| 4661 | corresponds to the width or height of the image. | 4667 | @w{@code{(image . @var{props})}} (@pxref{Image Descriptors}) |
| 4668 | corresponds to the width or height of the specified image. Similarly, | ||
| 4669 | an xwidget specification of the form @w{@code{(xwidget . @var{props})}} | ||
| 4670 | stands 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. |
| 4666 | window. | 4676 | When the window displays line numbers (@pxref{Size of Displayed |
| 4677 | Text}), the width of the @code{text} area is decreased by the screen | ||
| 4678 | space 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 |
| 4669 | used with @code{:align-to} to specify a position relative to the left | 4681 | used with @code{:align-to} to specify a position relative to the left |
| 4670 | edge, center, or right edge of the text area. | 4682 | edge, center, or right edge of the text area. When the window |
| 4683 | displays line numbers, the @code{left} and the @code{center} positions | ||
| 4684 | are offset to account for the screen space taken by the line-number | ||
| 4685 | display. | ||
| 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 |
| 4673 | used with @code{:align-to} to specify that the position is relative to | 4688 | used 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 |
| 4685 | to the left edge of the text area. For example, @samp{:align-to 0} in a | 4700 | to the left edge of the text area. For example, @samp{:align-to 0} in a |
| 4686 | header-line aligns with the first text column in the text area. | 4701 | header-line aligns with the first text column in the text area. When |
| 4702 | the window displays line numbers, the text is considered to start where | ||
| 4703 | the 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 |
| 4689 | product of the values of @var{num} and @var{expr}. For example, | 4706 | product 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 |
| 4692 | image. | 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 |
| 4695 | expressions. The form @code{(- @var{expr} ...)} negates or subtracts | 4712 | expressions. The form @code{(- @var{expr} ...)} negates or subtracts |