all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "J.P." <jp@neverwas.me>
To: Fadi Moukayed <smfadi@gmail.com>
Cc: emacs-erc@gnu.org, 69597@debbugs.gnu.org
Subject: bug#69597: 29.2; ERC 5.6-git: Add a new customizable variable controlling how Erc displays spoilers
Date: Thu, 07 Mar 2024 12:29:12 -0800	[thread overview]
Message-ID: <87v85xn5uv.fsf__13366.7013071076$1709843401$gmane$org@neverwas.me> (raw)
In-Reply-To: <CAG_cVu9GnFUXvOg5aq4M0pNpDGMPJoAUXjOHp-9K9_nLZrnwgw@mail.gmail.com> (Fadi Moukayed's message of "Wed, 6 Mar 2024 20:26:36 +0100")

Hi Fadi,

Fadi Moukayed <smfadi@gmail.com> writes:

> Tags: patch
> Severity: wishlist
>
> Hi all,
>
> I am submitting a trivial patch adding a simple customizable variable
> (erc-format-spoilers) to Erc, allowing the user to control how Erc
> displays spoiler text when mIRC formatting code interpretation is
> enabled.
> This idea for this patch was discussed with the Erc maintainers on
> #erc, and was deemed to be useful enough to warrant a submission.
>
> Note that this is my first attempt to contribute to GNU Emacs.

Welcome! I think this would make a helpful addition.

However, I'm also starting to wonder if the way `erc-spoiler-face'
currently operates doesn't constitute buggy behavior. Skimming the
related commits and nonexistent discussion history, I see no clear
indication as to motivation or reasoning, making me think it was just
chucked in on a whim. Frankly, it calls into question the fitness of all
involved (ahem). Really, though, the only legitimate use case that comes
to mind is possibly emphasizing the presence of spoilers when an
IRC-formatted fg/bg combo matches the buffer's own defaults, meaning the
span might otherwise be mistaken for whitespace. But that doesn't seem
like a common occurrence, and I doubt anyone would intentionally make
`fg:erc-color-face0' or `fg:erc-color-face1' match `erc-default-face' or
the `default' face's :background.

So, basically, I wonder if we shouldn't (instead?) just redefine the
face's role to be one of indicating _revealed_ text, which is currently
the job of `erc-inverse-face' (`erc-spoilers-face' could just :inherit
it). And FWIW, a change like this would be justifiable without much fuss
if we deemed it a bug fix, since this feature hasn't made it into any
releases yet.

Another (competing) idea would be to instead have the option specify a
regexp pattern along with color combinations that ERC could use to
determine if a candidate is likely spoiler text, which would then be
shown accordingly. Somehow, though, I'm rather dubious anyone would
actually bother configuring such a thing.

(Also, on a related note, we should probably add a `cursor-face'
property to complement the `mouse-face' one currently added to spoilers
and maybe also mention `cursor-face-highlight-mode' in the doc string.)

Anyhow, I'm not suggesting you need to take on any of what I've just
mentioned, especially with the fifteen-line limit in effect (unless of
course your paperwork comes through in record time or you're feeling up
for the challenge). That said, I'd still like your input on these
matters if you don't mind. From the Transient project you shared and our
wider discussion in the channel, it's clear you've thought more about
this stuff than anyone else around, especially these days.

J.P.

> In GNU Emacs 29.2 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.20,
>  cairo version 1.16.0) of 2024-02-27 built on lcy02-amd64-095
[...]
>
> From 4d3b8fa17a975d6f04ba2a6ef4865d3938a76315 Mon Sep 17 00:00:00 2001
> From: "F. Moukayed" <smfadi+emacs@gmail.com>
> Date: Wed, 6 Mar 2024 18:33:46 +0000
> Subject: [PATCH] * lisp/erc/erc.el: (erc-format-spoilers): Add a new
>  customizable variable controling how Erc displays spoilers
                               ^
>
> ---
>  lisp/erc/erc-goodies.el | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/lisp/erc/erc-goodies.el b/lisp/erc/erc-goodies.el
> index 7e30b10..211d704 100644
> --- a/lisp/erc/erc-goodies.el
> +++ b/lisp/erc/erc-goodies.el
> @@ -645,6 +645,11 @@ emergency (message flood) it can be turned off to save processing time.  See
>  
>  (defcustom erc-interpret-mirc-color nil
>    "If non-nil, ERC will interpret mIRC color codes."
> +  :type 'boolean
> +  :group 'erc-control-characters)
> +
> +(defcustom erc-format-spoilers nil
> +  "If non-nil, ERC will format spoilers with `erc-spoiler-face'."
>    :type 'boolean)
>  
>  (defcustom erc-beep-p nil
> @@ -968,7 +973,7 @@ Also see `erc-interpret-controls-p' and `erc-interpret-mirc-color'."
>    "Prepend properties from IRC control characters between FROM and TO.
>  If optional argument STR is provided, apply to STR, otherwise prepend properties
>  to a region in the current buffer."
> -  (if (and fg bg (equal fg bg))
> +  (if (and fg bg (equal fg bg) erc-format-spoilers)
>        (progn
>          (setq fg 'erc-spoiler-face
>                bg nil)

P.S. These changes look fine, I think.






  reply	other threads:[~2024-03-07 20:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06 19:26 29.2; ERC 5.6-git: Add a new customizable variable controlling how Erc displays spoilers Fadi Moukayed
2024-03-07 20:29 ` J.P. [this message]
     [not found] ` <87v85xn5uv.fsf@neverwas.me>
2024-03-08  9:07   ` bug#69597: " Fadi Moukayed
     [not found]   ` <CAG_cVu_41w7VufKhJdaWEinQ-fyB22SULmyS0Gx9y+VgjGfYAQ@mail.gmail.com>
2024-03-08 15:05     ` J.P.
     [not found]     ` <87y1askbmr.fsf@neverwas.me>
2024-03-08 16:47       ` Fadi Moukayed
     [not found]       ` <CAG_cVu_Jcgk2KRbx7g_dZzsWjE-PQHJwCQuZGSYMV7ZFLZ4qEw@mail.gmail.com>
2024-03-09  4:43         ` J.P.
     [not found]         ` <87edckc8x2.fsf@neverwas.me>
2024-03-09 10:34           ` Fadi Moukayed
     [not found]           ` <CAG_cVu_gmo0Oc50y7pMTH8Nw_7JkWSMnOD9oZjYWLBiZa-GRfA@mail.gmail.com>
2024-03-09 16:06             ` J.P.
     [not found]             ` <87bk7n8k5k.fsf@neverwas.me>
2024-03-09 17:19               ` Fadi Moukayed
     [not found]               ` <CAG_cVu93JZ=Cx=io3BeYgarXT7FE5Mi5d+Js2Ju89uztgnKnLg@mail.gmail.com>
2024-03-14  2:17                 ` J.P.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='87v85xn5uv.fsf__13366.7013071076$1709843401$gmane$org@neverwas.me' \
    --to=jp@neverwas.me \
    --cc=69597@debbugs.gnu.org \
    --cc=emacs-erc@gnu.org \
    --cc=smfadi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.