"Chris F.A. Johnson" <[EMAIL PROTECTED]> writes: > On Wed, 01 Jun 2005 at 09:50 GMT, Hattuari wrote: >> Am I overlooking something, or is there no command in Emacs to copy a >> rectangle into the last killed rectangle "special place" without also >> removing it from the current buffer? I gotta tell y'all, XEmacs has better >> rectangle support than Emacs. ;) > > (defun copy-rectangle-as-kill () > (interactive) > (save-excursion > (kill-rectangle (mark) (point)) > (exchange-point-and-mark) > (yank-rectangle)))
I like this better: (defun copy-rectangle-as-kill (start end) "Copy rectangle with corners at point and mark; save as last killed one. Calling from program, supply two args START and END, buffer positions. But in programs you might prefer to use `extract-rectangle'." (interactive "r") (setq killed-rectangle (extract-rectangle start end)) (message "Rectangle saved.")) It does not feel right to me messing with the buffer just to get a copy of some of it. /Mathias _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://lists.gnu.org/mailman/listinfo/help-gnu-emacs