* Search function that ignores some characters
@ 2011-12-09 19:09 tony-au
2011-12-09 19:34 ` Drew Adams
0 siblings, 1 reply; 2+ messages in thread
From: tony-au @ 2011-12-09 19:09 UTC (permalink / raw)
To: Emacs-devel
Hello,
I would like to implement a search function that ignores some characters
(like these
characters { '.', ',' , 'X'}). So if I search "word", the function should
not
only find "word" but also "wor.d", "wo,rd.", "w,,o..X,r..d", and so
on. That means I want to search w[.,X]*o[.,X]*r[.,X]d as a regexp.
The function my-regexp produces the regexp and insert it into the buffer
(defun my-regexp (&optional regexp-p no-recursive-edit)
(interactive "P\n")
(setq str (read-from-minibuffer
"the word: "))
(insert-before-markers
(mapconcat (lambda (c) (regexp-quote (string c))) str "[.,X]*"))
)
But then I have to kill the produced regexp from the buffer and insert it
into the minibuffer of "C-M-s" (Regexp I-search).
This is not really comfortable. How can directly insert the regexp (in the
example: w[.,X]*o[.,X]*r[.,X]d) into the minibuffer of (Regexp I-search)?
--
View this message in context: http://old.nabble.com/Search-function-that-ignores-some-characters-tp32944985p32944985.html
Sent from the Emacs - Dev mailing list archive at Nabble.com.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-09 19:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-09 19:09 Search function that ignores some characters tony-au
2011-12-09 19:34 ` Drew Adams
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).