all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Dmitry Gusev'" <dmitry.p.gusev@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: RE: Incremental search don't append wrongly typed characters
Date: Wed, 12 Dec 2012 18:53:30 -0800	[thread overview]
Message-ID: <6CC3ADEF192C4507A44DC3EEDF9DBAFC@us.oracle.com> (raw)
In-Reply-To: <7A0E8A0D76E94C5BBC95EF828DEA4D47@us.oracle.com>

>>> Drew, thanks for the answer. Unfortunately I need a different
>>> behavior in my particular case. I was proposed with similar
>>> work-around also on stack overflow. Though, I'm often using
>>> incremental search for query specific tags in a large text file
>>> which is used like database system with help of some configuration
>>> and scripts. Before each incremental search there is a macro
>>> which places me to BOF and afterwards starts incremental search.
>>> For this scheme it would be very convenient just not to append
>>> mismatched part at all. I understand that it's not that standard
>>> feature and I use different approach when let's say coding or
>>> typing text but again for this particular case I need the
>>> mentioned behavior. It will save me some additional clicks to
>>> backspace and/or c-s  c-g. In other words: I'm  looking for a
>>> way of not showing mismatched characters during incremental search.
>>> Thanks a lot for your time.
>>
>> But I think that what I described: a key that deletes the
>> mismatched portion, might actually solve your problem of
>> searching within a keyboard macro. When defining the macro,
>> you could presumably just hit that key when typing the search
>> string is "done".  If there is no mismatched portion for a
>> given search, then the key would do nothing.
>>
>> However, the interactive part of using your macro wrt
>> searching is not really clear to me. So maybe I'm missing something.
>>
>> Anyway, such a key does not exist yet, but if I get some time
>> I'll try to come up with it. Or perhaps someone else (you?)
>> will beat me to it.  Look in isearch.el for the part of the
>> code that identifies the mismatched portion for highlighting,
>> or the part of `isearch-edit-string' that moves the cursor to the
>> mismatch beginning.  HTH.
>
> Of course, `C-g' removes the mismatch portion. But if there
> is no mismatch portion then it cancels searching, instead of
> being a no-op.

This command removes the mismatch part and is a no-op if there is no mismatch.
 
(defun foo ()
  "..."
  (interactive)
  (while (or (not isearch-success)
             (if (boundp 'isearch-error)
                 isearch-error
               isearch-invalid-regexp))
    (isearch-pop-state))
  (isearch-update))
 
(define-key isearch-mode-map "\C-o" 'foo)




      reply	other threads:[~2012-12-13  2:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12 22:00 Incremental search don't append wrongly typed characters dmgus
2012-12-12 22:14 ` Drew Adams
2012-12-12 22:55   ` Dmitry Gusev
2012-12-12 23:07     ` Drew Adams
2012-12-12 23:54       ` Drew Adams
2012-12-13  2:53         ` Drew Adams [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6CC3ADEF192C4507A44DC3EEDF9DBAFC@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=dmitry.p.gusev@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.