unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#62988: 30.0.50; Add highlight line-or-region command to pulse.el
@ 2023-04-21  6:04 Gabriel
  2023-09-05 16:24 ` Stefan Kangas
  0 siblings, 1 reply; 2+ messages in thread
From: Gabriel @ 2023-04-21  6:04 UTC (permalink / raw)
  To: 62988

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

severity: wishlist

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.

Example: apply patch and bind the new command to F1 key

(keymap-set global-map
            "<f1>"
            #'pulse-momentary-highlight-line-or-region)

============================================================

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-command-to-highlight-line-or-region-to-pulse.el.patch --]
[-- Type: text/x-diff, Size: 1077 bytes --]

From 30681b98fed3e90a653a741a644c94ee4f89a719 Mon Sep 17 00:00:00 2001
From: Gabriel do Nascimento Ribeiro <gabriel376@hotmail.com>
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)
-- 
2.34.1


[-- Attachment #3: Type: text/plain, Size: 74 bytes --]

============================================================

---
Gabriel

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

* bug#62988: 30.0.50; Add highlight line-or-region command to pulse.el
  2023-04-21  6:04 bug#62988: 30.0.50; Add highlight line-or-region command to pulse.el Gabriel
@ 2023-09-05 16:24 ` Stefan Kangas
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Kangas @ 2023-09-05 16:24 UTC (permalink / raw)
  To: Gabriel; +Cc: 62988

Gabriel <gabriel376@hotmail.com> 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 <gabriel376@hotmail.com>
> 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)





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

end of thread, other threads:[~2023-09-05 16:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-21  6:04 bug#62988: 30.0.50; Add highlight line-or-region command to pulse.el Gabriel
2023-09-05 16:24 ` Stefan Kangas

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).