From: Reuben Thomas Date: Sat, 14 Jul 2012 02:19:07 +0000 (+0800) Subject: * rect.el (copy-rectangle-as-kill): New command. X-Git-Tag: emacs-24.2.90~1199^2~2 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=be755c79bdba0a187af6541b0fea7d55d5b23754;p=emacs.git * rect.el (copy-rectangle-as-kill): New command. * lisp/rect.el, lisp/register.el: Move bindings to bindings.el. * lisp/bindings.el: Consolidate ctl-x-r-map bindings. Bind copy-rectangle-as-kill to C-x r w. Fixes: debbugs:739 --- diff --git a/etc/NEWS b/etc/NEWS index 0132a3a9ed7..fc34e31f1d5 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -158,6 +158,9 @@ character when doing minibuffer filename prompts. ** `goto-char' is now bound to `M-g c'. +** New command `C-x r M-w' (copy-rectangle-as-kill). +It copies the region-rectangle as the last rectangle kill. + ** New input method `vietnamese-vni'. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dd510bbcf58..fb1eae49dba 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,14 @@ +2012-07-14 Chong Yidong + + * bindings.el: Consolidate ctl-x-r-map bindings. Bind + copy-rectangle-as-kill to C-x r w. + + * rect.el, register.el: Move bindings to bindings.el. + +2012-07-14 Reuben Thomas + + * rect.el (copy-rectangle-as-kill): New command (Bug#739). + 2012-07-13 Andreas Schwab * emacs-lisp/cl.el (labels): Remove spurious quote. (Bug#11938) diff --git a/lisp/bindings.el b/lisp/bindings.el index 96700c6dc26..e0555a17b15 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -1183,7 +1183,30 @@ if `inhibit-field-text-motion' is non-nil." (define-key ctl-x-5-map "m" 'compose-mail-other-frame) -(defvar ctl-x-r-map (make-sparse-keymap) +(defvar ctl-x-r-map + (let ((map (make-sparse-keymap))) + (define-key map "c" 'clear-rectangle) + (define-key map "k" 'kill-rectangle) + (define-key map "d" 'delete-rectangle) + (define-key map "y" 'yank-rectangle) + (define-key map "o" 'open-rectangle) + (define-key map "t" 'string-rectangle) + (define-key map "N" 'rectangle-number-lines) + (define-key map "\M-w" 'copy-rectangle-as-kill) + (define-key map "\C-@" 'point-to-register) + (define-key map [?\C-\ ] 'point-to-register) + (define-key map " " 'point-to-register) + (define-key map "j" 'jump-to-register) + (define-key map "s" 'copy-to-register) + (define-key map "x" 'copy-to-register) + (define-key map "i" 'insert-register) + (define-key map "g" 'insert-register) + (define-key map "r" 'copy-rectangle-to-register) + (define-key map "n" 'number-to-register) + (define-key map "+" 'increment-register) + (define-key map "w" 'window-configuration-to-register) + (define-key map "f" 'frame-configuration-to-register) + map) "Keymap for subcommands of C-x r.") (define-key ctl-x-map "r" ctl-x-r-map) diff --git a/lisp/rect.el b/lisp/rect.el index 574d96a8c10..1bf7364e20d 100644 --- a/lisp/rect.el +++ b/lisp/rect.el @@ -29,16 +29,6 @@ ;; ### NOTE: this file was almost completely rewritten by Didier Verna ;; in July 1999. -;;; Global key bindings - -;;;###autoload (define-key ctl-x-r-map "c" 'clear-rectangle) -;;;###autoload (define-key ctl-x-r-map "k" 'kill-rectangle) -;;;###autoload (define-key ctl-x-r-map "d" 'delete-rectangle) -;;;###autoload (define-key ctl-x-r-map "y" 'yank-rectangle) -;;;###autoload (define-key ctl-x-r-map "o" 'open-rectangle) -;;;###autoload (define-key ctl-x-r-map "t" 'string-rectangle) -;;;###autoload (define-key ctl-x-r-map "N" 'rectangle-number-lines) - ;;; Code: ;; FIXME: this function should be replaced by `apply-on-rectangle' @@ -235,6 +225,13 @@ even beep.)" (barf-if-buffer-read-only) (signal 'text-read-only (list (current-buffer))))))) +;;;###autoload +(defun copy-rectangle-as-kill (start end) + "Copy the region-rectangle and save it as the last killed one." + (interactive "r") + (setq killed-rectangle (extract-rectangle start end)) + (setq deactivate-mark t)) + ;;;###autoload (defun yank-rectangle () "Yank the last killed rectangle with upper left corner at point." diff --git a/lisp/register.el b/lisp/register.el index 21fcff2d148..52c236e49be 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -34,22 +34,6 @@ (declare-function semantic-tag-buffer "semantic/tag" (tag)) (declare-function semantic-tag-start "semantic/tag" (tag)) -;;; Global key bindings - -(define-key ctl-x-r-map "\C-@" 'point-to-register) -(define-key ctl-x-r-map [?\C-\ ] 'point-to-register) -(define-key ctl-x-r-map " " 'point-to-register) -(define-key ctl-x-r-map "j" 'jump-to-register) -(define-key ctl-x-r-map "s" 'copy-to-register) -(define-key ctl-x-r-map "x" 'copy-to-register) -(define-key ctl-x-r-map "i" 'insert-register) -(define-key ctl-x-r-map "g" 'insert-register) -(define-key ctl-x-r-map "r" 'copy-rectangle-to-register) -(define-key ctl-x-r-map "n" 'number-to-register) -(define-key ctl-x-r-map "+" 'increment-register) -(define-key ctl-x-r-map "w" 'window-configuration-to-register) -(define-key ctl-x-r-map "f" 'frame-configuration-to-register) - ;;; Code: (cl-defstruct