[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: elisp-index-search on current word
From: |
Richard Riley |
Subject: |
Re: elisp-index-search on current word |
Date: |
Fri, 10 Oct 2008 10:41:30 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:
> Richard Riley wrote:
>> Thierry Volpiatto <thierry.volpiatto@gmail.com> writes:
>>
>>> Xah <xahlee@gmail.com> writes:
>>>
>>>> On Oct 8, 7:21 am, Andy Stewart <lazycat.mana...@gmail.com> wrote:
>>>>> Kevin Rodgers <kevin.d.rodg...@gmail.com> writes:
>>>>>> Xahwrote:
>>>>>>> when i do elisp-index-search, is there a way to make the default
>>>>>>> choice the symbol the cursor is on?
>>>>>> (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)))))
>>>>> (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)))
>>>> 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?
>>> 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))
>>> `----
>>
>> 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.
>
> 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.
Your reply to Xah with the default value in the "conventional prompt" did
the job too - thanks.
- elisp-index-search on current word, Xah, 2008/10/07
- Re: elisp-index-search on current word, Thierry Volpiatto, 2008/10/08
- Re: elisp-index-search on current word, Kevin Rodgers, 2008/10/08
- Message not available
- Re: elisp-index-search on current word, Andy Stewart, 2008/10/08
- Re: elisp-index-search on current word, Xah, 2008/10/08
- Re: elisp-index-search on current word, Thierry Volpiatto, 2008/10/08
- Re: elisp-index-search on current word, Kevin Rodgers, 2008/10/08
- Message not available
- Re: elisp-index-search on current word, Richard Riley, 2008/10/09
- Re: elisp-index-search on current word, Kevin Rodgers, 2008/10/09
- Message not available
- Re: elisp-index-search on current word,
Richard Riley <=
- Message not available
- Re: elisp-index-search on current word, Xah, 2008/10/09
- Re: elisp-index-search on current word, Kevin Rodgers, 2008/10/09
- Message not available
- Re: elisp-index-search on current word, Xah, 2008/10/09