home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.emacs
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!agate!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)
- Subject: port of Zmacs c-middle to GNU Emacs
- Message-ID: <1993Jan28.102735.3343@rulway.LeidenUniv.nl>
- Sender: root@rulway.LeidenUniv.nl (System PRIVILEGED Account)
- Nntp-Posting-Host: ruls40.leidenuniv.nl
- Reply-To: desmedt@ruls40.LeidenUniv.nl (Koenraad de Smedt)
- Organization: Leiden University, Netherlands
- Date: Thu, 28 Jan 93 10:27:35 GMT
- Lines: 39
-
- 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)
-