comparison lisp/international/quail.el @ 105601:68686d39c93a

Replace completion-base-size by completion-base-position to fix bugs such as (bug#4699). * simple.el (completion-base-position): New var. (completion-base-size): Mark as obsolete. (choose-completion): Make it work for mouse events as well. Pass the new base-position to choose-completion-string. (choose-completion-guess-base-position): New function, extracted from choose-completion-delete-max-match. (choose-completion-delete-max-match): Use it. Make obsolete. (choose-completion-string): Use the new base-position info. (completion-root-regexp): Delete. (completion-setup-function): Preserve completion-base-position. Eliminate obsolete base-size manipulation. * minibuffer.el (display-completion-list): Don't mess with base-size. (minibuffer-completion-help): Set completion-base-position instead. * mouse.el (mouse-choose-completion): Redefine as a mere alias to choose-completion. * textmodes/bibtex.el (bibtex-complete): * emacs-lisp/crm.el (crm--choose-completion-string): Adjust to new calling convention. * complete.el (partial-completion-mode): Use minibufferp to avoid bumping into incompatible change to choose-completion-string-functions. * ido.el (ido-choose-completion-string): Make its calling convention more permissive. * comint.el (comint-dynamic-list-input-ring-select): Remove obsolete base-size manipulation. (comint-dynamic-list-input-ring): Use dotimes and push. * iswitchb.el (iswitchb-completion-help): Remove dead-code call to fundamental-mode. Use `or'.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 15 Oct 2009 01:50:17 +0000
parents bfb43cf93581
children 1d1d5d9bd884
comparison
equal deleted inserted replaced
105600:cc9d26f8485b 105601:68686d39c93a
2240 (setq i (1+ i))) 2240 (setq i (1+ i)))
2241 (insert "\n"))))) 2241 (insert "\n")))))
2242 2242
2243 (defun quail-mouse-choose-completion (event) 2243 (defun quail-mouse-choose-completion (event)
2244 "Click on an alternative in the `*Quail Completions*' buffer to choose it." 2244 "Click on an alternative in the `*Quail Completions*' buffer to choose it."
2245 (interactive "e")
2246 ;; This function is an exact copy of the mouse.el function 2245 ;; This function is an exact copy of the mouse.el function
2247 ;; `mouse-choose-completion' except that we: 2246 ;; `mouse-choose-completion' except that we:
2248 ;; 1) add two lines from `choose-completion' in simple.el to give
2249 ;; the `mouse-2' click a little more leeway.
2250 ;; 2) don't bury *Quail Completions* buffer, so comment a section, and 2247 ;; 2) don't bury *Quail Completions* buffer, so comment a section, and
2251 ;; 3) delete/terminate the current quail selection here. 2248 ;; 3) delete/terminate the current quail selection here.
2249 ;; FIXME: Consolidate with `choose-completion'. The point number
2250 ;; 1 has been done, already. The point number 3 should be fairly
2251 ;; easy to move to a choose-completion-string-function. So all
2252 ;; that's left is point number 2.
2253 (interactive "e")
2252 ;; Give temporary modes such as isearch a chance to turn off. 2254 ;; Give temporary modes such as isearch a chance to turn off.
2253 (run-hooks 'mouse-leave-buffer-hook) 2255 (run-hooks 'mouse-leave-buffer-hook)
2254 (let ((buffer (window-buffer)) 2256 (let ((buffer (window-buffer))
2255 choice 2257 choice
2256 base-size) 2258 base-size)
2286 2288
2287 ;; BASE-SIZE here is for compatibility with an (unused) arg of a 2289 ;; BASE-SIZE here is for compatibility with an (unused) arg of a
2288 ;; previous implementation. 2290 ;; previous implementation.
2289 (defun quail-choose-completion-string (choice &optional buffer base-size) 2291 (defun quail-choose-completion-string (choice &optional buffer base-size)
2290 (setq quail-current-str choice) 2292 (setq quail-current-str choice)
2293 ;; FIXME: We need to pass `base-position' here.
2291 (choose-completion-string choice buffer)) 2294 (choose-completion-string choice buffer))
2292 2295
2293 (defun quail-build-decode-map (map-list key decode-map num 2296 (defun quail-build-decode-map (map-list key decode-map num
2294 &optional maxnum ignores) 2297 &optional maxnum ignores)
2295 "Build a decoding map. 2298 "Build a decoding map.