Xah
∑ http://xahlee.org/
☄
> when i do elisp-index-search, is there a way to make the default
> choice the symbol the cursor is on?
,----
| (defun tv-get-index-at-point ()
| (interactive)
| (let ((expr (thing-at-point 'sexp)))
| (elisp-index-search expr)))
`----
--
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France
(defadvice elisp-index-search (before interactive-default activate)
"Provide the symbol at point as the default when reading TOPIC
interactively."
(interactive (list (read-string "Topic: " nil nil (thing-at-point
'symbol)))))
--
Kevin Rodgers
Denver, Colorado, USA
(defun elisp-index-search+ ()
"Look up TOPIC in the indices of the Emacs Lisp Reference Manual."
(interactive)
(let (topic)
(setq topic (read-string (concat "Subject to look up: ") nil nil (symbol-name (symbol-at-point))))
(funcall 'switch-to-buffer-other-window nil)
(info "elisp")
(Info-index topic)))
Regards.
-- Andy.
Thierry wrote:
,----
| (defun tv-get-index-at-point ()
| (interactive)
| (let ((expr (thing-at-point 'sexp)))
| (elisp-index-search expr)))
`----
among the 3 suggestions, it seems only Thierry's version works for me.
is there a reason why it shouldn't prompt for current symbol? I think
its also useful for describe-function to provide a link to the elisp
manual at bottom. I just filed a bug report btw.
Xah
∑ http://xahlee.org/
☄
No you can have a prompt, (use <arrow down> to display thing-at-point)
,----
| (defun tv-get-index-at-point (expr)
| (interactive
| (list (read-from-minibuffer "Search: "
| nil
| nil
| nil
| nil
| (thing-at-point 'sexp))))
| (elisp-index-search expr))
What happens when you call my version or Andy's version?
Would it be possible to have the thing at point displayed like most
defaults when you call the function? e.g If you hit search in most
editors one would normally see the word at point or region preselected
in the "search" field.
--
I think I should not go far wrong if I asserted that the amount of genuine leisure available in a society is generally in inverse proportion to the amount of labor-saving machinery it employs. ~E.F. Schumacher
it didn't prompt the symbol under cursor. I tried up arrow but i
didn't try down arrow; should've.
I filed a bug report on this issue. I think it should prompt the
symbol under cursor like most other lookup commands such as describe-
function, where the current symbol is shown inside the prompt text.
Xah
∑ http://xahlee.org/
☄
Try moving (thing-at-point 'sexp) from the DEFAULT argument to the
INITIAL-CONTENTS argument, for either read-string or
read-from-minibuffer. Note that the doc string for both functions says
the INITIAL-CONTENTS argument is deprecated.
Yes, <down> would have worked.
> I filed a bug report on this issue. I think it should prompt the
> symbol under cursor like most other lookup commands such as describe-
> function, where the current symbol is shown inside the prompt text.
Ah, to get the conventional prompt:
(defadvice elisp-index-search (before interactive-default activate)
"Provide the symbol at point as the default when reading TOPIC
interactively."
(interactive (let ((symbol-at-point (thing-at-point 'symbol)))
(list (read-string (if symbol-at-point
(format "Topic (%s): " symbol-at-point)
(format "Topic: "))
nil nil symbol-at-point)))))
Your reply to Xah with the default value in the "conventional prompt" did
the job too - thanks.