Skip to content

Commit

Permalink
Use thing-at-point for INITIAL-INPUT not DEFAULT
Browse files Browse the repository at this point in the history
Revert to original behavior.
  • Loading branch information
greghendershott committed Oct 12, 2024
1 parent 75c5fbc commit fba4426
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 27 deletions.
3 changes: 0 additions & 3 deletions doc/racket-mode.texi
Original file line number Diff line number Diff line change
Expand Up @@ -2143,9 +2143,6 @@ the Racket ``Search Manuals'' page.

Search installed documentation; view using @code{racket-describe-mode}.

Tip: Use M-p -- the Emacs ``future history'' feature -- to yank
the symbol at point into the minibuffer.

@node Run
@section Run

Expand Down
45 changes: 21 additions & 24 deletions racket-describe.el
Original file line number Diff line number Diff line change
Expand Up @@ -675,31 +675,28 @@ association list, to look up the path and anchor."
strs)))

(defun racket-describe-search ()
"Search installed documentation; view using `racket-describe-mode'.
Tip: Use M-p -- the Emacs \"future history\" feature -- to yank
the symbol at point into the minibuffer."
"Search installed documentation; view using `racket-describe-mode'."
(interactive)
(when-let (str
(completing-read
"Describe: "
(racket--completion-table
(racket--doc-index)
`((category . ,racket--identifier-category)
(affixation-function . ,#'racket--doc-index-affixator)))
(lambda (v)
(apply racket-doc-index-predicate-function
(get-text-property 0 'racket-affix (car v))))
t ;require-match
nil ;initial-input
nil ;hist
(racket--thing-at-point 'symbol t)))
(pcase (assoc str (racket--doc-index))
(`(,_str ,path ,anchor)
(racket--do-describe (cons (racket-file-name-back-to-front path)
anchor)
nil
(substring-no-properties str))))))
(let ((collection (racket--completion-table
(racket--doc-index)
`((category . ,racket--identifier-category)
(affixation-function . ,#'racket--doc-index-affixator))))
(predicate (lambda (v)
(apply racket-doc-index-predicate-function
(get-text-property 0 'racket-affix (car v)))))
(require-match t)
(initial-input (racket--thing-at-point 'symbol t)))
(when-let (str (completing-read "Describe: "
collection
predicate
require-match
initial-input))
(pcase (assoc str (racket--doc-index))
(`(,_str ,path ,anchor)
(racket--do-describe (cons (racket-file-name-back-to-front path)
anchor)
nil
(substring-no-properties str)))))))

(provide 'racket-describe)

Expand Down

0 comments on commit fba4426

Please sign in to comment.