help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Copy rectangle - strange side effect


From: 2rb1
Subject: Re: Copy rectangle - strange side effect
Date: Thu, 25 Oct 2012 15:24:25 -0700 (PDT)

Thank you for the reply


Peter Dyballa wrote
> Not showing us your Elisp code.
> 
> Are you aware of C-x r r, copy-rectangle-to-register?
> 
> --
> Greetings
> 
>   Pete
> 
> "Debugging? Klingons do not debug. Our software does not coddle the weak."


The code is in the first post; but perhaps the  tag does not translate well
to mails (new to the forum as well...).  Anyway, here it is in plain ASCII:

(defun my-copy-rectangle ()
  "Copy rectangle as kill: Make a copy of rectangle as defined by region and
put into kill ring"
  (interactive)
  (setq my-start (region-beginning))
  (setq my-end (region-end))
  (kill-rectangle my-start my-end)
  (goto-char my-start)
  (yank-rectangle)
  )

(global-set-key [S-M-insert] 'my-copy-rectangle)       ; <Ctrl>+<Alt>+<Ins>
Copy R

(global-set-key [M-delete]  'kill-rectangle)           ; <Alt>+<Del>    Cut
R

I was not aware of the copy-rectangle-to-register; but having to also type
in a register name when I paste will probably not save me any key strokes. 
Or do you suggest to use it to bind it to a key with using a the same
register for the corresponding yank/paste option?  I will try that tomorrow.

/2rb1





--
View this message in context: 
http://emacs.1067599.n5.nabble.com/Copy-rectangle-strange-side-effect-tp268053p268100.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]