>>>> "Ray" == Raymond Toy
<toy.raymond(a)gmail.com> writes:
>>>> "Mats" == Mats Lidell
<matsl(a)xemacs.org> writes:
>>>> Michael Sperber writes:
>> FWIW, my list so far has this:
>>
>> User-visible features: [...]
>> - C-Left Mouse for pasting
Mats> This is one really nice feature that I not only miss in GNU
Mats> Emacs but in other tools as well.
Ray> Can't that be done with a bit of elisp?
Hi,
I have a shortened version of what I posted yesterday (hasn't come
through yet, send from the wrong mail address to the list I
think. Sry.)
This is the non-invasive version. Since basically only the 'old-*'
variables are set, this could also be done by advising
'mouse-drag-region', 'mouse-set-region' and 'mouse-yank-at-click'
or
be implemented directly in the GNU Emacs version of "mouse.el".
I checked and XEmacs' 'mouse-track-insert' doesn't work when selecting
something in a different frame---pasting is tried at point of the
frame the selection is done (and so does my version). I my opinion
this should be fixed, because I think selecting with the mouse implies
window system and that implies probably multiple frames. However, I
haven't found a simple solution (yet) and my lisp is limited.
Hope this helps.
Toto
(defvar old-point nil)
(defvar old-mark nil)
(defvar old-buffer nil)
(defun mouse-drag-region-insert (start-event)
"This is a hack! Adapted from `mouse-drag-region' to implement
the functionality of the XEmacs function `mouse-track-insert':
\"Make a selection with the mouse and insert it at point.\"
Set the region to the text that the mouse is dragged over.
Highlight the drag area as you move the mouse. This must be
bound to a button-down mouse event. In Transient Mark mode, the
highlighting remains as long as the mark remains active.
Otherwise, it remains until the next input event.
If the click is in the echo area, display the `*Messages*' buffer.
Safes point and mark of current buffer so that they can be
restored in `mouse-set-region-insert'."
(interactive "e")
(setq old-point (point-marker))
(setq old-mark (mark-marker))
(setq old-buffer (current-buffer))
(mouse-drag-region start-event))
(defun mouse-set-region-insert (click)
"This is a hack! Adapted from `mouse-set-region' to implement
the functionality of the XEmacs function `mouse-track-insert':
\"Make a selection with the mouse and insert it at point.\"
Set the region to the text dragged over, copy to kill ring (the
`mouse-drag-copy-region' variable is lambda-bound for the
duration of this call) and yank it at point in the buffer active
before marking the region with the mouse. This should be bound
to a mouse drag event."
(interactive "e")
(let ((mouse-drag-copy-region t))
(mouse-set-region click))
;; adapted from `mouse-yank-at-click'
(let ((mouse-yank-at-point t))
;; Give temporary modes such as isearch a chance to turn off.
(run-hooks 'mouse-leave-buffer-hook)
(when select-active-regions
;; Without this, confusing things happen upon e.g. inserting into
;; the middle of an active region.
(deactivate-mark))
(set-buffer (marker-buffer old-point))
(goto-char old-point)
(push-mark old-mark t)
(setq this-command 'yank)
(yank)))
(define-key global-map [C-down-mouse-1] 'mouse-drag-region-insert)
(define-key global-map [C-drag-mouse-1] 'mouse-set-region-insert)
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-beta