[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: A search function that skip some characters
From: |
martin-u |
Subject: |
RE: A search function that skip some characters |
Date: |
Sun, 11 Dec 2011 06:47:52 -0800 (PST) |
> 1. I already gave you another idea, off list. What was wrong with it?
This was my answer:
Hello,
"w[.,X]*o[.,X]*r[.,X]d" was just an example. It could be any other "text".
Everytime I give a text like "abc" or "xyz" (as argument for the function)
the special search function should
search "a[.,X]*b[.,X]*c[.,X]*" or "x[.,X]*y[.,X]*z[.,X]*".
But anyway, I have found a solution in your answer.
This was my help:
> (defun foo () (interactive) (insert "[[:word:].,2]+"))
> (define-key minibuffer-local-isearch-map (kbd "M-q") 'foo)
Here's the function
(defun my-search ()
(interactive)
(move-beginning-line 1)
(kill-line)
(setq g (car kill-ring))
(insert (mapconcat (lambda (c) (regexp-quote (string c)))
g "[.,2]*")))
and here's the keybinding:
(define-key minibuffer-local-isearch-map (kbd "M-q") 'my-search)
After C-M-S M-e I write the text I'm searching "text" and then I type M-q. I
get what I want "t[,.2]*e[,.2]*x[,.2]*t".
--
View this message in context:
http://old.nabble.com/A-search-function-that-skip-some-characters-tp32926746p32955446.html
Sent from the Emacs - Dev mailing list archive at Nabble.com.