comparison lisp/minibuffer.el @ 94202:987535788e11

(completion-table-dynamic): Fix typo, and reflow docstring. (completion-setup-hook, display-completion-list, completion--file-name-table): Fix typos in docstrings.
author Juanma Barranquero <lekktu@gmail.com>
date Mon, 21 Apr 2008 00:15:59 +0000
parents 0be1624297ac
children 81b6ecd7be01
comparison
equal deleted inserted replaced
94201:18fdd5bece36 94202:987535788e11
71 string table pred)) 71 string table pred))
72 72
73 (defun completion-table-dynamic (fun) 73 (defun completion-table-dynamic (fun)
74 "Use function FUN as a dynamic completion table. 74 "Use function FUN as a dynamic completion table.
75 FUN is called with one argument, the string for which completion is required, 75 FUN is called with one argument, the string for which completion is required,
76 and it should return an alist containing all the intended possible 76 and it should return an alist containing all the intended possible completions.
77 completions. This alist may be a full list of possible completions so that FUN 77 This alist may be a full list of possible completions so that FUN can ignore
78 can ignore the value of its argument. If completion is performed in the 78 the value of its argument. If completion is performed in the minibuffer,
79 minibuffer, FUN will be called in the buffer from which the minibuffer was 79 FUN will be called in the buffer from which the minibuffer was entered.
80 entered.
81 80
82 The result of the `dynamic-completion-table' form is a function 81 The result of the `dynamic-completion-table' form is a function
83 that can be used as the ALIST argument to `try-completion' and 82 that can be used as the ALIST argument to `try-completion' and
84 `all-completion'. See Info node `(elisp)Programmed Completion'." 83 `all-completions'. See Info node `(elisp)Programmed Completion'."
85 (lexical-let ((fun fun)) 84 (lexical-let ((fun fun))
86 (lambda (string pred action) 85 (lambda (string pred action)
87 (with-current-buffer (let ((win (minibuffer-selected-window))) 86 (with-current-buffer (let ((win (minibuffer-selected-window)))
88 (if (window-live-p win) (window-buffer win) 87 (if (window-live-p win) (window-buffer win)
89 (current-buffer))) 88 (current-buffer)))
565 (defvar completion-setup-hook nil 564 (defvar completion-setup-hook nil
566 "Normal hook run at the end of setting up a completion list buffer. 565 "Normal hook run at the end of setting up a completion list buffer.
567 When this hook is run, the current buffer is the one in which the 566 When this hook is run, the current buffer is the one in which the
568 command to display the completion list buffer was run. 567 command to display the completion list buffer was run.
569 The completion list buffer is available as the value of `standard-output'. 568 The completion list buffer is available as the value of `standard-output'.
570 The common prefix substring for completion may be available as the 569 The common prefix substring for completion may be available as the value
571 value of `completion-common-substring'. See also `display-completion-list'.") 570 of `completion-common-substring'. See also `display-completion-list'.")
572 571
573 (defun display-completion-list (completions &optional common-substring) 572 (defun display-completion-list (completions &optional common-substring)
574 "Display the list of completions, COMPLETIONS, using `standard-output'. 573 "Display the list of completions, COMPLETIONS, using `standard-output'.
575 Each element may be just a symbol or string 574 Each element may be just a symbol or string
576 or may be a list of two strings to be printed as if concatenated. 575 or may be a list of two strings to be printed as if concatenated.
581 properties of `highlight'. 580 properties of `highlight'.
582 At the end, this runs the normal hook `completion-setup-hook'. 581 At the end, this runs the normal hook `completion-setup-hook'.
583 It can find the completion buffer in `standard-output'. 582 It can find the completion buffer in `standard-output'.
584 The optional second arg COMMON-SUBSTRING is a string. 583 The optional second arg COMMON-SUBSTRING is a string.
585 It is used to put faces, `completions-first-difference' and 584 It is used to put faces, `completions-first-difference' and
586 `completions-common-part' on the completion buffer. The 585 `completions-common-part' on the completion buffer. The
587 `completions-common-part' face is put on the common substring 586 `completions-common-part' face is put on the common substring
588 specified by COMMON-SUBSTRING. If COMMON-SUBSTRING is nil 587 specified by COMMON-SUBSTRING. If COMMON-SUBSTRING is nil
589 and the current buffer is not the minibuffer, the faces are not put. 588 and the current buffer is not the minibuffer, the faces are not put.
590 Internally, COMMON-SUBSTRING is bound to `completion-common-substring' 589 Internally, COMMON-SUBSTRING is bound to `completion-common-substring'
591 during running `completion-setup-hook'." 590 during running `completion-setup-hook'."
690 (completion-table-with-context prefix table 689 (completion-table-with-context prefix table
691 (substring string beg) 690 (substring string beg)
692 pred action)))) 691 pred action))))
693 692
694 (defun completion--file-name-table (string dir action) 693 (defun completion--file-name-table (string dir action)
695 "Internal subroutine for read-file-name. Do not call this." 694 "Internal subroutine for `read-file-name'. Do not call this."
696 (setq dir (expand-file-name dir)) 695 (setq dir (expand-file-name dir))
697 (if (and (zerop (length string)) (eq 'lambda action)) 696 (if (and (zerop (length string)) (eq 'lambda action))
698 nil ; FIXME: why? 697 nil ; FIXME: why?
699 (let* ((str (condition-case nil 698 (let* ((str (condition-case nil
700 (substitute-in-file-name string) 699 (substitute-in-file-name string)