Re: Things I miss in GNU Emacs
Thorsten Bonow <[email protected]> Mon, 04 Jan 2016 14:28:24 +0100 (CET)
| Newsgroups | gmane.emacs.xemacs.beta |
|---|---|
| Message-ID | <20160104.142824.1587859702919284437.thorsten.bonow@withouthat.org> |
>>>>> "Mats" == Mats Lidell <[email protected]> writes: [...] Mats> Yes. It does the job. Thanks. Hi Mats, shorter and streamlined version included below. First attempt which I posted from the wrong mail account and was delayed has hit the list now, so my answers are out of sequence. Sry about that. Mats> There is a default binding in GNU Emacs on control left click Mats> that I think is hidden by this version. Maybe it can't be Mats> avoided. [...] By default, control left click is bound to '(mouse-buffer-menu EVENT)' but there is no orthodoxy. If you do use 'msb.el' ("customizable buffer-selection with multiple menus") which is included in GNU Emacs, it is bound to '(msb EVENT)'. Therefor an 'xemacs[-{compat|features}].el' could become part of GNU Emacs and key-binding left up to customisation. Mats> A general observation since many years: With more standard Mats> bindings in GNU Emacs using one modifier together with mouse Mats> click I have moved over my personal bindings to use the combined Mats> control shift modifier together with mouse actions. That binding Mats> seems to be less used. The mouse-track-insert hack works with Mats> that binding as well of course. Thanks again! Because C-S-... is not used be GNU Emacs, I use it for window-management (LarsWM, keyboard driven and tiling window manager). Free key combinations are in short supply on my system... A German keyboard comes to the rescue, I have our funny 'Umlaut' keys for additional bindings :-) Here comes the shorter version. Still doesn't work with multiple frames. Still looking into this. It appears that GNU Emacs doesn't really keeps track of the order of selected frames. And even that may not be enough. Cycling through all frames in search for the thing to copy doesn't imply that I want to yank it in the last frame I looked at before I found the correct one; yanking should be done in the last frame I edited text in, I suppose. So maybe the command should only work in a single frame, but fail gracefully when tried with multiple frames. Toto (defvar old-point 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)) (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)) (let ((mouse-yank-at-point t)) (set-buffer (marker-buffer old-point)) (goto-char old-point) (mouse-yank-at-click click nil))) (define-key global-map [C-down-mouse-1] 'mouse-drag-region-insert) (define-key global-map [C-drag-mouse-1] 'mouse-set-region-insert) -- Sent from my GNU Emacs running on GNU/Linux