comparison lisp/minibuffer.el @ 106132:57f23ca20a76

* window.el (display-buffer-mark-dedicated): New var. (display-buffer): Obey it. * minibuffer.el (minibuffer-completion-help): Use it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 19 Nov 2009 22:05:40 +0000
parents 4ff55285a1c0
children 0ac473df1bd1
comparison
equal deleted inserted replaced
106131:aef9a4af6024 106132:57f23ca20a76
1002 (- (point) (field-beginning))))) 1002 (- (point) (field-beginning)))))
1003 (message nil) 1003 (message nil)
1004 (if (and completions 1004 (if (and completions
1005 (or (consp (cdr completions)) 1005 (or (consp (cdr completions))
1006 (not (equal (car completions) string)))) 1006 (not (equal (car completions) string))))
1007 (with-output-to-temp-buffer "*Completions*" 1007 (let* ((last (last completions))
1008 (let* ((last (last completions)) 1008 (base-size (cdr last))
1009 (base-size (cdr last))) 1009 ;; If the *Completions* buffer is shown in a new
1010 ;; window, mark it as softly-dedicated, so bury-buffer in
1011 ;; minibuffer-hide-completions will know whether to
1012 ;; delete the window or not.
1013 (display-buffer-mark-dedicated 'soft))
1014 (with-output-to-temp-buffer "*Completions*"
1010 ;; Remove the base-size tail because `sort' requires a properly 1015 ;; Remove the base-size tail because `sort' requires a properly
1011 ;; nil-terminated list. 1016 ;; nil-terminated list.
1012 (when last (setcdr last nil)) 1017 (when last (setcdr last nil))
1013 (setq completions (sort completions 'string-lessp)) 1018 (setq completions (sort completions 'string-lessp))
1014 (when completion-annotate-function 1019 (when completion-annotate-function
1017 (let ((ann 1022 (let ((ann
1018 (funcall completion-annotate-function s))) 1023 (funcall completion-annotate-function s)))
1019 (if ann (list s ann) s))) 1024 (if ann (list s ann) s)))
1020 completions))) 1025 completions)))
1021 (with-current-buffer standard-output 1026 (with-current-buffer standard-output
1022 (set (make-local-variable 'completion-base-position) 1027 (set (make-local-variable 'completion-base-position)
1023 ;; FIXME: We should provide the END part as well, but 1028 ;; FIXME: We should provide the END part as well, but
1024 ;; currently completion-all-completions does not give 1029 ;; currently completion-all-completions does not give
1025 ;; us the necessary information. 1030 ;; us the necessary information.
1026 (list (+ start base-size) nil))) 1031 (list (+ start base-size) nil)))
1027 (display-completion-list completions))) 1032 (display-completion-list completions)))
1028 1033
1029 ;; If there are no completions, or if the current input is already the 1034 ;; If there are no completions, or if the current input is already the
1030 ;; only possible completion, then hide (previous&stale) completions. 1035 ;; only possible completion, then hide (previous&stale) completions.
1031 (minibuffer-hide-completions) 1036 (minibuffer-hide-completions)