Subject: Re: bug#62988: 30.0.50; Add highlight line-or-region command to pulse.el

From: Stefan Kangas <[email-masked]>
Date: Tue, 5 Sep 2023 09:24:18 -0700

Gabriel <[email-masked]> writes:

> My suggestion is to add a new command (i.e. an interactive function) to
> pulse.el to highlight the current line or region.  The basic functions
> already exist, but no command is provided.  This command is useful, for
> example, in videos, demos or pair-programming sessions where the user
> wish to highlight the current line or region for the audience.
>
> Although pulse.el is part of CEDET, it provides general-purpose
> functions not coupled to CEDET.

Indeed.  I guess this is only in the lisp/cedet for hysterical raisins.

> Example: apply patch and bind the new command to F1 key
>
> (keymap-set global-map
>             "<f1>"
>             #'pulse-momentary-highlight-line-or-region)

Your patch and the feature makes sense to me, and I guess some users
might want it.  I think it should be called out in NEWS, and then it can
go in.

> ============================================================
>
>>>From 30681b98fed3e90a653a741a644c94ee4f89a719 Mon Sep 17 00:00:00 2001
> From: Gabriel do Nascimento Ribeiro <[email-masked]>
> Date: Fri, 21 Apr 2023 02:51:47 -0300
> Subject: [PATCH 1/1] Add command to highlight line or region to pulse.el
>
> * lisp/cedet/pulse.el
> (pulse-momentary-highlight-line-or-region): New command.
> ---
>  lisp/cedet/pulse.el | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/lisp/cedet/pulse.el b/lisp/cedet/pulse.el
> index 37b41fbe8c3..c76668152f7 100644
> --- a/lisp/cedet/pulse.el
> +++ b/lisp/cedet/pulse.el
> @@ -215,6 +215,14 @@ pulse-momentary-highlight-region
>      (overlay-put o 'pulse-delete t)
>      (pulse-momentary-highlight-overlay o face)))
>
> +;;;###autoload
> +(defun pulse-momentary-highlight-line-or-region ()
> +  "Highlight current region, when active, or current line, otherwise."
> +  (interactive)
> +  (if (use-region-p)
> +      (pulse-momentary-highlight-region (region-beginning) (region-end))
> +    (pulse-momentary-highlight-one-line)))
> +
>  ;;; Random integration with other tools
>
>  (defvar pulse-command-advice-flag nil)