all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Use text in emacs buffer to populate command window
@ 2013-02-18 18:25 acomber
  2013-02-18 18:37 ` Jambunathan K
  2013-02-18 18:41 ` Drew Adams
  0 siblings, 2 replies; 6+ messages in thread
From: acomber @ 2013-02-18 18:25 UTC (permalink / raw)
  To: Help-gnu-emacs

If I run a search in emacs I can C-s then c-w repeatedly to search for text
under the current cursor position.  But if I use a diffierent command I
can't always use C-w.  eg I use m-x highlight-regexp I want to also grab the
text under the cursor.  How do I do that?  



--
View this message in context: http://emacs.1067599.n5.nabble.com/Use-text-in-emacs-buffer-to-populate-command-window-tp278645.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Use text in emacs buffer to populate command window
  2013-02-18 18:25 Use text in emacs buffer to populate command window acomber
@ 2013-02-18 18:37 ` Jambunathan K
  2013-02-18 18:43   ` Jambunathan K
  2013-02-18 18:47   ` acomber
  2013-02-18 18:41 ` Drew Adams
  1 sibling, 2 replies; 6+ messages in thread
From: Jambunathan K @ 2013-02-18 18:37 UTC (permalink / raw)
  To: acomber; +Cc: Help-gnu-emacs

acomber <deedexy@gmail.com> writes:

> eg I use m-x highlight-regexp I want to also grab the
> text under the cursor.  How do I do that?  

Have you tried M-n when you see the prompt?

This is some command most don't know about or don't use when
prompted. (I know I shouldn't be talking for others) When Emacs prompts
for something in the minibuffer, it almost always provides NOT A SINGLE
DEFAULT BUT MULTIPLE DEFAULTS.  And you can run through the other
defaults using M-n.

When I highlight, I almost always highlight the "thing" at point.
highlight-regepx provides (car regexp-history).  This option baffles and
and I cannot simply relate to how this default could be a useful
default.  

I would like to change this behaviour.  This is one of my pet peeves.
It is in my list of things to do wrt highlight-regexp.  In Emacs 24.4,
there is a way to highlight symbol at point in a easy way.  This most
likely suffices for highlighting the word at point also.  May be I will
add word at point to the defaults.
-- 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Use text in emacs buffer to populate command window
  2013-02-18 18:25 Use text in emacs buffer to populate command window acomber
  2013-02-18 18:37 ` Jambunathan K
@ 2013-02-18 18:41 ` Drew Adams
  1 sibling, 0 replies; 6+ messages in thread
From: Drew Adams @ 2013-02-18 18:41 UTC (permalink / raw)
  To: 'acomber', Help-gnu-emacs

> If I run a search in emacs I can C-s then c-w repeatedly to 
> search for text under the current cursor position.  But if I use
> a diffierent command I can't always use C-w.  eg I use m-x
> highlight-regexp I want to also grab the text under the cursor.
> How do I do that?  

If the command itself doesn't provide something at point as a default value
(retrievable using `M-n') then you're out of luck at that point.

But:

1. You can of course select the text you want to inser first, before invoking
the command that reads input, then use `C-y' when the command prompts you for
input.

2. If you use Icicles, then you can _always_ grab text at or near the cursor and
insert it in the minibuffer, using `M-.'.

http://www.emacswiki.org/emacs/Icicles_-_Inserting_Text_from_Cursor

You can configure what `M-.' does, including what kinds of things it can insert
and whether successive `M-.' should insert successive things of the same kind
(like `C-w' does for Isearch) or cycle among different kinds of thing.




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Use text in emacs buffer to populate command window
  2013-02-18 18:37 ` Jambunathan K
@ 2013-02-18 18:43   ` Jambunathan K
  2013-02-18 18:47   ` acomber
  1 sibling, 0 replies; 6+ messages in thread
From: Jambunathan K @ 2013-02-18 18:43 UTC (permalink / raw)
  To: acomber; +Cc: Help-gnu-emacs

Jambunathan K <kjambunathan@gmail.com> writes:

> acomber <deedexy@gmail.com> writes:
>
>> eg I use m-x highlight-regexp I want to also grab the
>> text under the cursor.  How do I do that?  
>
> Have you tried M-n when you see the prompt?
>
> This is some command most don't know about or don't use when
> prompted. (I know I shouldn't be talking for others) When Emacs prompts
> for something in the minibuffer, it almost always provides NOT A SINGLE
> DEFAULT BUT MULTIPLE DEFAULTS.  And you can run through the other
> defaults using M-n.
>
> When I highlight, I almost always highlight the "thing" at point.
> highlight-regepx provides (car regexp-history).  This option baffles and
> and I cannot simply relate to how this default could be a useful
> default.  

I think I should go to bed now.  My stream of consciousness is drifting
and is now flowing in to the dreams :-). Read the above paragraph as
below.

When I highlight, I almost always highlight the "thing" at point.
highlight-regepx provides (car regexp-history) as the first default.
This choice of default baffles me. (I hate Isearch and stay away from
regexp search as much as possible) and I cannot simply relate to how
this default could be a useful default.

>
> I would like to change this behaviour.  This is one of my pet peeves.
> It is in my list of things to do wrt highlight-regexp.  In Emacs 24.4,
> there is a way to highlight symbol at point in a easy way.  This most
> likely suffices for highlighting the word at point also.  May be I will
> add word at point to the defaults.

-- 



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Use text in emacs buffer to populate command window
  2013-02-18 18:37 ` Jambunathan K
  2013-02-18 18:43   ` Jambunathan K
@ 2013-02-18 18:47   ` acomber
  2013-02-18 18:54     ` Drew Adams
  1 sibling, 1 reply; 6+ messages in thread
From: acomber @ 2013-02-18 18:47 UTC (permalink / raw)
  To: Help-gnu-emacs

Thanks for the tip about m-n.  I have used m-p in the past - so should have
thought of that.

But a problem I have is eg if I have marked the text:
xyzfunction returned true

Then use m-x highlight-regexp

then m-n (or m-p) I can cycle through the history (which is good) but for
the current selection for some reason I only get the last word - true. 
Would be great to get all text I selected.  Any ideas?



--
View this message in context: http://emacs.1067599.n5.nabble.com/Use-text-in-emacs-buffer-to-populate-command-window-tp278645p278652.html
Sent from the Emacs - Help mailing list archive at Nabble.com.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Use text in emacs buffer to populate command window
  2013-02-18 18:47   ` acomber
@ 2013-02-18 18:54     ` Drew Adams
  0 siblings, 0 replies; 6+ messages in thread
From: Drew Adams @ 2013-02-18 18:54 UTC (permalink / raw)
  To: 'acomber', Help-gnu-emacs

> But a problem I have is eg if I have marked the text:
> xyzfunction returned true Then use m-x highlight-regexp
> then m-n (or m-p) I can cycle through the history (which is 
> good) but for the current selection for some reason I only
> get the last word - true.  Would be great to get all text
> I selected.  Any ideas?

How are you getting it?  Did you try `C-y'?  (You need to use `M-w' first, to
put the selected text in the kill ring.)




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-02-18 18:54 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-18 18:25 Use text in emacs buffer to populate command window acomber
2013-02-18 18:37 ` Jambunathan K
2013-02-18 18:43   ` Jambunathan K
2013-02-18 18:47   ` acomber
2013-02-18 18:54     ` Drew Adams
2013-02-18 18:41 ` Drew Adams

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.