emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] fill_column_indicator b05254c 10/10: ; Corrected display-f


From: Jimmy Aguilar Mena
Subject: [Emacs-diffs] fill_column_indicator b05254c 10/10: ; Corrected display-fill-column-indicator mode.
Date: Fri, 3 May 2019 13:49:31 -0400 (EDT)

branch: fill_column_indicator
commit b05254ceca55baf1ea83df90185ebf4592378705
Author: Jimmy Aguilar Mena <address@hidden>
Commit: Jimmy Aguilar Mena <address@hidden>

    ;Corrected display-fill-column-indicator mode.
---
 doc/emacs/display.texi                |  7 ++--
 etc/NEWS                              | 25 +----------
 lisp/cus-start.el                     | 11 +++--
 lisp/display-fill-column-indicator.el | 10 ++---
 lisp/faces.el                         | 10 ++---
 src/xdisp.c                           | 79 ++++++++++++++++++-----------------
 6 files changed, 62 insertions(+), 80 deletions(-)

diff --git a/doc/emacs/display.texi b/doc/emacs/display.texi
index e1467a3..5b8e99c 100644
--- a/doc/emacs/display.texi
+++ b/doc/emacs/display.texi
@@ -1181,10 +1181,11 @@ When the mode is enabled through the functions
 @code{display-fill-column-indicator-mode} or
 @code{global-display-fill-column-indicator-mode}, the initialization
 functions check if this variable is @code{non-nil}, otherwise the
-initialization tries to set it to U+2502 or '|'.
+initialization tries to set it to U+2502 or @sampl{|}.
 
address@hidden fill-column-face
-Specifies the face used to display the indicator it inherits its
address@hidden fill-column-indicator
address@hidden fill-column-indicator
+Specifies the face used to display the indicator. It inherits its
 default values from shadow and the default face.
 @end table
 
diff --git a/etc/NEWS b/etc/NEWS
index 80d7f4f..6fcf518 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -340,7 +340,7 @@ 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.
 
 This is similar to what 'fill-column-indicator' package provides, but
@@ -354,28 +354,7 @@ The indicator 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.
+mode they are described in the manual "(emacs) Display".
 
 
 * Editing Changes in Emacs 27.1
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index b935776..4c4d5eb 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -650,11 +650,14 @@ since it could result in memory overflow and make Emacs 
crash."
                                  "26.1")
 
              (display-fill-column-indicator display-fill-column-indicator
-                                 (choice
-                                  (const :tag "Off (nil)" :value nil)
-                                  (const :tag "On (t)" :value t))
-                                  "27.1")
+                                 boolean "27.1")
              (display-fill-column-indicator-column 
display-fill-column-indicator
+                                 (choice
+                                  (const :tag "Use fill-column variable"
+                                         :value t)
+                                  (const :tag "Fixed column number"
+                                         :value 70
+                                         :format "%v"))
                                  integer "27.1")
              (display-fill-column-indicator-character 
display-fill-column-indicator
                                  character "27.1")
diff --git a/lisp/display-fill-column-indicator.el 
b/lisp/display-fill-column-indicator.el
index f6b7352..2b30dbc 100644
--- a/lisp/display-fill-column-indicator.el
+++ b/lisp/display-fill-column-indicator.el
@@ -1,6 +1,6 @@
 ;;; display-fill-column-indicator.el --- interface for 
display-fill-column-indicator -*- lexical-binding: t -*-
 
-;; Copyright (C) 2017-2019 Free Software Foundation, Inc.
+;; Copyright (C) 2019 Free Software Foundation, Inc.
 
 ;; Maintainer: address@hidden
 ;; Keywords: convenience
@@ -37,18 +37,18 @@
 ;;; Code:
 
 (defgroup display-fill-column-indicator nil
-  "Display a fill column indicator in th buffer."
+  "Display a fill column indicator in the buffer."
   :group 'convenience
   :group 'display)
 
 
 ;;;###autoload
 (define-minor-mode display-fill-column-indicator-mode
-  "Toggle display fill column indicator.
+  "Toggle display of fill-column indicator.
 This uses `display-fill-column-indicator' internally.
 
-To change the position of the column displayed by default,
-customize `display-fill-column-indicator-column' you can change the
+To change the position of the column displayed by default
+customize `display-fill-column-indicator-column'. You can change the
 character for the indicator setting `display-fill-column-indicator-character'."
   :lighter nil
   (if display-fill-column-indicator-mode
diff --git a/lisp/faces.el b/lisp/faces.el
index 121cf7e..b933279 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -2501,15 +2501,11 @@ unwanted effects."
   :group 'display-line-numbers)
 
 ;; Definition stolen from display-line-numbers.
-(defface fill-column-face
+(defface fill-column-indicator
   '((t :inherit (shadow default)))
-  "Face for displaying fill column indicator line.
+  "Face for displaying fill column indicator.
 This face is used when `display-fill-column-indicator-mode' is
-non-nil.
-
-If you customize the font of this face, make sure it is a
-monospaced font, otherwise the line's characters will not line
-up horizontally."
+non-nil."
   :version "27.1"
   :group 'basic-faces
   :group 'display-fill-column-indicator)
diff --git a/src/xdisp.c b/src/xdisp.c
index 080c40c..e527f60 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -379,11 +379,14 @@ static Lisp_Object list_of_error;
               || *BYTE_POS_ADDR (IT_BYTEPOS (*it)) == '\t'))))         \
 
 /* Test all the conditions needed to print the fill column indicator.  */
-#define FILL_COLUMN_INDICATOR_NEEDED(it)               \
-  !NILP (Vdisplay_fill_column_indicator)               \
-  && (it->continuation_lines_width == 0)               \
-  && (!NILP (Vdisplay_fill_column_indicator_column))   \
-  && FIXNATP (Vdisplay_fill_column_indicator_character)
+#define FILL_COLUMN_INDICATOR_NEEDED(it)                       \
+  Vdisplay_fill_column_indicator                       \
+  && (it->continuation_lines_width == 0)                       \
+  && (!NILP (Vdisplay_fill_column_indicator_column))           \
+  && FIXNATP (Vdisplay_fill_column_indicator_character)                \
+  && ((EQ (Vdisplay_fill_column_indicator_column, Qt)          \
+       && FIXNATP (BVAR (current_buffer, fill_column)))                \
+      || (FIXNATP (Vdisplay_fill_column_indicator_column)))
 
 /* True means print newline to stdout before next mini-buffer message.  */
 
@@ -20168,17 +20171,16 @@ append_space_for_newline (struct it *it, bool 
default_face_p)
 
          /* Corner case for when display-fill-column-indicator-mode
             is active and the extra character should be added in the
-            same place than the line */
+            same place than the line.  */
          if ((it->w->pseudo_window_p == 0)
              && FILL_COLUMN_INDICATOR_NEEDED(it))
            {
               int fill_column_indicator_column = -1;
 
-              if (EQ (Vdisplay_fill_column_indicator_column, Qt)
-                  && FIXNATP (BVAR (current_buffer, fill_column)))
+              if (EQ (Vdisplay_fill_column_indicator_column, Qt))
                 fill_column_indicator_column =
                   XFIXNAT (BVAR (current_buffer, fill_column));
-              else if (FIXNATP (Vdisplay_fill_column_indicator_column))
+              else
                 fill_column_indicator_column =
                   XFIXNAT (Vdisplay_fill_column_indicator_column);
 
@@ -20198,7 +20200,7 @@ append_space_for_newline (struct it *it, bool 
default_face_p)
                   it->c = it->char_to_display =
                     XFIXNAT (Vdisplay_fill_column_indicator_character);
                   it->face_id =
-                    merge_faces (it->w, Qfill_column_face,
+                    merge_faces (it->w, Qfill_column_indicator,
                                  0, DEFAULT_FACE_ID);
                   face = FACE_FROM_ID(it->f, it->face_id);
                   goto produce_glyphs;
@@ -20221,8 +20223,8 @@ append_space_for_newline (struct it *it, bool 
default_face_p)
             set.  */
          if (it->glyph_row->reversed_p
              /* But if the appended newline glyph goes all the way to
-             the end of the row, there will be no stretch glyph,
-             so leave the box flag set.  */
+                the end of the row, there will be no stretch glyph,
+                so leave the box flag set.  */
              && saved_x + FRAME_COLUMN_WIDTH (it->f) < it->last_visible_x)
            it->end_of_box_run_p = false;
 
@@ -20376,7 +20378,7 @@ extend_face_to_end_of_line (struct it *it)
       && !face->stipple
 #endif
       && !it->glyph_row->reversed_p
-      && NILP (Vdisplay_fill_column_indicator))
+      && !Vdisplay_fill_column_indicator)
     return;
 
   /* Set the glyph row flag indicating that the face of the last glyph
@@ -20437,11 +20439,10 @@ extend_face_to_end_of_line (struct it *it)
             {
               int fill_column_indicator_column = -1;
 
-              if (EQ (Vdisplay_fill_column_indicator_column, Qt)
-                  && FIXNATP (BVAR (current_buffer, fill_column)))
+              if (EQ (Vdisplay_fill_column_indicator_column, Qt))
                 fill_column_indicator_column =
                   XFIXNAT (BVAR (current_buffer, fill_column));
-              else if (FIXNATP (Vdisplay_fill_column_indicator_column))
+              else
                 fill_column_indicator_column =
                   XFIXNAT (Vdisplay_fill_column_indicator_column);
 
@@ -20474,7 +20475,7 @@ extend_face_to_end_of_line (struct it *it)
                  it->avoid_cursor_p = true;
                  it->object = Qnil;
 
-                 /* Only generate a stretch glysph if there is distance
+                 /* Only generate a stretch glyph if there is distance
                     between current_x and and the indicator position */
                  if (stretch_width > 0)
                    {
@@ -20485,14 +20486,14 @@ extend_face_to_end_of_line (struct it *it)
                                            stretch_ascent);
                    }
 
-                 /* Generate the glysph indicator only if
+                 /* Generate the glyph indicator only if
                     append_space_for_newline didn't already. */
                  if (it->current_x < column_x)
                    {
                      it->char_to_display =
                        XFIXNAT (Vdisplay_fill_column_indicator_character);
                      it->face_id =
-                       merge_faces (it->w, Qfill_column_face,
+                       merge_faces (it->w, Qfill_column_indicator,
                                     0, DEFAULT_FACE_ID);
                      PRODUCE_GLYPHS (it);
                    }
@@ -20501,7 +20502,8 @@ extend_face_to_end_of_line (struct it *it)
                  it->face_id = saved_face_id;
 
                  /* If there is space after the indicator generate an
-                    extra empty glysph to restore the face. */
+                    extra empty glysph to restore the face. Issue was
+                    observed in X systems.  */
                  it->char_to_display = ' ';
                  PRODUCE_GLYPHS (it);
 
@@ -20514,7 +20516,6 @@ extend_face_to_end_of_line (struct it *it)
             }
        }
 #ifdef HAVE_WINDOW_SYSTEM
-
       if (it->glyph_row->reversed_p)
        {
          /* Prepend a stretch glyph to the row, such that the
@@ -20635,18 +20636,19 @@ extend_face_to_end_of_line (struct it *it)
       else
        it->face_id = face->id;
 
-      /* Display fill-column-line if needed.  */
+      /* Display fill-column indicator if needed.  */
       if (FILL_COLUMN_INDICATOR_NEEDED(it))
        {
          int fill_column_indicator_column = -1;
 
          /* Vdisplay_fill_column_indicator_column accepts the special
-            value t to use the default fill-column variable.  */
-         if (EQ (Vdisplay_fill_column_indicator_column, Qt)
-             && FIXNATP (BVAR (current_buffer, fill_column)))
+            value t to use the default fill-column variable. The
+            conditions are all defined in the macro
+            FILL_COLUMN_INDICATOR_NEEDED.  */
+         if (EQ (Vdisplay_fill_column_indicator_column, Qt))
            fill_column_indicator_column =
              XFIXNAT (BVAR (current_buffer, fill_column)) + 
it->lnum_pixel_width;
-         else if (FIXNATP (Vdisplay_fill_column_indicator_column))
+         else
            fill_column_indicator_column =
              XFIXNAT (Vdisplay_fill_column_indicator_column) + 
it->lnum_pixel_width;
 
@@ -20656,7 +20658,7 @@ extend_face_to_end_of_line (struct it *it)
                {
                  const int saved_face = it->face_id;
                  it->face_id =
-                   merge_faces (it->w, Qfill_column_face, 0, DEFAULT_FACE_ID);
+                   merge_faces (it->w, Qfill_column_indicator, 0, 
DEFAULT_FACE_ID);
                  it->c = it->char_to_display =
                    XFIXNAT (Vdisplay_fill_column_indicator_character);
                  PRODUCE_GLYPHS (it);
@@ -32839,8 +32841,8 @@ be let-bound around code that needs to disable messages 
temporarily. */);
   /* Name of a text property which disables line-number display.  */
   DEFSYM (Qdisplay_line_numbers_disable, "display-line-numbers-disable");
 
-  /* Names of the face used to display fill column indicator character.  */
-  DEFSYM (Qfill_column_face, "fill-column-face");
+  /* Name of the face used to display fill column indicator character.  */
+  DEFSYM (Qfill_column_indicator, "fill-column-indicator");
 
   /* Name and number of the face used to highlight escape glyphs.  */
   DEFSYM (Qescape_glyph, "escape-glyph");
@@ -33414,25 +33416,26 @@ either `relative' or `visual'.  */);
   DEFSYM (Qdisplay_line_numbers_widen, "display-line-numbers-widen");
   Fmake_variable_buffer_local (Qdisplay_line_numbers_widen);
 
-  DEFVAR_LISP ("display-fill-column-indicator", Vdisplay_fill_column_indicator,
+  DEFVAR_BOOL ("display-fill-column-indicator", Vdisplay_fill_column_indicator,
     doc: /* Non-nil means display the fill column indicator.  */);
-  Vdisplay_fill_column_indicator = Qnil;
+  Vdisplay_fill_column_indicator = false;
   DEFSYM (Qdisplay_fill_column_indicator, "display-fill-column-indicator");
   Fmake_variable_buffer_local (Qdisplay_fill_column_indicator);
 
   DEFVAR_LISP ("display-fill-column-indicator-column", 
Vdisplay_fill_column_indicator_column,
-    doc: /* Column for 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.  */);
+    doc: /* Column for 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 it is set to an integer the
+indicator will be drawn in that column.  */);
   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);
 
   DEFVAR_LISP ("display-fill-column-indicator-character", 
Vdisplay_fill_column_indicator_character,
-    doc: /* Character to draw the indicator when 
`display-fill-column-indicator' is non-nil.
-The default is U+2502 but a good alternative is (ascii 124) if
-the font in fill-column-face does not support Unicode characters.  */);
+    doc: /* Character to draw the indicator when
+`display-fill-column-indicator' is non-nil.  The default is U+2502 but
+a good alternative is (ascii 124) if the font in fill-column-indicator
+face does not support Unicode characters.  */);
   Vdisplay_fill_column_indicator_character = Qnil;
   DEFSYM (Qdisplay_fill_column_indicator_character, 
"display-fill-column-indicator-character");
   Fmake_variable_buffer_local (Qdisplay_fill_column_indicator_character);



reply via email to

[Prev in Thread] Current Thread [Next in Thread]