Mercurial > emacs
changeset 4081:da352b92ca90
(mouse-choose-completion): New function.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 13 Jul 1993 21:33:17 +0000 |
parents | 8200d631e3f3 |
children | 1d4aa358d9a0 |
files | lisp/mouse.el |
diffstat | 1 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/mouse.el Tue Jul 13 21:08:45 1993 +0000 +++ b/lisp/mouse.el Tue Jul 13 21:33:17 1993 +0000 @@ -840,6 +840,29 @@ ;;;!! (- (car relative-coordinate) (current-column)) " ")) ;;;!! ((= (current-column) (car relative-coordinate)) (ding)))))) +;; Choose a completion with the mouse. + +(defun mouse-choose-completion (event) + (interactive "e") + (let (choice) + (save-excursion + (set-buffer (window-buffer (posn-window (event-start event)))) + (save-excursion + (goto-char (posn-point (event-start event))) + (skip-chars-backward "^ \t\n") + (let ((beg (point))) + (skip-chars-forward "^ \t\n") + (setq choice (buffer-substring beg (point)))))) + (save-excursion + (set-buffer (window-buffer (minibuffer-window))) + (goto-char (max (point-min) (- (point-max) (length choice)))) + (while (and (not (eobp)) + (let ((tail (buffer-substring (point) (point-max)))) + (not (string= tail (substring choice 0 (length tail)))))) + (forward-char 1)) + (insert choice) + (delete-region (point) (point-max))))) + ;; Font selection. (defvar x-fixed-font-alist