unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] TTY Support for ECMA-48 strike-through graphic rendition
@ 2020-06-25 21:44 Mike Hamrick
  2020-06-26 10:46 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Mike Hamrick @ 2020-06-25 21:44 UTC (permalink / raw)
  To: emacs-devel

Hello,

In 1984, the third edition of ECMA-48 "Control Functions for Coded
Character Sets" was published. In section 8.3.117 under "Select Graphic
Rendition" a new character attribute for "crossed-out" was added.

As Thomas Dickey notes, many escape sequences in ECMA-48 were in fact
created by a committee, and did not exist in hardware terminals of the
time, but were rather a framework for proposed terminal implementations.

Some 30 years on, many terminal programs such as xterm, gnome-terminal,
termite, st, konsole, and others have implemented the ECMA-48
strike-through escape sequences, however there wasn't a terminfo(5)
capability defined for the purpose until a few years ago.

Here is my patch which adds Emacs TTY support for strike-through
rendering, which I personally use in org-mode for done TODO items. In
order for this to work for you, your terminfo database entry needs to have the
"smxx" capability defined, which I believe more recent versions[0] of the
xterm entry have.

[0]: https://invisible-island.net/xterm/terminfo.html

* term.c: Support strike-through in capable terminals.
(no_color_bit): Replace unused NC_INVIS with NC_STRIKE_THROUGH.
(turn_on_face): Output via TS_enter_strike_through_mode if available.
(turn_off_face): Handle strike-through case.
(tty_capable_p, init_tty): Support strike-through.

* termchar.h (struct tty_display_info): Add field for strike-through.

* xfaces.c (tty_supports_face_attributes_p, realize_tty_face):
Handle strike-through case.

* dispextern.h: Add TTY_CAP_STRIKE_THROUGH definition.
(struct face): Add field tty_strike_through_p.
---
 src/dispextern.h |  2 ++
 src/term.c       | 34 ++++++++++++++++++++--------------
 src/termchar.h   |  1 +
 src/xfaces.c     | 12 +++++++++++-
 4 files changed, 34 insertions(+), 15 deletions(-)

diff --git a/src/dispextern.h b/src/dispextern.h
index e1d6eddc41..082a345441 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1744,6 +1744,7 @@ #define FONT_TOO_HIGH(ft)						\
   bool_bf tty_italic_p : 1;
   bool_bf tty_underline_p : 1;
   bool_bf tty_reverse_p : 1;
+  bool_bf tty_strike_through_p : 1;

   /* True means that colors of this face may not be freed because they
      have been copied bitwise from a base face (see
@@ -3290,6 +3291,7 @@ #define TTY_CAP_UNDERLINE	0x02
 #define TTY_CAP_BOLD		0x04
 #define TTY_CAP_DIM		0x08
 #define TTY_CAP_ITALIC  	0x10
+#define TTY_CAP_STRIKE_THROUGH	0x20

 \f
 /***********************************************************************
diff --git a/src/term.c b/src/term.c
index 5cbb092ad1..bf5e339d2f 100644
--- a/src/term.c
+++ b/src/term.c
@@ -105,14 +105,14 @@ #define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } whil

 enum no_color_bit
 {
-  NC_STANDOUT	 = 1 << 0,
-  NC_UNDERLINE	 = 1 << 1,
-  NC_REVERSE	 = 1 << 2,
-  NC_ITALIC	 = 1 << 3,
-  NC_DIM	 = 1 << 4,
-  NC_BOLD	 = 1 << 5,
-  NC_INVIS	 = 1 << 6,
-  NC_PROTECT	 = 1 << 7
+  NC_STANDOUT		 = 1 << 0,
+  NC_UNDERLINE		 = 1 << 1,
+  NC_REVERSE		 = 1 << 2,
+  NC_ITALIC		 = 1 << 3,
+  NC_DIM		 = 1 << 4,
+  NC_BOLD		 = 1 << 5,
+  NC_STRIKE_THROUGH	 = 1 << 6,
+  NC_PROTECT		 = 1 << 7
 };

 /* internal state */
@@ -1931,6 +1931,9 @@ turn_on_face (struct frame *f, int face_id)
   if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE))
     OUTPUT1_IF (tty, tty->TS_enter_underline_mode);

+  if (face->tty_strike_through_p && MAY_USE_WITH_COLORS_P (tty, NC_STRIKE_THROUGH))
+    OUTPUT1_IF (tty, tty->TS_enter_strike_through_mode);
+
   if (tty->TN_max_colors > 0)
     {
       const char *ts;
@@ -1971,7 +1974,8 @@ turn_off_face (struct frame *f, int face_id)
       if (face->tty_bold_p
 	  || face->tty_italic_p
 	  || face->tty_reverse_p
-	  || face->tty_underline_p)
+	  || face->tty_underline_p
+          || face->tty_strike_through_p)
 	{
 	  OUTPUT1_IF (tty, tty->TS_exit_attribute_mode);
 	  if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0)
@@ -2006,11 +2010,12 @@ #define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit)				\
   if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(tty, NC_bit)))	\
     return 0;

-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_INVERSE,	tty->TS_standout_mode, 	 	NC_REVERSE);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, 	tty->TS_enter_underline_mode, 	NC_UNDERLINE);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, 	tty->TS_enter_bold_mode, 	NC_BOLD);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, 		tty->TS_enter_dim_mode, 	NC_DIM);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_ITALIC, 	tty->TS_enter_italic_mode, 	NC_ITALIC);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_INVERSE,	  tty->TS_standout_mode, 		NC_REVERSE);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, 	  tty->TS_enter_underline_mode, 	NC_UNDERLINE);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, 	  tty->TS_enter_bold_mode, 		NC_BOLD);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, 		  tty->TS_enter_dim_mode, 		NC_DIM);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_ITALIC, 	  tty->TS_enter_italic_mode, 		NC_ITALIC);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_STRIKE_THROUGH, tty->TS_enter_strike_through_mode, 	NC_STRIKE_THROUGH);

   /* We can do it!  */
   return 1;
@@ -4124,6 +4129,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
   tty->TS_enter_alt_charset_mode = tgetstr ("as", address);
   tty->TS_exit_alt_charset_mode = tgetstr ("ae", address);
   tty->TS_exit_attribute_mode = tgetstr ("me", address);
+  tty->TS_enter_strike_through_mode = tgetstr ("smxx", address);

   MultiUp (tty) = tgetstr ("UP", address);
   MultiDown (tty) = tgetstr ("DO", address);
diff --git a/src/termchar.h b/src/termchar.h
index c96b81913b..a8b3051767 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -136,6 +136,7 @@ #define EMACS_TERMCHAR_H
   const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode.  */
   const char *TS_exit_underline_mode; /* "us" -- start underlining.  */
   const char *TS_enter_underline_mode; /* "ue" -- end underlining.  */
+  const char *TS_enter_strike_through_mode; /* "smxx" -- turn on strike-through mode.  */

   /* "as"/"ae" -- start/end alternate character set.  Not really
      supported, yet.  */
diff --git a/src/xfaces.c b/src/xfaces.c
index c4a4e1c94f..dc6ea5eacf 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5207,7 +5207,6 @@ tty_supports_face_attributes_p (struct frame *f,
       || !UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
       || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX])
       || !UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX])
-      || !UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX])
       || !UNSPECIFIEDP (attrs[LFACE_BOX_INDEX]))
     return false;

@@ -5272,6 +5271,15 @@ tty_supports_face_attributes_p (struct frame *f,
 	test_caps |= TTY_CAP_INVERSE;
     }

+  /* strike through */
+  val = attrs[LFACE_STRIKE_THROUGH_INDEX];
+  if (!UNSPECIFIEDP (val))
+    {
+      if (face_attr_equal_p (val, def_attrs[LFACE_STRIKE_THROUGH_INDEX]))
+	return false;		/* same as default */
+      else
+	test_caps |= TTY_CAP_STRIKE_THROUGH;
+    }

   /* Color testing.  */

@@ -6234,6 +6242,8 @@ realize_tty_face (struct face_cache *cache,
     face->tty_underline_p = true;
   if (!NILP (attrs[LFACE_INVERSE_INDEX]))
     face->tty_reverse_p = true;
+  if (!NILP (attrs[LFACE_STRIKE_THROUGH_INDEX]))
+    face->tty_strike_through_p = true;

   /* Map color names to color indices.  */
   map_tty_color (f, face, LFACE_FOREGROUND_INDEX, &face_colors_defaulted);
--
2.24.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] TTY Support for ECMA-48 strike-through graphic rendition
  2020-06-25 21:44 [PATCH] TTY Support for ECMA-48 strike-through graphic rendition Mike Hamrick
@ 2020-06-26 10:46 ` Eli Zaretskii
  2020-06-26 19:23   ` Mike Hamrick
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2020-06-26 10:46 UTC (permalink / raw)
  To: Mike Hamrick; +Cc: emacs-devel

> From: Mike Hamrick <mikeh@muppetlabs.com>
> Date: Thu, 25 Jun 2020 14:44:11 -0700
> 
> Here is my patch which adds Emacs TTY support for strike-through
> rendering, which I personally use in org-mode for done TODO items. In
> order for this to work for you, your terminfo database entry needs to have the
> "smxx" capability defined, which I believe more recent versions[0] of the
> xterm entry have.
> 
> [0]: https://invisible-island.net/xterm/terminfo.html

Thanks.  The changes look good to me, but:

 . please add a NEWS item announcing the support for this face
   attribute
 . the changes are large enough to require you to sign a copyright
   assignment for them; if you agree to start your legal paperwork, I
   will send you the form to fill

Thank you for your interest in Emacs.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] TTY Support for ECMA-48 strike-through graphic rendition
  2020-06-26 10:46 ` Eli Zaretskii
@ 2020-06-26 19:23   ` Mike Hamrick
  2020-06-26 19:38     ` Eli Zaretskii
  2020-08-11 19:17     ` Eli Zaretskii
  0 siblings, 2 replies; 12+ messages in thread
From: Mike Hamrick @ 2020-06-26 19:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel


Eli Zaretskii writes:
>  . please add a NEWS item announcing the support for this face
>    attribute

I've updated my patch to include a NEWS item.  I grepped through the
manual looking for areas that might need updating, and did not find
any.

>  . the changes are large enough to require you to sign a copyright
>    assignment for them; if you agree to start your legal paperwork, I
>    will send you the form to fill

I'm ready to start on the forms as soon as I receive them.

> Thank you for your interest in Emacs.

I will be very pleased to have contributed something, however small, to
one of my favorite programs.  I hope to be of some use to the project in
the future.

* term.c: Support strike-through in capable terminals.
(no_color_bit): Replace unused NC_INVIS with NC_STRIKE_THROUGH.
(turn_on_face): Output via TS_enter_strike_through_mode if available.
(turn_off_face): Handle strike-through case.
(tty_capable_p, init_tty): Support strike-through.

* termchar.h (struct tty_display_info): Add field for strike-through.

* xfaces.c (tty_supports_face_attributes_p, realize_tty_face):
Handle strike-through case.

* dispextern.h: Add TTY_CAP_STRIKE_THROUGH definition.
(struct face): Add field tty_strike_through_p.
---
 etc/NEWS         |  7 +++++++
 src/dispextern.h |  2 ++
 src/term.c       | 34 ++++++++++++++++++++--------------
 src/termchar.h   |  1 +
 src/xfaces.c     | 12 +++++++++++-
 5 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index d58a61be21..3b080579ad 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -81,6 +81,13 @@ dimension.
 Added a new Mozhi scheme.  The inapplicable ITRANS scheme is now
 deprecated.  Errors in the Inscript method were corrected.

+---
+** Support for the 'strike-through' face attribute on TTY frames.
+If your terminal's termcap or terminfo database entry has the 'smxx'
+capability defined, Emacs will now emit the prescribed escape
+sequences necessary to render faces with the 'strike-through'
+attribute on TTY frames.
+
 \f
 * Editing Changes in Emacs 28.1

diff --git a/src/dispextern.h b/src/dispextern.h
index e1d6eddc41..082a345441 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1744,6 +1744,7 @@ #define FONT_TOO_HIGH(ft)						\
   bool_bf tty_italic_p : 1;
   bool_bf tty_underline_p : 1;
   bool_bf tty_reverse_p : 1;
+  bool_bf tty_strike_through_p : 1;

   /* True means that colors of this face may not be freed because they
      have been copied bitwise from a base face (see
@@ -3290,6 +3291,7 @@ #define TTY_CAP_UNDERLINE	0x02
 #define TTY_CAP_BOLD		0x04
 #define TTY_CAP_DIM		0x08
 #define TTY_CAP_ITALIC  	0x10
+#define TTY_CAP_STRIKE_THROUGH	0x20

 \f
 /***********************************************************************
diff --git a/src/term.c b/src/term.c
index 5cbb092ad1..bf5e339d2f 100644
--- a/src/term.c
+++ b/src/term.c
@@ -105,14 +105,14 @@ #define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } whil

 enum no_color_bit
 {
-  NC_STANDOUT	 = 1 << 0,
-  NC_UNDERLINE	 = 1 << 1,
-  NC_REVERSE	 = 1 << 2,
-  NC_ITALIC	 = 1 << 3,
-  NC_DIM	 = 1 << 4,
-  NC_BOLD	 = 1 << 5,
-  NC_INVIS	 = 1 << 6,
-  NC_PROTECT	 = 1 << 7
+  NC_STANDOUT		 = 1 << 0,
+  NC_UNDERLINE		 = 1 << 1,
+  NC_REVERSE		 = 1 << 2,
+  NC_ITALIC		 = 1 << 3,
+  NC_DIM		 = 1 << 4,
+  NC_BOLD		 = 1 << 5,
+  NC_STRIKE_THROUGH	 = 1 << 6,
+  NC_PROTECT		 = 1 << 7
 };

 /* internal state */
@@ -1931,6 +1931,9 @@ turn_on_face (struct frame *f, int face_id)
   if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE))
     OUTPUT1_IF (tty, tty->TS_enter_underline_mode);

+  if (face->tty_strike_through_p && MAY_USE_WITH_COLORS_P (tty, NC_STRIKE_THROUGH))
+    OUTPUT1_IF (tty, tty->TS_enter_strike_through_mode);
+
   if (tty->TN_max_colors > 0)
     {
       const char *ts;
@@ -1971,7 +1974,8 @@ turn_off_face (struct frame *f, int face_id)
       if (face->tty_bold_p
 	  || face->tty_italic_p
 	  || face->tty_reverse_p
-	  || face->tty_underline_p)
+	  || face->tty_underline_p
+          || face->tty_strike_through_p)
 	{
 	  OUTPUT1_IF (tty, tty->TS_exit_attribute_mode);
 	  if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0)
@@ -2006,11 +2010,12 @@ #define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit)				\
   if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(tty, NC_bit)))	\
     return 0;

-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_INVERSE,	tty->TS_standout_mode, 	 	NC_REVERSE);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, 	tty->TS_enter_underline_mode, 	NC_UNDERLINE);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, 	tty->TS_enter_bold_mode, 	NC_BOLD);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, 		tty->TS_enter_dim_mode, 	NC_DIM);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_ITALIC, 	tty->TS_enter_italic_mode, 	NC_ITALIC);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_INVERSE,	  tty->TS_standout_mode, 		NC_REVERSE);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, 	  tty->TS_enter_underline_mode, 	NC_UNDERLINE);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, 	  tty->TS_enter_bold_mode, 		NC_BOLD);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, 		  tty->TS_enter_dim_mode, 		NC_DIM);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_ITALIC, 	  tty->TS_enter_italic_mode, 		NC_ITALIC);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_STRIKE_THROUGH, tty->TS_enter_strike_through_mode, 	NC_STRIKE_THROUGH);

   /* We can do it!  */
   return 1;
@@ -4124,6 +4129,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
   tty->TS_enter_alt_charset_mode = tgetstr ("as", address);
   tty->TS_exit_alt_charset_mode = tgetstr ("ae", address);
   tty->TS_exit_attribute_mode = tgetstr ("me", address);
+  tty->TS_enter_strike_through_mode = tgetstr ("smxx", address);

   MultiUp (tty) = tgetstr ("UP", address);
   MultiDown (tty) = tgetstr ("DO", address);
diff --git a/src/termchar.h b/src/termchar.h
index c96b81913b..a8b3051767 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -136,6 +136,7 @@ #define EMACS_TERMCHAR_H
   const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode.  */
   const char *TS_exit_underline_mode; /* "us" -- start underlining.  */
   const char *TS_enter_underline_mode; /* "ue" -- end underlining.  */
+  const char *TS_enter_strike_through_mode; /* "smxx" -- turn on strike-through mode.  */

   /* "as"/"ae" -- start/end alternate character set.  Not really
      supported, yet.  */
diff --git a/src/xfaces.c b/src/xfaces.c
index c4a4e1c94f..dc6ea5eacf 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5207,7 +5207,6 @@ tty_supports_face_attributes_p (struct frame *f,
       || !UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
       || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX])
       || !UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX])
-      || !UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX])
       || !UNSPECIFIEDP (attrs[LFACE_BOX_INDEX]))
     return false;

@@ -5272,6 +5271,15 @@ tty_supports_face_attributes_p (struct frame *f,
 	test_caps |= TTY_CAP_INVERSE;
     }

+  /* strike through */
+  val = attrs[LFACE_STRIKE_THROUGH_INDEX];
+  if (!UNSPECIFIEDP (val))
+    {
+      if (face_attr_equal_p (val, def_attrs[LFACE_STRIKE_THROUGH_INDEX]))
+	return false;		/* same as default */
+      else
+	test_caps |= TTY_CAP_STRIKE_THROUGH;
+    }

   /* Color testing.  */

@@ -6234,6 +6242,8 @@ realize_tty_face (struct face_cache *cache,
     face->tty_underline_p = true;
   if (!NILP (attrs[LFACE_INVERSE_INDEX]))
     face->tty_reverse_p = true;
+  if (!NILP (attrs[LFACE_STRIKE_THROUGH_INDEX]))
+    face->tty_strike_through_p = true;

   /* Map color names to color indices.  */
   map_tty_color (f, face, LFACE_FOREGROUND_INDEX, &face_colors_defaulted);
--
2.24.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] TTY Support for ECMA-48 strike-through graphic rendition
  2020-06-26 19:23   ` Mike Hamrick
@ 2020-06-26 19:38     ` Eli Zaretskii
  2020-08-11 19:17     ` Eli Zaretskii
  1 sibling, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2020-06-26 19:38 UTC (permalink / raw)
  To: Mike Hamrick; +Cc: emacs-devel

> From: Mike Hamrick <mikeh@muppetlabs.com>
> Cc: emacs-devel@gnu.org
> Date: Fri, 26 Jun 2020 12:23:48 -0700
> 
> >  . the changes are large enough to require you to sign a copyright
> >    assignment for them; if you agree to start your legal paperwork, I
> >    will send you the form to fill
> 
> I'm ready to start on the forms as soon as I receive them.

Thanks, form sent off-list.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] TTY Support for ECMA-48 strike-through graphic rendition
  2020-06-26 19:23   ` Mike Hamrick
  2020-06-26 19:38     ` Eli Zaretskii
@ 2020-08-11 19:17     ` Eli Zaretskii
  2020-08-12  9:36       ` Robert Pluim
                         ` (2 more replies)
  1 sibling, 3 replies; 12+ messages in thread
From: Eli Zaretskii @ 2020-08-11 19:17 UTC (permalink / raw)
  To: Mike Hamrick; +Cc: emacs-devel

> From: Mike Hamrick <mikeh@muppetlabs.com>
> Cc: emacs-devel@gnu.org
> Date: Fri, 26 Jun 2020 12:23:48 -0700
> 
> I've updated my patch to include a NEWS item.  I grepped through the
> manual looking for areas that might need updating, and did not find
> any.

Thanks, a couple of really minor nits below:

> @@ -1971,7 +1974,8 @@ turn_off_face (struct frame *f, int face_id)
>        if (face->tty_bold_p
>  	  || face->tty_italic_p
>  	  || face->tty_reverse_p
> -	  || face->tty_underline_p)
> +	  || face->tty_underline_p
> +          || face->tty_strike_through_p)

Please use our style of indentation in C source files (basically, make
sure indent-tabs-mode is non-nil).

Also, please make sure the patch still applies to the current master,
and if not, please update it.

Thanks.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] TTY Support for ECMA-48 strike-through graphic rendition
  2020-08-11 19:17     ` Eli Zaretskii
@ 2020-08-12  9:36       ` Robert Pluim
  2020-08-12 14:23         ` Eli Zaretskii
  2020-09-13 23:05       ` Mike Hamrick
  2020-09-14 22:25       ` Mike Hamrick
  2 siblings, 1 reply; 12+ messages in thread
From: Robert Pluim @ 2020-08-12  9:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Mike Hamrick, emacs-devel

>>>>> On Tue, 11 Aug 2020 22:17:08 +0300, Eli Zaretskii <eliz@gnu.org> said:

    Eli> Please use our style of indentation in C source files (basically, make
    Eli> sure indent-tabs-mode is non-nil).

That is not reflected in our .dir-locals.el for C files (for elisp it
sets indent-tabs-mode to nil)

I thought it was 'you can use tabs or spaces, but try match the usage
of existing code when making changes' (which since Iʼm pro-space means
that when making additions or when the lines Iʼm changing have a mix,
I use spaces).

Robert



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] TTY Support for ECMA-48 strike-through graphic rendition
  2020-08-12  9:36       ` Robert Pluim
@ 2020-08-12 14:23         ` Eli Zaretskii
  2020-08-12 16:19           ` Robert Pluim
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2020-08-12 14:23 UTC (permalink / raw)
  To: Robert Pluim; +Cc: mikeh, emacs-devel

> From: Robert Pluim <rpluim@gmail.com>
> Cc: Mike Hamrick <mikeh@muppetlabs.com>,  emacs-devel@gnu.org
> Date: Wed, 12 Aug 2020 11:36:29 +0200
> 
> >>>>> On Tue, 11 Aug 2020 22:17:08 +0300, Eli Zaretskii <eliz@gnu.org> said:
> 
>     Eli> Please use our style of indentation in C source files (basically, make
>     Eli> sure indent-tabs-mode is non-nil).
> 
> That is not reflected in our .dir-locals.el for C files (for elisp it
> sets indent-tabs-mode to nil)

Because it's the default, I believe.  Also because we couldn't agree
on a mandatory setting at the time this setting in .dir-locals.el was
discussed.

> I thought it was 'you can use tabs or spaces, but try match the usage
> of existing code when making changes' (which since Iʼm pro-space means
> that when making additions or when the lines Iʼm changing have a mix,
> I use spaces).

That would also indicate that the change in question should have used
mixed TABs and SPACEs.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] TTY Support for ECMA-48 strike-through graphic rendition
  2020-08-12 14:23         ` Eli Zaretskii
@ 2020-08-12 16:19           ` Robert Pluim
  2020-08-12 18:12             ` Stefan Monnier
  0 siblings, 1 reply; 12+ messages in thread
From: Robert Pluim @ 2020-08-12 16:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: mikeh, emacs-devel

>>>>> On Wed, 12 Aug 2020 17:23:38 +0300, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Robert Pluim <rpluim@gmail.com>
    >> Cc: Mike Hamrick <mikeh@muppetlabs.com>,  emacs-devel@gnu.org
    >> Date: Wed, 12 Aug 2020 11:36:29 +0200
    >> 
    >> >>>>> On Tue, 11 Aug 2020 22:17:08 +0300, Eli Zaretskii <eliz@gnu.org> said:
    >> 
    Eli> Please use our style of indentation in C source files (basically, make
    Eli> sure indent-tabs-mode is non-nil).
    >> 
    >> That is not reflected in our .dir-locals.el for C files (for elisp it
    >> sets indent-tabs-mode to nil)

    Eli> Because it's the default, I believe.  Also because we couldn't agree
    Eli> on a mandatory setting at the time this setting in .dir-locals.el was
    Eli> discussed.

The same is true for tab-width, sentence-end-double-space and
fill-column, yet we set those.

    >> I thought it was 'you can use tabs or spaces, but try match the usage
    >> of existing code when making changes' (which since Iʼm pro-space means
    >> that when making additions or when the lines Iʼm changing have a mix,
    >> I use spaces).

    Eli> That would also indicate that the change in question should have used
    Eli> mixed TABs and SPACEs.

I was unclear: I meant if there was a mix of lines with TAB + SPACEs
and lines with SPACEs only, I tend to normalize towards SPACEs.

Itʼs a constant battle between "try to match the surrounding style"
and "my indentation prejudices are *right*, dammit" :-)

Anyway, I have no wish to reignite a TABs vs SPACEs
discussion. Perhaps Iʼll just stick to elisp, where SPACEs rule.

Robert



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] TTY Support for ECMA-48 strike-through graphic rendition
  2020-08-12 16:19           ` Robert Pluim
@ 2020-08-12 18:12             ` Stefan Monnier
  0 siblings, 0 replies; 12+ messages in thread
From: Stefan Monnier @ 2020-08-12 18:12 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Eli Zaretskii, mikeh, emacs-devel

>     >> >>>>> On Tue, 11 Aug 2020 22:17:08 +0300, Eli Zaretskii <eliz@gnu.org> said:
>     >> 
>     Eli> Please use our style of indentation in C source files (basically, make
>     Eli> sure indent-tabs-mode is non-nil).
>     >> 
>     >> That is not reflected in our .dir-locals.el for C files (for elisp it
>     >> sets indent-tabs-mode to nil)
>
>     Eli> Because it's the default, I believe.  Also because we couldn't agree
>     Eli> on a mandatory setting at the time this setting in .dir-locals.el was
>     Eli> discussed.
>
> The same is true for tab-width, sentence-end-double-space and
> fill-column, yet we set those.

AFAIK there has never been disagreement about those (maybe some
squabbling about the precise value of `fill-column`, but in 99% of the
cases noone really notices if you use a slightly different setting).

Also those have effects which are much more tangible than the
TAB-vs-SPC.


        Stefan




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] TTY Support for ECMA-48 strike-through graphic rendition
  2020-08-11 19:17     ` Eli Zaretskii
  2020-08-12  9:36       ` Robert Pluim
@ 2020-09-13 23:05       ` Mike Hamrick
  2020-09-14 22:25       ` Mike Hamrick
  2 siblings, 0 replies; 12+ messages in thread
From: Mike Hamrick @ 2020-09-13 23:05 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel


Eli Zaretskii writes:

> Thanks, a couple of really minor nits below:
>
>> @@ -1971,7 +1974,8 @@ turn_off_face (struct frame *f, int face_id)
>>        if (face->tty_bold_p
>>  	  || face->tty_italic_p
>>  	  || face->tty_reverse_p
>> -	  || face->tty_underline_p)
>> +	  || face->tty_underline_p
>> +          || face->tty_strike_through_p)
>
> Please use our style of indentation in C source files (basically, make
> sure indent-tabs-mode is non-nil).
>
> Also, please make sure the patch still applies to the current master,
> and if not, please update it.

I've fixed the indentation issue, and have updated the patch so it
applies to the current master.

Mike

* term.c: Support strike-through in capable terminals.
(no_color_bit): Replace unused NC_INVIS with NC_STRIKE_THROUGH.
(turn_on_face): Output via TS_enter_strike_through_mode if available.
(turn_off_face): Handle strike-through case.
(tty_capable_p, init_tty): Support strike-through.

* termchar.h (struct tty_display_info): Add field for strike-through.

* xfaces.c (tty_supports_face_attributes_p, realize_tty_face):
Handle strike-through case.

* dispextern.h: Add TTY_CAP_STRIKE_THROUGH definition.
(struct face): Add field tty_strike_through_p.
---
 etc/NEWS         |  7 +++++++
 src/dispextern.h |  2 ++
 src/term.c       | 34 ++++++++++++++++++++--------------
 src/termchar.h   |  1 +
 src/xfaces.c     | 12 +++++++++++-
 5 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 52092f2ef7..757b4c74ae 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -85,6 +85,13 @@ useful on systems such as FreeBSD which ships only with "etc/termcap".
 \f
 * Changes in Emacs 28.1

+---
+** Support for the 'strike-through' face attribute on TTY frames.
+If your terminal's termcap or terminfo database entry has the 'smxx'
+capability defined, Emacs will now emit the prescribed escape
+sequences necessary to render faces with the 'strike-through'
+attribute on TTY frames.
+
 +++
 *** Emacs now defaults to UTF-8 instead of ISO-8859-1.
 This is only for the default, where the user has set no LANG (or
diff --git a/src/dispextern.h b/src/dispextern.h
index 956ca96eb6..e20f7bb7b6 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1744,6 +1744,7 @@ #define FONT_TOO_HIGH(ft)						\
   bool_bf tty_italic_p : 1;
   bool_bf tty_underline_p : 1;
   bool_bf tty_reverse_p : 1;
+  bool_bf tty_strike_through_p : 1;

   /* True means that colors of this face may not be freed because they
      have been copied bitwise from a base face (see
@@ -3290,6 +3291,7 @@ #define TTY_CAP_UNDERLINE	0x02
 #define TTY_CAP_BOLD		0x04
 #define TTY_CAP_DIM		0x08
 #define TTY_CAP_ITALIC  	0x10
+#define TTY_CAP_STRIKE_THROUGH	0x20

 \f
 /***********************************************************************
diff --git a/src/term.c b/src/term.c
index 5cbb092ad1..22035f4fe3 100644
--- a/src/term.c
+++ b/src/term.c
@@ -105,14 +105,14 @@ #define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } whil

 enum no_color_bit
 {
-  NC_STANDOUT	 = 1 << 0,
-  NC_UNDERLINE	 = 1 << 1,
-  NC_REVERSE	 = 1 << 2,
-  NC_ITALIC	 = 1 << 3,
-  NC_DIM	 = 1 << 4,
-  NC_BOLD	 = 1 << 5,
-  NC_INVIS	 = 1 << 6,
-  NC_PROTECT	 = 1 << 7
+  NC_STANDOUT		 = 1 << 0,
+  NC_UNDERLINE		 = 1 << 1,
+  NC_REVERSE		 = 1 << 2,
+  NC_ITALIC		 = 1 << 3,
+  NC_DIM		 = 1 << 4,
+  NC_BOLD		 = 1 << 5,
+  NC_STRIKE_THROUGH	 = 1 << 6,
+  NC_PROTECT		 = 1 << 7
 };

 /* internal state */
@@ -1931,6 +1931,9 @@ turn_on_face (struct frame *f, int face_id)
   if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE))
     OUTPUT1_IF (tty, tty->TS_enter_underline_mode);

+  if (face->tty_strike_through_p && MAY_USE_WITH_COLORS_P (tty, NC_STRIKE_THROUGH))
+    OUTPUT1_IF (tty, tty->TS_enter_strike_through_mode);
+
   if (tty->TN_max_colors > 0)
     {
       const char *ts;
@@ -1971,7 +1974,8 @@ turn_off_face (struct frame *f, int face_id)
       if (face->tty_bold_p
 	  || face->tty_italic_p
 	  || face->tty_reverse_p
-	  || face->tty_underline_p)
+	  || face->tty_underline_p
+	  || face->tty_strike_through_p)
 	{
 	  OUTPUT1_IF (tty, tty->TS_exit_attribute_mode);
 	  if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0)
@@ -2006,11 +2010,12 @@ #define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit)				\
   if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(tty, NC_bit)))	\
     return 0;

-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_INVERSE,	tty->TS_standout_mode, 	 	NC_REVERSE);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, 	tty->TS_enter_underline_mode, 	NC_UNDERLINE);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, 	tty->TS_enter_bold_mode, 	NC_BOLD);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, 		tty->TS_enter_dim_mode, 	NC_DIM);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_ITALIC, 	tty->TS_enter_italic_mode, 	NC_ITALIC);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_INVERSE,	  tty->TS_standout_mode,		NC_REVERSE);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE,	  tty->TS_enter_underline_mode,		NC_UNDERLINE);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD,		  tty->TS_enter_bold_mode,		NC_BOLD);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM,		  tty->TS_enter_dim_mode,		NC_DIM);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_ITALIC,	  tty->TS_enter_italic_mode,		NC_ITALIC);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_STRIKE_THROUGH, tty->TS_enter_strike_through_mode,	NC_STRIKE_THROUGH);

   /* We can do it!  */
   return 1;
@@ -4124,6 +4129,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
   tty->TS_enter_alt_charset_mode = tgetstr ("as", address);
   tty->TS_exit_alt_charset_mode = tgetstr ("ae", address);
   tty->TS_exit_attribute_mode = tgetstr ("me", address);
+  tty->TS_enter_strike_through_mode = tgetstr ("smxx", address);

   MultiUp (tty) = tgetstr ("UP", address);
   MultiDown (tty) = tgetstr ("DO", address);
diff --git a/src/termchar.h b/src/termchar.h
index c96b81913b..a8b3051767 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -136,6 +136,7 @@ #define EMACS_TERMCHAR_H
   const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode.  */
   const char *TS_exit_underline_mode; /* "us" -- start underlining.  */
   const char *TS_enter_underline_mode; /* "ue" -- end underlining.  */
+  const char *TS_enter_strike_through_mode; /* "smxx" -- turn on strike-through mode.  */

   /* "as"/"ae" -- start/end alternate character set.  Not really
      supported, yet.  */
diff --git a/src/xfaces.c b/src/xfaces.c
index 06d2f994de..73a536b19c 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5217,7 +5217,6 @@ tty_supports_face_attributes_p (struct frame *f,
       || !UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
       || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX])
       || !UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX])
-      || !UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX])
       || !UNSPECIFIEDP (attrs[LFACE_BOX_INDEX]))
     return false;

@@ -5282,6 +5281,15 @@ tty_supports_face_attributes_p (struct frame *f,
 	test_caps |= TTY_CAP_INVERSE;
     }

+  /* strike through */
+  val = attrs[LFACE_STRIKE_THROUGH_INDEX];
+  if (!UNSPECIFIEDP (val))
+    {
+      if (face_attr_equal_p (val, def_attrs[LFACE_STRIKE_THROUGH_INDEX]))
+	return false;		/* same as default */
+      else
+	test_caps |= TTY_CAP_STRIKE_THROUGH;
+    }

   /* Color testing.  */

@@ -6244,6 +6252,8 @@ realize_tty_face (struct face_cache *cache,
     face->tty_underline_p = true;
   if (!NILP (attrs[LFACE_INVERSE_INDEX]))
     face->tty_reverse_p = true;
+  if (!NILP (attrs[LFACE_STRIKE_THROUGH_INDEX]))
+    face->tty_strike_through_p = true;

   /* Map color names to color indices.  */
   map_tty_color (f, face, LFACE_FOREGROUND_INDEX, &face_colors_defaulted);
--
2.24.0



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] TTY Support for ECMA-48 strike-through graphic rendition
  2020-08-11 19:17     ` Eli Zaretskii
  2020-08-12  9:36       ` Robert Pluim
  2020-09-13 23:05       ` Mike Hamrick
@ 2020-09-14 22:25       ` Mike Hamrick
  2020-09-18  8:55         ` Eli Zaretskii
  2 siblings, 1 reply; 12+ messages in thread
From: Mike Hamrick @ 2020-09-14 22:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 1027 bytes --]


Eli Zaretskii writes:

>> From: Mike Hamrick <mikeh@muppetlabs.com>
>> Cc: emacs-devel@gnu.org
>> Date: Fri, 26 Jun 2020 12:23:48 -0700
>>
>> I've updated my patch to include a NEWS item.  I grepped through the
>> manual looking for areas that might need updating, and did not find
>> any.
>
> Thanks, a couple of really minor nits below:
>
>> @@ -1971,7 +1974,8 @@ turn_off_face (struct frame *f, int face_id)
>>        if (face->tty_bold_p
>>  	  || face->tty_italic_p
>>  	  || face->tty_reverse_p
>> -	  || face->tty_underline_p)
>> +	  || face->tty_underline_p
>> +          || face->tty_strike_through_p)
>
> Please use our style of indentation in C source files (basically, make
> sure indent-tabs-mode is non-nil).
>
> Also, please make sure the patch still applies to the current master,
> and if not, please update it.

It occurs to me that last time I responded to this, I didn't attach the
patch to this email, but instead tacked it on to the end of my
message. Sending the patch as an attachment this time.

Mike

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-TTY-Support-for-ECMA-48-strike-through-graphic-rendi.patch --]
[-- Type: text/x-diff, Size: 7237 bytes --]

From 26d60beb11286a2f6496cb2df11c88c1646788a5 Mon Sep 17 00:00:00 2001
From: Mike Hamrick <mikeh@muppetlabs.com>
Date: Sun, 13 Sep 2020 15:52:24 -0700
Subject: [PATCH] TTY Support for ECMA-48 strike-through graphic rendition

* term.c: Support strike-through in capable terminals.
(no_color_bit): Replace unused NC_INVIS with NC_STRIKE_THROUGH.
(turn_on_face): Output via TS_enter_strike_through_mode if available.
(turn_off_face): Handle strike-through case.
(tty_capable_p, init_tty): Support strike-through.

* termchar.h (struct tty_display_info): Add field for strike-through.

* xfaces.c (tty_supports_face_attributes_p, realize_tty_face):
Handle strike-through case.

* dispextern.h: Add TTY_CAP_STRIKE_THROUGH definition.
(struct face): Add field tty_strike_through_p.
---
 etc/NEWS         |  7 +++++++
 src/dispextern.h |  2 ++
 src/term.c       | 34 ++++++++++++++++++++--------------
 src/termchar.h   |  1 +
 src/xfaces.c     | 12 +++++++++++-
 5 files changed, 41 insertions(+), 15 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index 52092f2ef7..757b4c74ae 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -85,6 +85,13 @@ useful on systems such as FreeBSD which ships only with "etc/termcap".
 \f
 * Changes in Emacs 28.1
 
+---
+** Support for the 'strike-through' face attribute on TTY frames.
+If your terminal's termcap or terminfo database entry has the 'smxx'
+capability defined, Emacs will now emit the prescribed escape
+sequences necessary to render faces with the 'strike-through'
+attribute on TTY frames.
+
 +++
 *** Emacs now defaults to UTF-8 instead of ISO-8859-1.
 This is only for the default, where the user has set no LANG (or
diff --git a/src/dispextern.h b/src/dispextern.h
index 956ca96eb6..e20f7bb7b6 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -1744,6 +1744,7 @@ #define FONT_TOO_HIGH(ft)						\
   bool_bf tty_italic_p : 1;
   bool_bf tty_underline_p : 1;
   bool_bf tty_reverse_p : 1;
+  bool_bf tty_strike_through_p : 1;
 
   /* True means that colors of this face may not be freed because they
      have been copied bitwise from a base face (see
@@ -3290,6 +3291,7 @@ #define TTY_CAP_UNDERLINE	0x02
 #define TTY_CAP_BOLD		0x04
 #define TTY_CAP_DIM		0x08
 #define TTY_CAP_ITALIC  	0x10
+#define TTY_CAP_STRIKE_THROUGH	0x20
 
 \f
 /***********************************************************************
diff --git a/src/term.c b/src/term.c
index 5cbb092ad1..22035f4fe3 100644
--- a/src/term.c
+++ b/src/term.c
@@ -105,14 +105,14 @@ #define OUTPUT1_IF(tty, a) do { if (a) emacs_tputs ((tty), a, 1, cmputc); } whil
 
 enum no_color_bit
 {
-  NC_STANDOUT	 = 1 << 0,
-  NC_UNDERLINE	 = 1 << 1,
-  NC_REVERSE	 = 1 << 2,
-  NC_ITALIC	 = 1 << 3,
-  NC_DIM	 = 1 << 4,
-  NC_BOLD	 = 1 << 5,
-  NC_INVIS	 = 1 << 6,
-  NC_PROTECT	 = 1 << 7
+  NC_STANDOUT		 = 1 << 0,
+  NC_UNDERLINE		 = 1 << 1,
+  NC_REVERSE		 = 1 << 2,
+  NC_ITALIC		 = 1 << 3,
+  NC_DIM		 = 1 << 4,
+  NC_BOLD		 = 1 << 5,
+  NC_STRIKE_THROUGH	 = 1 << 6,
+  NC_PROTECT		 = 1 << 7
 };
 
 /* internal state */
@@ -1931,6 +1931,9 @@ turn_on_face (struct frame *f, int face_id)
   if (face->tty_underline_p && MAY_USE_WITH_COLORS_P (tty, NC_UNDERLINE))
     OUTPUT1_IF (tty, tty->TS_enter_underline_mode);
 
+  if (face->tty_strike_through_p && MAY_USE_WITH_COLORS_P (tty, NC_STRIKE_THROUGH))
+    OUTPUT1_IF (tty, tty->TS_enter_strike_through_mode);
+
   if (tty->TN_max_colors > 0)
     {
       const char *ts;
@@ -1971,7 +1974,8 @@ turn_off_face (struct frame *f, int face_id)
       if (face->tty_bold_p
 	  || face->tty_italic_p
 	  || face->tty_reverse_p
-	  || face->tty_underline_p)
+	  || face->tty_underline_p
+	  || face->tty_strike_through_p)
 	{
 	  OUTPUT1_IF (tty, tty->TS_exit_attribute_mode);
 	  if (strcmp (tty->TS_exit_attribute_mode, tty->TS_end_standout_mode) == 0)
@@ -2006,11 +2010,12 @@ #define TTY_CAPABLE_P_TRY(tty, cap, TS, NC_bit)				\
   if ((caps & (cap)) && (!(TS) || !MAY_USE_WITH_COLORS_P(tty, NC_bit)))	\
     return 0;
 
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_INVERSE,	tty->TS_standout_mode, 	 	NC_REVERSE);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE, 	tty->TS_enter_underline_mode, 	NC_UNDERLINE);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD, 	tty->TS_enter_bold_mode, 	NC_BOLD);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM, 		tty->TS_enter_dim_mode, 	NC_DIM);
-  TTY_CAPABLE_P_TRY (tty, TTY_CAP_ITALIC, 	tty->TS_enter_italic_mode, 	NC_ITALIC);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_INVERSE,	  tty->TS_standout_mode,		NC_REVERSE);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_UNDERLINE,	  tty->TS_enter_underline_mode,		NC_UNDERLINE);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_BOLD,		  tty->TS_enter_bold_mode,		NC_BOLD);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_DIM,		  tty->TS_enter_dim_mode,		NC_DIM);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_ITALIC,	  tty->TS_enter_italic_mode,		NC_ITALIC);
+  TTY_CAPABLE_P_TRY (tty, TTY_CAP_STRIKE_THROUGH, tty->TS_enter_strike_through_mode,	NC_STRIKE_THROUGH);
 
   /* We can do it!  */
   return 1;
@@ -4124,6 +4129,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
   tty->TS_enter_alt_charset_mode = tgetstr ("as", address);
   tty->TS_exit_alt_charset_mode = tgetstr ("ae", address);
   tty->TS_exit_attribute_mode = tgetstr ("me", address);
+  tty->TS_enter_strike_through_mode = tgetstr ("smxx", address);
 
   MultiUp (tty) = tgetstr ("UP", address);
   MultiDown (tty) = tgetstr ("DO", address);
diff --git a/src/termchar.h b/src/termchar.h
index c96b81913b..a8b3051767 100644
--- a/src/termchar.h
+++ b/src/termchar.h
@@ -136,6 +136,7 @@ #define EMACS_TERMCHAR_H
   const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode.  */
   const char *TS_exit_underline_mode; /* "us" -- start underlining.  */
   const char *TS_enter_underline_mode; /* "ue" -- end underlining.  */
+  const char *TS_enter_strike_through_mode; /* "smxx" -- turn on strike-through mode.  */
 
   /* "as"/"ae" -- start/end alternate character set.  Not really
      supported, yet.  */
diff --git a/src/xfaces.c b/src/xfaces.c
index 06d2f994de..73a536b19c 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5217,7 +5217,6 @@ tty_supports_face_attributes_p (struct frame *f,
       || !UNSPECIFIEDP (attrs[LFACE_HEIGHT_INDEX])
       || !UNSPECIFIEDP (attrs[LFACE_SWIDTH_INDEX])
       || !UNSPECIFIEDP (attrs[LFACE_OVERLINE_INDEX])
-      || !UNSPECIFIEDP (attrs[LFACE_STRIKE_THROUGH_INDEX])
       || !UNSPECIFIEDP (attrs[LFACE_BOX_INDEX]))
     return false;
 
@@ -5282,6 +5281,15 @@ tty_supports_face_attributes_p (struct frame *f,
 	test_caps |= TTY_CAP_INVERSE;
     }
 
+  /* strike through */
+  val = attrs[LFACE_STRIKE_THROUGH_INDEX];
+  if (!UNSPECIFIEDP (val))
+    {
+      if (face_attr_equal_p (val, def_attrs[LFACE_STRIKE_THROUGH_INDEX]))
+	return false;		/* same as default */
+      else
+	test_caps |= TTY_CAP_STRIKE_THROUGH;
+    }
 
   /* Color testing.  */
 
@@ -6244,6 +6252,8 @@ realize_tty_face (struct face_cache *cache,
     face->tty_underline_p = true;
   if (!NILP (attrs[LFACE_INVERSE_INDEX]))
     face->tty_reverse_p = true;
+  if (!NILP (attrs[LFACE_STRIKE_THROUGH_INDEX]))
+    face->tty_strike_through_p = true;
 
   /* Map color names to color indices.  */
   map_tty_color (f, face, LFACE_FOREGROUND_INDEX, &face_colors_defaulted);
-- 
2.24.0


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] TTY Support for ECMA-48 strike-through graphic rendition
  2020-09-14 22:25       ` Mike Hamrick
@ 2020-09-18  8:55         ` Eli Zaretskii
  0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2020-09-18  8:55 UTC (permalink / raw)
  To: Mike Hamrick; +Cc: emacs-devel

> From: Mike Hamrick <mikeh@muppetlabs.com>
> Cc: emacs-devel@gnu.org
> Date: Mon, 14 Sep 2020 15:25:24 -0700
> 
> > Also, please make sure the patch still applies to the current master,
> > and if not, please update it.
> 
> It occurs to me that last time I responded to this, I didn't attach the
> patch to this email, but instead tacked it on to the end of my
> message. Sending the patch as an attachment this time.

Thanks.

As long as you are using a reasonable MUA (and Emacs MUAs are _always_
reasonable), it doesn't matter much whether you send the patches as
attachment or inline.

I've now installed your changes.  Thanks for working on this feature.



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-09-18  8:55 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-25 21:44 [PATCH] TTY Support for ECMA-48 strike-through graphic rendition Mike Hamrick
2020-06-26 10:46 ` Eli Zaretskii
2020-06-26 19:23   ` Mike Hamrick
2020-06-26 19:38     ` Eli Zaretskii
2020-08-11 19:17     ` Eli Zaretskii
2020-08-12  9:36       ` Robert Pluim
2020-08-12 14:23         ` Eli Zaretskii
2020-08-12 16:19           ` Robert Pluim
2020-08-12 18:12             ` Stefan Monnier
2020-09-13 23:05       ` Mike Hamrick
2020-09-14 22:25       ` Mike Hamrick
2020-09-18  8:55         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).