Thread View: gnu.emacs.help
1 messages
1 total messages
Started by Koenraad de Smedt
Thu, 28 Jan 1993 10:25
port of Zmacs c-middle to GNU Emacs
Author: Koenraad de Smedt
Date: Thu, 28 Jan 1993 10:25
Date: Thu, 28 Jan 1993 10:25
39 lines
2217 bytes
2217 bytes
I have been trying to port the behavior of the c-middle mouse button
as defined in Zmacs (on Symbolics) to GNU Emacs 18.58 (under Ultrix
with X11).
The functionality I am trying to achieve is the following: when you
click on an S-expression (in any Emacs window), this S-expression will
be immediately inserted at the current point.
The code below achieves exactly this functionality in a one-window
Emacs. However, if in a split-window situation, I click in an Emacs
window other than the one where the point is currently, then the
buffer in the other window is replaced by the current buffer.
Obviously, this is not intended, but I don't understand why it happens
and I don't know how to avoid it. Any suggestions?
(defun x-copy-and-yank-this-s-expression (arg)
"Copy word being clicked on (without changing current point)
and yank at current point."
(save-excursion ;find s-expression being clicked on
(let (beg end)
(x-mouse-set-point arg)
(if (looking-at ")")
(progn (forward-char)(backward-sexp)))
(forward-sexp)
(setq end (point))
(backward-sexp)
(setq beg (point))
(x-store-cut-buffer (buffer-substring beg end))))
(if (not (bolp)) ;provide appropriate white space
(progn (backward-char)
(if (not (looking-at "[ \t]"))
(progn (forward-char)
(insert-string " "))
(forward-char))))
(insert (x-get-cut-buffer)))
(define-key mouse-map x-button-c-middle 'x-copy-and-yank-this-s-expression)
Koenraad de Smedt (Leiden University)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads