bug-gnu-emacs
[Top][All Lists]
Advanced

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

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


From: Gabriel
Subject: bug#62988: 30.0.50; Add highlight line-or-region command to pulse.el
Date: Fri, 21 Apr 2023 03:04:49 -0300

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)

============================================================
>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

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

---
Gabriel

reply via email to

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