mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2025-01-20 18:17:20 +00:00
Display-fill-column-indicator NEWS info.
*etc/NEWS: Added information about the fill-column-indicator mode. *lisp/faces.el: Added a face for the display fill column indicator.
This commit is contained in:
parent
245dff16e3
commit
ab4619e7c3
45
etc/NEWS
45
etc/NEWS
@ -340,6 +340,51 @@ longer.
|
||||
** Multicolor fonts such as "Noto Color Emoji" can be displayed on
|
||||
Emacs configured with Cairo drawing and linked with cairo >= 1.16.0.
|
||||
|
||||
---
|
||||
** Emacs now optionally displays a fill column indicator.
|
||||
|
||||
The fill column indicator is a usefull functionality specially in
|
||||
prog-mode to indicate the position of a specific column. This is
|
||||
similar to what 'fill-column-indicator' package provides, but much
|
||||
faster and compatible with show-trailing-whitespace.
|
||||
|
||||
Customize the buffer-local variables 'display-fill-column-indicator'
|
||||
and 'display-fill-column-indicator-character' to activate the
|
||||
indicator.
|
||||
|
||||
Alternatively you can use the modes
|
||||
'display-fill-column-indicator-mode' or the global
|
||||
'global-display-fill-column-indicator-mode' which enables it locally
|
||||
and globally respectively and also chooses the character to use if no
|
||||
one is set.
|
||||
|
||||
The indicators is not displayed at all in minibuffer windows and
|
||||
in tooltips, as it is not useful there.
|
||||
|
||||
There are 2 new buffer local variables and 1 face to customize this
|
||||
mode:
|
||||
|
||||
*** 'display-fill-column-indicator-column' is the column where the
|
||||
indicator should be set. It can take positive numerical values for
|
||||
the column or the special value t. Any other value disables the
|
||||
indicator. The default value is t.
|
||||
|
||||
When the value is t it means that the variable 'fill-column' will
|
||||
be used.
|
||||
|
||||
*** 'display-fill-column-indicator-char' is the character used for the
|
||||
indicator. This character can be any valid char including unicode
|
||||
ones if the user's font supports them.
|
||||
|
||||
When the mode is enabled throw the functions
|
||||
'display-fill-column-indicator-mode' and
|
||||
'global-display-fill-column-indicator-mode', they check if there
|
||||
is a value non-nil for this variable, otherwise the initialization
|
||||
tries to set it to U+2502 or '|'.
|
||||
|
||||
*** 'fill-column-face' is the face used to display the indicator it
|
||||
inherits it default values from shadow and the default faces.
|
||||
|
||||
|
||||
* Editing Changes in Emacs 27.1
|
||||
|
||||
|
@ -55,8 +55,6 @@ character for the line setting `display-fill-column-indicator-character'."
|
||||
(if display-fill-column-indicator-mode
|
||||
(progn
|
||||
(setq display-fill-column-indicator t)
|
||||
(unless display-fill-column-indicator-column
|
||||
(setq display-fill-column-indicator-column fill-column))
|
||||
(unless display-fill-column-indicator-character
|
||||
(if (char-displayable-p ?\u2502)
|
||||
(setq display-fill-column-indicator-character ?\u2502)
|
||||
|
@ -2502,7 +2502,7 @@ unwanted effects."
|
||||
|
||||
;; Definition stolen from display-line-numbers.
|
||||
(defface fill-column-face
|
||||
'((t :inherit (shadow default) :height 1.0))
|
||||
'((t :inherit (shadow default)))
|
||||
"Face for displaying fill column indicator line.
|
||||
This face is used when `display-fill-column-indicator-mode' is
|
||||
non-nil.
|
||||
|
63
src/xdisp.c
63
src/xdisp.c
@ -20164,17 +20164,26 @@ append_space_for_newline (struct it *it, bool default_face_p)
|
||||
same place than the line */
|
||||
if (!NILP (Vdisplay_fill_column_indicator)
|
||||
&& (it->w->pseudo_window_p == 0)
|
||||
&& FIXNATP (Vdisplay_fill_column_indicator_column)
|
||||
&& (!NILP (Vdisplay_fill_column_indicator_column))
|
||||
&& FIXNATP (Vdisplay_fill_column_indicator_character))
|
||||
{
|
||||
int fill_column_indicator_column = -1;
|
||||
|
||||
if (EQ (Vdisplay_fill_column_indicator_column, Qt)
|
||||
&& FIXNATP (BVAR (current_buffer, fill_column)))
|
||||
fill_column_indicator_column =
|
||||
XFIXNAT (BVAR (current_buffer, fill_column));
|
||||
else if (FIXNATP (Vdisplay_fill_column_indicator_column))
|
||||
fill_column_indicator_column =
|
||||
XFIXNAT (Vdisplay_fill_column_indicator_column);
|
||||
|
||||
struct font *font =
|
||||
default_face->font ? default_face->font : FRAME_FONT (it->f);
|
||||
const int char_width =
|
||||
font->average_width ? font->average_width : font->space_width;
|
||||
const int fill_column =
|
||||
XFIXNAT (Vdisplay_fill_column_indicator_column);
|
||||
|
||||
const int column_x =
|
||||
char_width * fill_column + it->lnum_pixel_width;
|
||||
char_width * fill_column_indicator_column + it->lnum_pixel_width;
|
||||
|
||||
if (it->current_x == column_x)
|
||||
{
|
||||
@ -20416,18 +20425,26 @@ extend_face_to_end_of_line (struct it *it)
|
||||
active */
|
||||
if (!NILP (Vdisplay_fill_column_indicator)
|
||||
&& (it->w->pseudo_window_p == 0)
|
||||
&& FIXNATP (Vdisplay_fill_column_indicator_column)
|
||||
&& (!NILP (Vdisplay_fill_column_indicator_column))
|
||||
&& FIXNATP (Vdisplay_fill_column_indicator_character))
|
||||
{
|
||||
int fill_column_indicator_column = -1;
|
||||
|
||||
if (EQ (Vdisplay_fill_column_indicator_column, Qt)
|
||||
&& FIXNATP (BVAR (current_buffer, fill_column)))
|
||||
fill_column_indicator_column =
|
||||
XFIXNAT (BVAR (current_buffer, fill_column));
|
||||
else if (FIXNATP (Vdisplay_fill_column_indicator_column))
|
||||
fill_column_indicator_column =
|
||||
XFIXNAT (Vdisplay_fill_column_indicator_column);
|
||||
|
||||
struct font *font =
|
||||
default_face->font ? default_face->font : FRAME_FONT (f);
|
||||
const int char_width =
|
||||
font->average_width ? font->average_width : font->space_width;
|
||||
|
||||
const int fill_column =
|
||||
XFIXNAT (Vdisplay_fill_column_indicator_column);
|
||||
|
||||
const int column_x = char_width * fill_column + it->lnum_pixel_width;
|
||||
const int column_x = char_width * fill_column_indicator_column +
|
||||
it->lnum_pixel_width;
|
||||
|
||||
if ((it->current_x <= column_x)
|
||||
&& (column_x <= it->last_visible_x))
|
||||
@ -20606,14 +20623,23 @@ extend_face_to_end_of_line (struct it *it)
|
||||
it->face_id = face->id;
|
||||
|
||||
/* Display fill-column-line if mode is active */
|
||||
if (!NILP (Vdisplay_fill_column_indicator))
|
||||
if (!NILP (Vdisplay_fill_column_indicator)
|
||||
&& (!NILP (Vdisplay_fill_column_indicator_column))
|
||||
&& FIXNATP (Vdisplay_fill_column_indicator_character))
|
||||
{
|
||||
const int fill_column_indicator_line =
|
||||
XFIXNAT (Vdisplay_fill_column_indicator_column)
|
||||
+ it->lnum_pixel_width;
|
||||
int fill_column_indicator_column = -1;
|
||||
|
||||
if (EQ (Vdisplay_fill_column_indicator_column, Qt)
|
||||
&& FIXNATP (BVAR (current_buffer, fill_column)))
|
||||
fill_column_indicator_column =
|
||||
XFIXNAT (BVAR (current_buffer, fill_column));
|
||||
else if (FIXNATP (Vdisplay_fill_column_indicator_column))
|
||||
fill_column_indicator_column =
|
||||
XFIXNAT (Vdisplay_fill_column_indicator_column);
|
||||
|
||||
do
|
||||
{
|
||||
if (it->current_x == fill_column_indicator_line)
|
||||
if (it->current_x == fill_column_indicator_column)
|
||||
{
|
||||
const int saved_face = it->face_id;
|
||||
it->face_id =
|
||||
@ -33382,9 +33408,12 @@ either `relative' or `visual'. */);
|
||||
Fmake_variable_buffer_local (Qdisplay_fill_column_indicator);
|
||||
|
||||
DEFVAR_LISP ("display-fill-column-indicator-column", Vdisplay_fill_column_indicator_column,
|
||||
doc: /* Column to draw the indicator when `display-fill-column-indicator' is non-nil.
|
||||
The default value is the variable `fill-column' if not other value is given. */);
|
||||
Vdisplay_fill_column_indicator_column = Qnil;
|
||||
doc: /* Column to draw the fill column indicator when
|
||||
`display-fill-column-indicator' is non-nil. The default value is t
|
||||
which means that the indicator will use the `fill-column' variable. If
|
||||
a numeric value is set, the indicator will be drawn in that column
|
||||
independently of the `fill-column' value. */);
|
||||
Vdisplay_fill_column_indicator_column = Qt;
|
||||
DEFSYM (Qdisplay_fill_column_indicator_column, "display-fill-column-indicator-column");
|
||||
Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_column);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user