summaryrefslogtreecommitdiff
path: root/lisp/mouse.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2009-10-15 01:50:17 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2009-10-15 01:50:17 +0000
commitd5e637154f5084076b1a348155fc68139747acca (patch)
tree8c95bf13b4ca185b32dfa84ab9fe1b409f43632b /lisp/mouse.el
parentb0d6136e736a7c3a843bb56049ed19219312150c (diff)
downloademacs-d5e637154f5084076b1a348155fc68139747acca.tar.gz
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'.
Diffstat (limited to 'lisp/mouse.el')
-rw-r--r--lisp/mouse.el38
1 files changed, 2 insertions, 36 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index 0101cacefbf..9fa5e8cd284 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -2337,43 +2337,9 @@ and selects that window."
;;!! (- (car relative-coordinate) (current-column)) " "))
;;!! ((= (current-column) (car relative-coordinate)) (ding))))))
-;; Choose a completion with the mouse.
+(define-obsolete-function-alias
+ 'mouse-choose-completion 'choose-completion "23.2")
-(defun mouse-choose-completion (event)
- "Click on an alternative in the `*Completions*' buffer to choose it."
- (interactive "e")
- ;; Give temporary modes such as isearch a chance to turn off.
- (run-hooks 'mouse-leave-buffer-hook)
- (let ((buffer (window-buffer))
- choice
- base-size)
- (save-excursion
- (set-buffer (window-buffer (posn-window (event-start event))))
- (if completion-reference-buffer
- (setq buffer completion-reference-buffer))
- (setq base-size completion-base-size)
- (save-excursion
- (goto-char (posn-point (event-start event)))
- (let (beg end)
- (if (and (not (eobp)) (get-text-property (point) 'mouse-face))
- (setq end (point) beg (1+ (point))))
- (if (null beg)
- (error "No completion here"))
- (setq beg (previous-single-property-change beg 'mouse-face))
- (setq end (or (next-single-property-change end 'mouse-face)
- (point-max)))
- (setq choice (buffer-substring-no-properties beg end)))))
- (let ((owindow (selected-window)))
- (select-window (posn-window (event-start event)))
- (if (and (one-window-p t 'selected-frame)
- (window-dedicated-p (selected-window)))
- ;; This is a special buffer's frame
- (iconify-frame (selected-frame))
- (or (window-dedicated-p (selected-window))
- (bury-buffer)))
- (select-window owindow))
- (choose-completion-string choice buffer base-size)))
-
;; Font selection.
(defun font-menu-add-default ()