all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to get isearch-string, but only if I was in isearch?
@ 2017-02-12  7:04 Marcin Borkowski
  2017-02-13  1:41 ` Michael Heerdegen
  0 siblings, 1 reply; 4+ messages in thread
From: Marcin Borkowski @ 2017-02-12  7:04 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

Hi all,

I'd like my command to use isearch-string as a default value, but only
if that command was triggered (using M-x, for instance) during isearch.
I tried this naive approach:

(when (memq last-command '(isearch-forward isearch-backward))
  isearch-string)

to no avail, since it turned out that last-command was (in my case)
isearch-printing-char.  Is there a way for an Emacs command to "know"
that isearch was active when it was invoked?  (I could use an approach
similar to the above, but with a longer list of commands, including
most/all things from isearch-mode-map, but this seems fragile and far
from elegant.)

A similar thing to what I want happens with M-% and C-M-% during
isearch, but AFAICT these are just bound to special "wrapper" commands
in isearch-mode-map, and I don't want to have to bind my command to any
key (I use it seldom enough that I just use M-x).

TIA,

--
Marcin Borkowski



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

end of thread, other threads:[~2017-02-18 16:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-12  7:04 How to get isearch-string, but only if I was in isearch? Marcin Borkowski
2017-02-13  1:41 ` Michael Heerdegen
2017-02-13  5:09   ` Marcin Borkowski
2017-02-18 16:10     ` Marcin Borkowski

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.