(get sym prop)))
(format "with property %s" prop))))
+(defun help--symbol-narrow-by-file ()
+ (let ((file (completing-read "Symbol file: "
+ (mapcar #'file-name-base (mapcar #'car load-history)))))
+ (cons (lambda (cand &rest _)
+ (let ((sym (if (symbolp cand) cand
+ (intern (if (stringp cand) cand (car cand))))))
+ (when-let ((sf (symbol-file sym)))
+ (equal file (file-name-base sf)))))
+ (format "file=%s" file))))
+
(defun help--symbol-completion-table (string pred action)
(if (eq action 'metadata)
`(metadata
,@(when completions-detailed
'((affixation-function . help--symbol-completion-table-affixation)))
(category . symbol-help)
- (narrow-completions-function . help--symbol-narrow-by-property))
+ (sort-function . minibuffer-sort-alphabetically)
+ (narrow-completions-function
+ . ((?p "property" "Symbol property" help--symbol-narrow-by-property)
+ (?f "file" "Symbol file" help--symbol-narrow-by-file))))
(when help-enable-completion-autoload
(let ((prefixes (radix-tree-prefixes (help-definition-prefixes) string)))
(help--load-prefixes prefixes)))
(interactive "" minibuffer-mode)
(let* ((enable-recursive-minibuffers t)
(filter-desc
- (funcall (or (completion-metadata-get
- (completion--field-metadata (minibuffer-prompt-end))
- 'narrow-completions-function)
- minibuffer-narrow-completions-function))))
+ (funcall
+ (or (when-let ((fun (completion-metadata-get
+ (completion--field-metadata
+ (minibuffer-prompt-end))
+ 'narrow-completions-function)))
+ (if (functionp fun) fun
+ (nth 3 (read-multiple-choice "Narrow completions by:" fun))))
+ minibuffer-narrow-completions-function))))
(minibuffer--add-completions-predicate (car filter-desc) (cdr filter-desc))))
(defun minibuffer-narrow-completions-by-regexp ()