diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el index 7ca9dc1af1..52cdcd9767 100644 --- a/lisp/emulation/cua-rect.el +++ b/lisp/emulation/cua-rect.el @@ -423,10 +423,23 @@ cua-resize-rectangle-bol (cua--rectangle-corner -1)) (cua--rectangle-resized))) +(defun cua-resize-rectangle-back-to-indentation () + "Resize rectangle to first non-whitespace character on the left." + (interactive) + (unless (bolp) + (back-to-indentation) + (cua--rectangle-left (current-column)) + (if (cua--rectangle-right-side) + (cua--rectangle-corner -1)) + (cua--rectangle-resized))) + (defun cua-resize-rectangle-bot () "Resize rectangle to bottom of buffer." (interactive) (goto-char (point-max)) + (let ((col (cua--rectangle-column))) + (when (< (current-column) col) + (cua--forward-line -1))) (move-to-column (cua--rectangle-column)) (cua--rectangle-bot t) (cua--rectangle-resized)) @@ -1503,6 +1516,8 @@ cua--init-rectangles (define-key cua--rectangle-keymap [remap previous-line] 'cua-resize-rectangle-up) (define-key cua--rectangle-keymap [remap end-of-line] 'cua-resize-rectangle-eol) (define-key cua--rectangle-keymap [remap beginning-of-line] 'cua-resize-rectangle-bol) + (define-key cua--rectangle-keymap [remap move-end-of-line] 'cua-resize-rectangle-eol) + (define-key cua--rectangle-keymap [remap move-beginning-of-line] 'cua-resize-rectangle-bol) (define-key cua--rectangle-keymap [remap end-of-buffer] 'cua-resize-rectangle-bot) (define-key cua--rectangle-keymap [remap beginning-of-buffer] 'cua-resize-rectangle-top) (define-key cua--rectangle-keymap [remap scroll-down] 'cua-resize-rectangle-page-up) @@ -1522,7 +1537,7 @@ cua--init-rectangles (define-key cua--rectangle-keymap "\r" 'cua-rotate-rectangle) (define-key cua--rectangle-keymap "\t" 'cua-indent-rectangle) - (define-key cua--rectangle-keymap [(control ??)] 'cua-help-for-rectangle) + (define-key cua--rectangle-keymap (kbd "M-?") 'cua-help-for-rectangle) (define-key cua--rectangle-keymap [mouse-1] 'cua-mouse-set-rectangle-mark) (define-key cua--rectangle-keymap [down-mouse-1] 'cua--mouse-ignore) @@ -1547,6 +1562,9 @@ cua--init-rectangles (cua--rect-M/H-key ?k 'cua-cut-rectangle-as-text) (cua--rect-M/H-key ?l 'cua-downcase-rectangle) (cua--rect-M/H-key ?m 'cua-copy-rectangle-as-text) +; (cua--rect-M/H-key ?m 'cua-copy-rectangle-as-text) ;; TBD + (define-key cua--rectangle-keymap [remap back-to-indentation] 'cua-resize-rectangle-back-to-indentation) + (cua--rect-M/H-key ?n 'cua-sequence-rectangle) (cua--rect-M/H-key ?o 'cua-open-rectangle) (cua--rect-M/H-key ?p 'cua-toggle-rectangle-virtual-edges)