Article View: gnu.emacs.help
Article #2247port of Zmacs c-middle to GNU Emacs
From: 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)
Technical Details
Message-ID:
<1993Jan28.102511.3252@rulway.LeidenUniv.nl>Path:
arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!olivea!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sun4nl!rulway.LeidenUniv.nl!ruls40.LeidenUniv.nl!desmedtShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!charon.amdahl.com!pacbell.com!decwrl!olivea!spool.mu.edu!yale.edu!ira.uka.de!math.fu-berlin.de!news.netmbx.de!Germany.EU.net!mcsun!sun4nl!rulway.LeidenUniv.nl!ruls40.LeidenUniv.nl!desmedt From: desmedt@ruls40.LeidenUniv.nl (Koenraad de Smedt) Newsgroups: gnu.emacs.help Subject: port of Zmacs c-middle to GNU Emacs Message-ID: <1993Jan28.102511.3252@rulway.LeidenUniv.nl> Date: 28 Jan 93 10:25:11 GMT Sender: root@rulway.LeidenUniv.nl (System PRIVILEGED Account) Reply-To: desmedt@ruls40.LeidenUniv.nl (Koenraad de Smedt) Organization: Leiden University, Netherlands Lines: 39 Nntp-Posting-Host: ruls40.leidenuniv.nl