Mercurial > emacs
comparison lisp/mouse.el @ 6548:2b0355912ba6
(mouse-choose-completion): Use choose-completion-string.
(mouse-completion-delete-max-match): Moved to simple.el and renamed.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sun, 27 Mar 1994 22:18:55 +0000 |
parents | 80e3ee8d618d |
children | 0f4c8109274a |
comparison
equal
deleted
inserted
replaced
6547:610cde67456a | 6548:2b0355912ba6 |
---|---|
1203 ;;;!! (- (car relative-coordinate) (current-column)) " ")) | 1203 ;;;!! (- (car relative-coordinate) (current-column)) " ")) |
1204 ;;;!! ((= (current-column) (car relative-coordinate)) (ding)))))) | 1204 ;;;!! ((= (current-column) (car relative-coordinate)) (ding)))))) |
1205 | 1205 |
1206 ;; Choose a completion with the mouse. | 1206 ;; Choose a completion with the mouse. |
1207 | 1207 |
1208 ;; Delete the longest partial match for STRING | |
1209 ;; that can be found before POINT. | |
1210 (defun mouse-delete-max-match (string) | |
1211 (let ((opoint (point)) | |
1212 (len (min (length string) | |
1213 (- (point) (point-min))))) | |
1214 (goto-char (- (point) (length string))) | |
1215 (while (and (> len 0) | |
1216 (let ((tail (buffer-substring (point) | |
1217 (+ (point) len)))) | |
1218 (not (string= tail (substring string 0 len))))) | |
1219 (setq len (1- len)) | |
1220 (forward-char 1)) | |
1221 (delete-char len))) | |
1222 | |
1223 (defun mouse-choose-completion (event) | 1208 (defun mouse-choose-completion (event) |
1224 "Click on an alternative in the `*Completions*' buffer to choose it." | 1209 "Click on an alternative in the `*Completions*' buffer to choose it." |
1225 (interactive "e") | 1210 (interactive "e") |
1226 (let ((buffer (window-buffer)) | 1211 (let ((buffer (window-buffer)) |
1227 choice) | 1212 choice) |
1237 (setq choice (buffer-substring beg (point)))))) | 1222 (setq choice (buffer-substring beg (point)))))) |
1238 (let ((owindow (selected-window))) | 1223 (let ((owindow (selected-window))) |
1239 (select-window (posn-window (event-start event))) | 1224 (select-window (posn-window (event-start event))) |
1240 (bury-buffer) | 1225 (bury-buffer) |
1241 (select-window owindow)) | 1226 (select-window owindow)) |
1242 (set-buffer buffer) | 1227 (choose-completion-string choice buffer))) |
1243 (mouse-delete-max-match choice) | |
1244 (insert choice) | |
1245 ;; Update point in the window that BUFFER is showing in. | |
1246 (let ((window (get-buffer-window buffer t))) | |
1247 (set-window-point window (point))) | |
1248 (and (equal buffer (window-buffer (minibuffer-window))) | |
1249 (minibuffer-complete-and-exit)))) | |
1250 | 1228 |
1251 ;; Font selection. | 1229 ;; Font selection. |
1252 | 1230 |
1253 (defun font-menu-add-default () | 1231 (defun font-menu-add-default () |
1254 (let* ((default (cdr (assq 'font (frame-parameters (selected-frame))))) | 1232 (let* ((default (cdr (assq 'font (frame-parameters (selected-frame))))) |