branch: externals/shift-number
commit f6665af5d8bf4326f6f5364c505f73e49d132c98
Author: Campbell Barton <[email protected]>
Commit: Campbell Barton <[email protected]>

    When "motion" is enabled, set the "mark" to the beginning
    
    Useful if further operations are needed on the number.
---
 readme.rst      | 3 ++-
 shift-number.el | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/readme.rst b/readme.rst
index 92fcda5cc7..ae952992e0 100644
--- a/readme.rst
+++ b/readme.rst
@@ -58,7 +58,8 @@ Custom Variables
 ----------------
 
 ``shift-number-motion``: ``nil``
-   When non-nil, move the cursor to the end of the number.
+   When non-nil, move the cursor to the end of the number,
+   set the ``mark`` to the beginning.
 ``shift-number-negative``: ``t``
    When non-nil, support negative numbers.
 
diff --git a/shift-number.el b/shift-number.el
index 191b6d7383..bea9666f8b 100644
--- a/shift-number.el
+++ b/shift-number.el
@@ -40,7 +40,8 @@
   :type 'boolean)
 
 (defcustom shift-number-motion nil
-  "If non-nil, move the point to the end of the number."
+  "If non-nil, move the point to the end of the number.
+The `mark' is set the the beginning of the number."
   :type 'boolean)
 
 (declare-function apply-on-rectangle "rect")
@@ -246,6 +247,7 @@ Otherwise search forward limited by LIMIT-END."
     (let* ((old-bounds (car bounds-pair))
            (new-bounds (cdr bounds-pair))
            (old-end (cdr old-bounds))
+           (new-beg (car new-bounds))
            (new-end (cdr new-bounds)))
 
       (cond
@@ -260,6 +262,7 @@ Otherwise search forward limited by LIMIT-END."
       (goto-char old-pos)
 
       (when shift-number-motion
+        (set-mark new-beg)
         (goto-char new-end))
 
       new-end)))

Reply via email to