* elisp-index-search on current word
@ 2008-10-08 1:31 Xah
2008-10-08 6:07 ` Thierry Volpiatto
` (2 more replies)
0 siblings, 3 replies; 13+ messages in thread
From: Xah @ 2008-10-08 1:31 UTC (permalink / raw
To: help-gnu-emacs
when i do elisp-index-search, is there a way to make the default
choice the symbol the cursor is on?
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: elisp-index-search on current word
2008-10-08 1:31 elisp-index-search on current word Xah
@ 2008-10-08 6:07 ` Thierry Volpiatto
2008-10-08 7:20 ` Kevin Rodgers
[not found] ` <mailman.530.1223450464.25473.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 13+ messages in thread
From: Thierry Volpiatto @ 2008-10-08 6:07 UTC (permalink / raw
To: help-gnu-emacs
Xah <xahlee@gmail.com> writes:
> 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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: elisp-index-search on current word
2008-10-08 1:31 elisp-index-search on current word Xah
2008-10-08 6:07 ` Thierry Volpiatto
@ 2008-10-08 7:20 ` Kevin Rodgers
[not found] ` <mailman.530.1223450464.25473.help-gnu-emacs@gnu.org>
2 siblings, 0 replies; 13+ messages in thread
From: Kevin Rodgers @ 2008-10-08 7:20 UTC (permalink / raw
To: help-gnu-emacs
Xah wrote:
> 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)))))
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: elisp-index-search on current word
[not found] ` <mailman.530.1223450464.25473.help-gnu-emacs@gnu.org>
@ 2008-10-08 14:21 ` Andy Stewart
2008-10-08 16:11 ` Xah
0 siblings, 1 reply; 13+ messages in thread
From: Andy Stewart @ 2008-10-08 14:21 UTC (permalink / raw
To: help-gnu-emacs
Kevin Rodgers <kevin.d.rodgers@gmail.com> writes:
> Xah wrote:
>> 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)))
Regards.
-- Andy.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: elisp-index-search on current word
2008-10-08 14:21 ` Andy Stewart
@ 2008-10-08 16:11 ` Xah
2008-10-08 17:19 ` Thierry Volpiatto
` (3 more replies)
0 siblings, 4 replies; 13+ messages in thread
From: Xah @ 2008-10-08 16:11 UTC (permalink / raw
To: help-gnu-emacs
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? 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/
☄
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: elisp-index-search on current word
2008-10-08 16:11 ` Xah
@ 2008-10-08 17:19 ` Thierry Volpiatto
2008-10-09 2:49 ` Kevin Rodgers
` (2 subsequent siblings)
3 siblings, 0 replies; 13+ messages in thread
From: Thierry Volpiatto @ 2008-10-08 17:19 UTC (permalink / raw
To: help-gnu-emacs
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))
`----
--
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: elisp-index-search on current word
2008-10-08 16:11 ` Xah
2008-10-08 17:19 ` Thierry Volpiatto
@ 2008-10-09 2:49 ` Kevin Rodgers
[not found] ` <mailman.596.1223486652.25473.help-gnu-emacs@gnu.org>
[not found] ` <mailman.646.1223520579.25473.help-gnu-emacs@gnu.org>
3 siblings, 0 replies; 13+ messages in thread
From: Kevin Rodgers @ 2008-10-09 2:49 UTC (permalink / raw
To: help-gnu-emacs
Xah wrote:
> 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.
What happens when you call my version or Andy's version?
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: elisp-index-search on current word
[not found] ` <mailman.596.1223486652.25473.help-gnu-emacs@gnu.org>
@ 2008-10-09 13:54 ` Richard Riley
2008-10-10 2:07 ` Kevin Rodgers
[not found] ` <mailman.751.1223604460.25473.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 13+ messages in thread
From: Richard Riley @ 2008-10-09 13:54 UTC (permalink / raw
To: help-gnu-emacs
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.
--
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
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: elisp-index-search on current word
[not found] ` <mailman.646.1223520579.25473.help-gnu-emacs@gnu.org>
@ 2008-10-09 15:00 ` Xah
2008-10-10 2:18 ` Kevin Rodgers
[not found] ` <mailman.753.1223605127.25473.help-gnu-emacs@gnu.org>
0 siblings, 2 replies; 13+ messages in thread
From: Xah @ 2008-10-09 15:00 UTC (permalink / raw
To: help-gnu-emacs
On Oct 8, 7:49 pm, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> Xah wrote:
> > 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.
>
> What happens when you call my version or Andy's version?
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/
☄
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: elisp-index-search on current word
2008-10-09 13:54 ` Richard Riley
@ 2008-10-10 2:07 ` Kevin Rodgers
[not found] ` <mailman.751.1223604460.25473.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 13+ messages in thread
From: Kevin Rodgers @ 2008-10-10 2:07 UTC (permalink / raw
To: help-gnu-emacs
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.
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: elisp-index-search on current word
2008-10-09 15:00 ` Xah
@ 2008-10-10 2:18 ` Kevin Rodgers
[not found] ` <mailman.753.1223605127.25473.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 13+ messages in thread
From: Kevin Rodgers @ 2008-10-10 2:18 UTC (permalink / raw
To: help-gnu-emacs
Xah wrote:
> On Oct 8, 7:49 pm, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
>> What happens when you call my version or Andy's version?
>
> it didn't prompt the symbol under cursor. I tried up arrow but i
> didn't try down arrow; should've.
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)))))
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: elisp-index-search on current word
[not found] ` <mailman.753.1223605127.25473.help-gnu-emacs@gnu.org>
@ 2008-10-10 2:36 ` Xah
0 siblings, 0 replies; 13+ messages in thread
From: Xah @ 2008-10-10 2:36 UTC (permalink / raw
To: help-gnu-emacs
On Oct 9, 7:18 pm, Kevin Rodgers <kevin.d.rodg...@gmail.com> wrote:
> 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)))))
Thanks! Super.
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: elisp-index-search on current word
[not found] ` <mailman.751.1223604460.25473.help-gnu-emacs@gnu.org>
@ 2008-10-10 8:41 ` Richard Riley
0 siblings, 0 replies; 13+ messages in thread
From: Richard Riley @ 2008-10-10 8:41 UTC (permalink / raw
To: help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2008-10-10 8:41 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-08 1:31 elisp-index-search on current word Xah
2008-10-08 6:07 ` Thierry Volpiatto
2008-10-08 7:20 ` Kevin Rodgers
[not found] ` <mailman.530.1223450464.25473.help-gnu-emacs@gnu.org>
2008-10-08 14:21 ` Andy Stewart
2008-10-08 16:11 ` Xah
2008-10-08 17:19 ` Thierry Volpiatto
2008-10-09 2:49 ` Kevin Rodgers
[not found] ` <mailman.596.1223486652.25473.help-gnu-emacs@gnu.org>
2008-10-09 13:54 ` Richard Riley
2008-10-10 2:07 ` Kevin Rodgers
[not found] ` <mailman.751.1223604460.25473.help-gnu-emacs@gnu.org>
2008-10-10 8:41 ` Richard Riley
[not found] ` <mailman.646.1223520579.25473.help-gnu-emacs@gnu.org>
2008-10-09 15:00 ` Xah
2008-10-10 2:18 ` Kevin Rodgers
[not found] ` <mailman.753.1223605127.25473.help-gnu-emacs@gnu.org>
2008-10-10 2:36 ` Xah
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.