diff options
| author | Jimmy Aguilar Mena | 2019-03-19 00:03:12 +0100 |
|---|---|---|
| committer | Jimmy Aguilar Mena | 2019-05-05 16:27:37 +0200 |
| commit | ab4619e7c37b3b9caa2aa24405585dc05292d961 (patch) | |
| tree | ca5cad1f2f587429ac517a294be7e601379f08f2 /src | |
| parent | 245dff16e3e62c3b7458170a2436a5fa3e2945fd (diff) | |
| download | emacs-ab4619e7c37b3b9caa2aa24405585dc05292d961.tar.gz emacs-ab4619e7c37b3b9caa2aa24405585dc05292d961.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xdisp.c | 63 |
1 files changed, 46 insertions, 17 deletions
diff --git a/src/xdisp.c b/src/xdisp.c index f1609664277..c6f8133a838 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -20164,17 +20164,26 @@ append_space_for_newline (struct it *it, bool default_face_p) | |||
| 20164 | same place than the line */ | 20164 | same place than the line */ |
| 20165 | if (!NILP (Vdisplay_fill_column_indicator) | 20165 | if (!NILP (Vdisplay_fill_column_indicator) |
| 20166 | && (it->w->pseudo_window_p == 0) | 20166 | && (it->w->pseudo_window_p == 0) |
| 20167 | && FIXNATP (Vdisplay_fill_column_indicator_column) | 20167 | && (!NILP (Vdisplay_fill_column_indicator_column)) |
| 20168 | && FIXNATP (Vdisplay_fill_column_indicator_character)) | 20168 | && FIXNATP (Vdisplay_fill_column_indicator_character)) |
| 20169 | { | 20169 | { |
| 20170 | int fill_column_indicator_column = -1; | ||
| 20171 | |||
| 20172 | if (EQ (Vdisplay_fill_column_indicator_column, Qt) | ||
| 20173 | && FIXNATP (BVAR (current_buffer, fill_column))) | ||
| 20174 | fill_column_indicator_column = | ||
| 20175 | XFIXNAT (BVAR (current_buffer, fill_column)); | ||
| 20176 | else if (FIXNATP (Vdisplay_fill_column_indicator_column)) | ||
| 20177 | fill_column_indicator_column = | ||
| 20178 | XFIXNAT (Vdisplay_fill_column_indicator_column); | ||
| 20179 | |||
| 20170 | struct font *font = | 20180 | struct font *font = |
| 20171 | default_face->font ? default_face->font : FRAME_FONT (it->f); | 20181 | default_face->font ? default_face->font : FRAME_FONT (it->f); |
| 20172 | const int char_width = | 20182 | const int char_width = |
| 20173 | font->average_width ? font->average_width : font->space_width; | 20183 | font->average_width ? font->average_width : font->space_width; |
| 20174 | const int fill_column = | 20184 | |
| 20175 | XFIXNAT (Vdisplay_fill_column_indicator_column); | ||
| 20176 | const int column_x = | 20185 | const int column_x = |
| 20177 | char_width * fill_column + it->lnum_pixel_width; | 20186 | char_width * fill_column_indicator_column + it->lnum_pixel_width; |
| 20178 | 20187 | ||
| 20179 | if (it->current_x == column_x) | 20188 | if (it->current_x == column_x) |
| 20180 | { | 20189 | { |
| @@ -20416,18 +20425,26 @@ extend_face_to_end_of_line (struct it *it) | |||
| 20416 | active */ | 20425 | active */ |
| 20417 | if (!NILP (Vdisplay_fill_column_indicator) | 20426 | if (!NILP (Vdisplay_fill_column_indicator) |
| 20418 | && (it->w->pseudo_window_p == 0) | 20427 | && (it->w->pseudo_window_p == 0) |
| 20419 | && FIXNATP (Vdisplay_fill_column_indicator_column) | 20428 | && (!NILP (Vdisplay_fill_column_indicator_column)) |
| 20420 | && FIXNATP (Vdisplay_fill_column_indicator_character)) | 20429 | && FIXNATP (Vdisplay_fill_column_indicator_character)) |
| 20421 | { | 20430 | { |
| 20431 | int fill_column_indicator_column = -1; | ||
| 20432 | |||
| 20433 | if (EQ (Vdisplay_fill_column_indicator_column, Qt) | ||
| 20434 | && FIXNATP (BVAR (current_buffer, fill_column))) | ||
| 20435 | fill_column_indicator_column = | ||
| 20436 | XFIXNAT (BVAR (current_buffer, fill_column)); | ||
| 20437 | else if (FIXNATP (Vdisplay_fill_column_indicator_column)) | ||
| 20438 | fill_column_indicator_column = | ||
| 20439 | XFIXNAT (Vdisplay_fill_column_indicator_column); | ||
| 20440 | |||
| 20422 | struct font *font = | 20441 | struct font *font = |
| 20423 | default_face->font ? default_face->font : FRAME_FONT (f); | 20442 | default_face->font ? default_face->font : FRAME_FONT (f); |
| 20424 | const int char_width = | 20443 | const int char_width = |
| 20425 | font->average_width ? font->average_width : font->space_width; | 20444 | font->average_width ? font->average_width : font->space_width; |
| 20426 | 20445 | ||
| 20427 | const int fill_column = | 20446 | const int column_x = char_width * fill_column_indicator_column + |
| 20428 | XFIXNAT (Vdisplay_fill_column_indicator_column); | 20447 | it->lnum_pixel_width; |
| 20429 | |||
| 20430 | const int column_x = char_width * fill_column + it->lnum_pixel_width; | ||
| 20431 | 20448 | ||
| 20432 | if ((it->current_x <= column_x) | 20449 | if ((it->current_x <= column_x) |
| 20433 | && (column_x <= it->last_visible_x)) | 20450 | && (column_x <= it->last_visible_x)) |
| @@ -20606,14 +20623,23 @@ extend_face_to_end_of_line (struct it *it) | |||
| 20606 | it->face_id = face->id; | 20623 | it->face_id = face->id; |
| 20607 | 20624 | ||
| 20608 | /* Display fill-column-line if mode is active */ | 20625 | /* Display fill-column-line if mode is active */ |
| 20609 | if (!NILP (Vdisplay_fill_column_indicator)) | 20626 | if (!NILP (Vdisplay_fill_column_indicator) |
| 20627 | && (!NILP (Vdisplay_fill_column_indicator_column)) | ||
| 20628 | && FIXNATP (Vdisplay_fill_column_indicator_character)) | ||
| 20610 | { | 20629 | { |
| 20611 | const int fill_column_indicator_line = | 20630 | int fill_column_indicator_column = -1; |
| 20612 | XFIXNAT (Vdisplay_fill_column_indicator_column) | 20631 | |
| 20613 | + it->lnum_pixel_width; | 20632 | if (EQ (Vdisplay_fill_column_indicator_column, Qt) |
| 20633 | && FIXNATP (BVAR (current_buffer, fill_column))) | ||
| 20634 | fill_column_indicator_column = | ||
| 20635 | XFIXNAT (BVAR (current_buffer, fill_column)); | ||
| 20636 | else if (FIXNATP (Vdisplay_fill_column_indicator_column)) | ||
| 20637 | fill_column_indicator_column = | ||
| 20638 | XFIXNAT (Vdisplay_fill_column_indicator_column); | ||
| 20639 | |||
| 20614 | do | 20640 | do |
| 20615 | { | 20641 | { |
| 20616 | if (it->current_x == fill_column_indicator_line) | 20642 | if (it->current_x == fill_column_indicator_column) |
| 20617 | { | 20643 | { |
| 20618 | const int saved_face = it->face_id; | 20644 | const int saved_face = it->face_id; |
| 20619 | it->face_id = | 20645 | it->face_id = |
| @@ -33382,9 +33408,12 @@ either `relative' or `visual'. */); | |||
| 33382 | Fmake_variable_buffer_local (Qdisplay_fill_column_indicator); | 33408 | Fmake_variable_buffer_local (Qdisplay_fill_column_indicator); |
| 33383 | 33409 | ||
| 33384 | DEFVAR_LISP ("display-fill-column-indicator-column", Vdisplay_fill_column_indicator_column, | 33410 | DEFVAR_LISP ("display-fill-column-indicator-column", Vdisplay_fill_column_indicator_column, |
| 33385 | doc: /* Column to draw the indicator when `display-fill-column-indicator' is non-nil. | 33411 | doc: /* Column to draw the fill column indicator when |
| 33386 | The default value is the variable `fill-column' if not other value is given. */); | 33412 | `display-fill-column-indicator' is non-nil. The default value is t |
| 33387 | Vdisplay_fill_column_indicator_column = Qnil; | 33413 | which means that the indicator will use the `fill-column' variable. If |
| 33414 | a numeric value is set, the indicator will be drawn in that column | ||
| 33415 | independently of the `fill-column' value. */); | ||
| 33416 | Vdisplay_fill_column_indicator_column = Qt; | ||
| 33388 | DEFSYM (Qdisplay_fill_column_indicator_column, "display-fill-column-indicator-column"); | 33417 | DEFSYM (Qdisplay_fill_column_indicator_column, "display-fill-column-indicator-column"); |
| 33389 | Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_column); | 33418 | Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_column); |
| 33390 | 33419 | ||