Function: cua-incr-rectangle
cua-incr-rectangle is an interactive and byte-compiled function
defined in cua-rect.el.gz.
Signature
(cua-incr-rectangle INCREMENT)
Documentation
Increment each line of CUA rectangle by prefix amount.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emulation/cua-rect.el.gz
(defun cua-incr-rectangle (increment)
"Increment each line of CUA rectangle by prefix amount."
(interactive "p")
(cua--rectangle-operation 'keep nil t 1 nil
(lambda (_s e _l _r)
(cond
((re-search-forward "0x\\([[:xdigit:]]+\\)" e t)
(let* ((txt (cua--filter-buffer-noprops (match-beginning 1) (match-end 1)))
(n (string-to-number txt 16))
(fmt (format "0x%%0%dx" (length txt))))
(replace-match (format fmt (+ n increment)))))
((re-search-forward "\\( *-?[0-9]+\\)" e t)
(let* ((txt (cua--filter-buffer-noprops (match-beginning 1) (match-end 1)))
(prefix (if (= (aref txt 0) ?0) "0" ""))
(n (string-to-number txt 10))
(fmt (format "%%%s%dd" prefix (length txt))))
(replace-match (format fmt (+ n increment)))))
(t nil)))))