emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: A search function that skip some characters


From: Drew Adams
Subject: RE: A search function that skip some characters
Date: Sat, 10 Dec 2011 08:20:43 -0800

> (defun mfun (&optional regexp-p no-recursive-edit)
>   (interactive "P\n")

\n serves no purpose here.
And you don't use arg NO-RECURSIVE-EDIT.

>   (setq str (read-from-minibuffer "Mysearch: "))
>   (insert-before-markers
>    (mapconcat (lambda (c)
>                 (regexp-quote (string c)))
>               str "[.,2]*")))
> 
> I put it into my dot.emacs and it works (but badly). So, if I 
> want to find the all the "t[,.2]*e[,.2]*x[,.2]*t" regexps, I
> call M-x mfun. Then I type "text" into the minibuffer. Then
> mfun put into the normal buffer "t[,.2]*e[,.2]*x[,.2]*t" that
> I have to copy. Then I have to call isearch-forward-regexp
> and put in it minibuffer the copied regexp
> "t[,.2]*e[,.2]*x[,.2]*t". As you see this not a good solution.
> 
> Calling "isearch-forward-regexp" from mfun is not difficult. 
> The problem is that I can't put the REGEXP of "mapconcat" 
> into the minibuffer of isearch-forward-regexp.
> 
> For this I need some help. Or maybe you have another idea?

1. I already gave you another idea, off list.  What was wrong with it?

Put "[[:word:].,2]+" in a register or variable, and insert it after `M-e' during
isearch.

Or define a command to insert it after `M-e':

(defun foo () (interactive) (insert "[[:word:].,2]+"))
(define-key minibuffer-local-isearch-map (kbd "M-q") 'foo)

C-M-s M-e M-q C-s


2. FYI - A better mailing list for this kind of topic (a question about how to
use Emacs or Emacs Lisp) is address@hidden

HTH.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]