diff options
author | Richard M. Stallman <rms@gnu.org> | 1993-07-13 21:33:17 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1993-07-13 21:33:17 +0000 |
commit | cf43f6a39868f72337fdbbb6562222d560c420b7 (patch) | |
tree | 7ed64c3d6f246b1cf1ab0405e0838d473fa355dc /lisp | |
parent | aa2d60fca7994a5aefa8913453e0351def62ccb6 (diff) | |
download | emacs-cf43f6a39868f72337fdbbb6562222d560c420b7.tar.gz |
(mouse-choose-completion): New function.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/mouse.el | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index 592d2b79458..868018436fb 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el @@ -840,6 +840,29 @@ and selects that window." ;;;!! (- (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 |