# HG changeset patch # User Richard M. Stallman # Date 742599197 0 # Node ID da352b92ca90c4d820268de40e1ececda1833386 # Parent 8200d631e3f332d478d733e8b9ffa1dd82561e55 (mouse-choose-completion): New function. diff -r 8200d631e3f3 -r da352b92ca90 lisp/mouse.el --- 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