[comp.emacs] rectangular-cut-and-paste

nat%DRAO.NRC.CA@VM.TCS.TULANE.EDU (Natalie Prowse) (11/09/90)

I am trying to define my insert and remove keys to do rectangular cut and
pastes. I have a flag variable that I set when entering rectangular mode, and
then my cut and paste routines test this flag and operate accordingly.  But
when I try to use the code, it doesn't work.  If I use kill-rectangle
interactively, it works as advertised, but in my calling program, nothing
happens.  I have put message statements in and I am SURE that it is getting to
the correct place in the code...  What Have I missed?  The cutting routine is
below.  Please don't flame my kludgey (borrowed/modified) code 8-}

(defun delete-to-cutbuffer ()
  (interactive)
  (cond ((string= evh-rect-mode "T")
	 (kill-rectangle (point) (mark)))
	(t
	 (setq buffname "paste")             ;; this section works fine !
	 (save-excursion
	   (copy-to-buffer buffname (point) (mark))
	   (delete-region (point) (mark))
	   (message "Region CUT to paste")))))

I tried encasing the kill-rectangle part in save-excursion, but it had no
noticeable effect.  I don't understand how to declare a global list variable,
so I don't really know how to invoke and make use of delete-extract-rectangle.
What I would really like is a rectangular cut-and-paste overwrite (where it
leaves a blank area like clear-rectangle, but preserves the cut region for
later yanking...) AND a rectangular-cut-and-paste insert-mode ( exactly how
kill-rectangle and yank-rectangle do it...)  Any suggestions?

Please mail directly to me as I am still not getting redistributed messages
from this list...

-Thanks in advance,
 Natalie

================================================================================
Natalie Prowse
Dominion Radio Astrophysical Observatory,        nat@drao.nrc.ca
National Research Council,                       (604) 497-5321
Penticton, BC, Canada