Function: line-number-display-width

line-number-display-width is a function defined in indent.c.

Signature

(line-number-display-width &optional PIXELWISE)

Documentation

Return the width used for displaying line numbers in the selected window.

If optional argument PIXELWISE is the symbol columns, return the width in units of the frame's canonical character width. In this case, the value is a float. If optional argument PIXELWISE is t or any other non-nil value, return the width as an integer number of pixels. Otherwise return the value as an integer number of columns of the face used to display line numbers, line-number. Note that in the latter case, the value doesn't include the 2 columns used for padding the numbers on display.

View in manual

Probably introduced at or before Emacs version 26.1.

Aliases

org-line-number-display-width

Source Code

// Defined in /usr/src/emacs/src/indent.c
{
  int width, pixel_width;
  struct window *w = XWINDOW (selected_window);
  line_number_display_width (w, &width, &pixel_width);
  if (EQ (pixelwise, Qcolumns))
    {
      struct frame *f = XFRAME (w->frame);
      return make_float ((double) pixel_width / FRAME_COLUMN_WIDTH (f));
    }
  else if (!NILP (pixelwise))
    return make_fixnum (pixel_width);
  return make_fixnum (width);
}