On XEmacs under mswindows, Sh-insert is bound to
`mswindows-paste-clipboard', which should delete the active selection
if there is one. I have (setq zmacs-regions nil) in my .emacs file.
I have observed the following problems with
`mswindows-paste-clipboard':
o In a buffer where mark is not defined, Sh-insert gives the error
message "Marker does not point anywhere". M-: (mark-marker) in this
case yields #<marker in no buffer 0xa065e34> if zmacs-regions is nil,
and nil if zmacs-region is t.
o In a buffer where mark is defined, Sh-insert replaces the region
with the clipboard. In particular, repeated applications of
Sh-insert have no apparent effect, because the region is defined to
be the just-inserted text.
Here's the code that's responsible from (msw-select.el)
mswindows-paste-clipboard:
(let ((clip (mswindows-get-clipboard)) (s (mark-marker)) (e
(point-marker)))
(or clip (error "there is no text on the clipboard"))
(if s ; here's the culprit
(if mouse-track-rectangle-p
(delete-rectangle s e)
(delete-region s e)))
(push-mark)
(if mouse-track-rectangle-p
(insert-rectangle clip)
(insert clip))))
One possible to solution is to replace `(if s' with `(if (and s
zmacs-regions)' or something to do with zmacs-region-active-p. This
will change the behavior only when zmacs-regions is set to nil. It
allows me to paste even when there's no mark, and to paste the
selection multiple times.
However, when a region is highlighted with a mouse drag, Sh-Insert
inserts the clipboard at point instead of replacing the region, which
is broken both with respect to the docstring and with respect to a
user's expectations (especially on mswindows). Again, this breaks
only when zmacs-regions is nil; when zmacs-regions is t, everything
works as expected.
So, the attached patch is probably not the best solution; on the
other hand, the current behavior (an error from paste if
zmacs-regions is nil and no mark) is definitely broken.
1999-04-20 Sam Mikes <smikes(a)alumni.hmc.edu>
* msw-select.el: (mswindows-paste-clipboard) Don't replace
region unless `zmacs-regions' is t
[ATTACHMENT ~/msw-patch.el, text/plain]
--
Sam Mikes
smikes(a)alumni.hmc.edu