emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[elpa] externals/pulsar 16ce3150a1 1/3: Remove the pulsar-pulse-region o


From: ELPA Syncer
Subject: [elpa] externals/pulsar 16ce3150a1 1/3: Remove the pulsar-pulse-region option to simplify region pulsing
Date: Thu, 12 Dec 2024 03:58:46 -0500 (EST)

branch: externals/pulsar
commit 16ce3150a174129e0a93ea7a4d8918cdd1c160cf
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Remove the pulsar-pulse-region option to simplify region pulsing
    
    If pulsar-pulse-region-functions is nil, then we are not going to be
    pulsing anyway. So let's not have two user options here.
---
 pulsar.el | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/pulsar.el b/pulsar.el
index 5e2720745b..bc9470ad97 100644
--- a/pulsar.el
+++ b/pulsar.el
@@ -130,7 +130,7 @@ This only takes effect when `pulsar-mode' (buffer-local) or
   :package-version '(pulsar . "1.1.0")
   :group 'pulsar)
 
-(defcustom pulsar-pulse-region-functions
+(defvar pulsar-pulse-region-common-functions
   '(yank
     kill-region
     kill-line
@@ -146,15 +146,19 @@ This only takes effect when `pulsar-mode' (buffer-local) 
or
     yank-rectangle
     open-rectangle
     undo)
+  "Common functions that can be used for `pulsar-pulse-region-functions'.")
+
+(defcustom pulsar-pulse-region-functions nil
   "Functions that highlight the affected region after invocation.
-This only takes effect when `pulsar-mode' is enabled."
-  :type '(repeat function)
-  :package-version '(pulsar . "1.2.0")
-  :group 'pulsar)
+When the value is nil, no pulsing is in effect.  Otherwise, the value is
+a list of functions that operate on the region.  It can be, for example,
+`pulsar-pulse-region-common-functions'.
 
-(defcustom pulsar-pulse-region nil
-  "When non-nil, highlight the affected region after invocation."
-  :type 'boolean
+This only takes effect when `pulsar-mode' (buffer-local) or
+`pulsar-global-mode' is enabled."
+  :type '(choice
+          (const :tag "Do not pulse the region" nil)
+          (repeat function))
   :package-version '(pulsar . "1.2.0")
   :group 'pulsar)
 
@@ -517,8 +521,7 @@ Also check `pulsar-global-mode'."
         (when pulsar-resolve-pulse-function-aliases
           (pulsar-resolve-function-aliases))
         (add-hook 'post-command-hook #'pulsar--post-command-pulse nil 'local)
-        (when pulsar-pulse-region
-          (add-hook 'after-change-functions #'pulsar--after-change-function 
nil 'local))
+        (add-hook 'after-change-functions #'pulsar--after-change-function nil 
'local)
         (when pulsar-pulse-on-window-change
           (add-hook 'window-buffer-change-functions 
#'pulsar--pulse-on-window-change nil 'local)
           (add-hook 'window-selection-change-functions 
#'pulsar--pulse-on-window-change nil 'local)))
@@ -579,17 +582,15 @@ Changes are defined by BEG, END, LEN:
      ;; Extract the outer limits of the affected region from
      ;; accumulated changes. NOTE: Non-contiguous regions such as
      ;; rectangles will pulse their contiguous bounds.
-     ((and pulsar-pulse-region
-           pulsar--pulse-region-changes)
+     (pulsar--pulse-region-changes
       (let ((beg (apply #'min (mapcar #'car pulsar--pulse-region-changes)))
             (end (apply #'max (mapcar #'cdr pulsar--pulse-region-changes))))
         (setq pulsar--pulse-region-changes nil)
         (pulsar--pulse nil pulsar-region-change-face beg end)))
      ;; Pulse the selected region for commands that did not cause
      ;; buffer changes; e.g., kill-ring-save.
-     ((and pulsar-pulse-region
-           (or (memq this-command pulsar-pulse-region-functions)
-               (memq real-this-command pulsar-pulse-functions)))
+     ((or (memq this-command pulsar-pulse-region-functions)
+          (memq real-this-command pulsar-pulse-functions))
       (pulsar-pulse-region)))))
 
 (make-obsolete 'pulsar-setup nil "0.3.0")



reply via email to

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