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

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

[elpa] externals/expreg e9e65ca5d4 2/4: Incorporate suggestions from ema


From: ELPA Syncer
Subject: [elpa] externals/expreg e9e65ca5d4 2/4: Incorporate suggestions from emacs-devel
Date: Sun, 20 Aug 2023 15:57:55 -0400 (EDT)

branch: externals/expreg
commit e9e65ca5d4b008379850ab747d7416ce667d1246
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    Incorporate suggestions from emacs-devel
    
    * expreg.el:
    (expreg-expand, expreg-contract): Use region-active-p and length>.
---
 expreg.el | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/expreg.el b/expreg.el
index 05459af9ba..1edfe01809 100644
--- a/expreg.el
+++ b/expreg.el
@@ -79,8 +79,8 @@
 (require 'subword)
 (require 'treesit)
 (eval-when-compile
-  (require 'cl-lib)
-  (require 'seq))
+  (require 'cl-lib))
+(require 'seq)
 
 ;;; Cutom options and variables
 
@@ -209,12 +209,13 @@ This should be a list of (BEG . END).")
   "The regions we’ve expanded past.
 This should be a list of (BEG . END).")
 
+;;;###autoload
 (defun expreg-expand ()
   "Expand region."
   (interactive)
   ;; Checking for last-command isn’t strictly necessary, but nice to
   ;; have.
-  (when (not (and (region-active-p)
+  (when (not (and (use-region-p)
                   (eq (region-beginning)
                       (cadr (car expreg--prev-regions)))
                   (eq (region-end)
@@ -236,7 +237,7 @@ This should be a list of (BEG . END).")
 
   ;; Go past all the regions that are smaller than the current region,
   ;; if region is active.
-  (when (region-active-p)
+  (when (use-region-p)
     (while (and expreg--next-regions
                 (let ((beg (cadr (car expreg--next-regions)))
                       (end (cddr (car expreg--next-regions))))
@@ -261,8 +262,8 @@ This should be a list of (BEG . END).")
 (defun expreg-contract ()
   "Contract region."
   (interactive)
-  (when (and (region-active-p)
-             (> (length expreg--prev-regions) 1))
+  (when (and (use-region-p)
+             (length> expreg--prev-regions 1))
 
     (push (pop expreg--prev-regions) expreg--next-regions)
     (set-mark (cddr (car expreg--prev-regions)))



reply via email to

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