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: Fri, 26 Oct 2012 04:31:46 -0700 (PDT)

So I tried the copy-rectangle-to-register approach as follows:

(global-set-key [M-insert] (lambda () (interactive) (insert-register t ))) 
(global-set-key [S-M-insert] (lambda () (interactive)
(copy-rectangle-to-register t (region-beginning) (region-end) )) )

Seemed to work.  Now, I would like also to be able to have a
delete-rectangle-to-register functionality, so I came up with this:

(defun my-delete-rectangle-to-register ()
  "Copy rectangle : Make a copy of rectangle as defined by region and put
into reg"
  (interactive)
  (setq my-start (region-beginning))
  (setq my-end (region-end))
  (copy-rectangle-to-register t my-start my-end)
  (delete-rectangle my-start my-end )
  )

(global-set-key [M-delete]  'my-delete-rectangle-to-register )

At first (in the Lisp buffer) this seemed to work as expected.  This was
also true in Tcl mode; but in VHDL mode the last function would only delete
a few characters following region-end.  Unfortunately, this is where I need
these functions the most.

So I guess this is somehow related to the VHDL mode.  Why this is the case
when the functions seems to work flawlessly when invoked manually beats me. 
But then, I have to admit I am not familiar with the internal details of
Emacs - I am just a (mostly) happy user :-)

Any ideas?

/2rb1



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



reply via email to

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