* Incremental search don't append wrongly typed characters @ 2012-12-12 22:00 dmgus 2012-12-12 22:14 ` Drew Adams 0 siblings, 1 reply; 6+ messages in thread From: dmgus @ 2012-12-12 22:00 UTC (permalink / raw) To: help-gnu-emacs Hi all, How can I change this behaviour: Start incremental search and search for "keyz" The "keyz" is displayed in the search echo area and the "key" part in "keywords" is higlighted Type "s" "keys" won't be found, the cursor stays on the "keywords" line, search echo area displays "keyzs", which is not convenient to that one: Start incremental search and search for "keyz" The "key" is displayed in the search echo area and the "key" part in "keywords" is higlighted Press s "keys" is found and highlited Although I understand that it's not usual behavior and won't be of help for everybody, it's still very interesting how to do it. Will appreciate for any help on this subject. I've already asked this question on stack overflow though don't have an answer: http://stackoverflow.com/questions/12099760/emacs-incremental-search-auto-remove-from-the-search-string-the-characters-tha Thanks, Dmitry ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Incremental search don't append wrongly typed characters 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 0 siblings, 1 reply; 6+ messages in thread From: Drew Adams @ 2012-12-12 22:14 UTC (permalink / raw) To: 'dmgus', help-gnu-emacs > How can I [get] this behaviour: > Start incremental search and search for "keyz" > "key" is displayed in the search echo area and the "key" > part in "keywords" is higlighted > Press s > "keys" is found and highlited I don't have an answer for you, but the suggestion is an interesting one. A variant that could be useful (which I also don't have a recipe for): Type `keyz'. The `z' is highlighted as a mismatch (this is already available). Hit a key to delete the mismatched part (in this case, just `z'. Type `s' and continue. When I introduced highlighting of the mismatch part, I took it from Icicles highlighting of completion input mismatch. There, you can hit `C-l' twice to remove the mismatched part. (The first `C-l' just moves the cursor to the mismatch beginning, so you can insert there.) In Isearch there is no equivalent - no key that removes the mismatched part. Maybe I'll add that possibility. What you can do is hit `M-e', which puts you in editing mode and moves the cursor to the mismatch beginning. Then hit `C-k' to kill the mismatch portion, then `C-s' to resume searching. So `M-e C-k C-s'. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Incremental search don't append wrongly typed characters 2012-12-12 22:14 ` Drew Adams @ 2012-12-12 22:55 ` Dmitry Gusev 2012-12-12 23:07 ` Drew Adams 0 siblings, 1 reply; 6+ messages in thread From: Dmitry Gusev @ 2012-12-12 22:55 UTC (permalink / raw) To: Drew Adams; +Cc: help-gnu-emacs [-- Attachment #1: Type: text/plain, Size: 2175 bytes --] 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. On Thu, Dec 13, 2012 at 2:14 AM, Drew Adams <drew.adams@oracle.com> wrote: > > How can I [get] this behaviour: > > Start incremental search and search for "keyz" > > "key" is displayed in the search echo area and the "key" > > part in "keywords" is higlighted > > Press s > > "keys" is found and highlited > > I don't have an answer for you, but the suggestion is an interesting one. > > A variant that could be useful (which I also don't have a recipe for): > > Type `keyz'. > The `z' is highlighted as a mismatch (this is already available). > Hit a key to delete the mismatched part (in this case, just `z'. > Type `s' and continue. > > When I introduced highlighting of the mismatch part, I took it from Icicles > highlighting of completion input mismatch. There, you can hit `C-l' twice > to > remove the mismatched part. (The first `C-l' just moves the cursor to the > mismatch beginning, so you can insert there.) > > In Isearch there is no equivalent - no key that removes the mismatched > part. > Maybe I'll add that possibility. What you can do is hit `M-e', which puts > you > in editing mode and moves the cursor to the mismatch beginning. Then hit > `C-k' > to kill the mismatch portion, then `C-s' to resume searching. So `M-e C-k > C-s'. > > [-- Attachment #2: Type: text/html, Size: 2636 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Incremental search don't append wrongly typed characters 2012-12-12 22:55 ` Dmitry Gusev @ 2012-12-12 23:07 ` Drew Adams 2012-12-12 23:54 ` Drew Adams 0 siblings, 1 reply; 6+ messages in thread From: Drew Adams @ 2012-12-12 23:07 UTC (permalink / raw) To: 'Dmitry Gusev'; +Cc: help-gnu-emacs [-- Attachment #1: Type: text/plain, Size: 2998 bytes --] I don't have a better answer for you - perhaps someone else does. 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. 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. On Thu, Dec 13, 2012 at 2:14 AM, Drew Adams <drew.adams@oracle.com> wrote: > How can I [get] this behaviour: > Start incremental search and search for "keyz" > "key" is displayed in the search echo area and the "key" > part in "keywords" is higlighted > Press s > "keys" is found and highlited I don't have an answer for you, but the suggestion is an interesting one. A variant that could be useful (which I also don't have a recipe for): Type `keyz'. The `z' is highlighted as a mismatch (this is already available). Hit a key to delete the mismatched part (in this case, just `z'. Type `s' and continue. When I introduced highlighting of the mismatch part, I took it from Icicles highlighting of completion input mismatch. There, you can hit `C-l' twice to remove the mismatched part. (The first `C-l' just moves the cursor to the mismatch beginning, so you can insert there.) In Isearch there is no equivalent - no key that removes the mismatched part. Maybe I'll add that possibility. What you can do is hit `M-e', which puts you in editing mode and moves the cursor to the mismatch beginning. Then hit `C-k' to kill the mismatch portion, then `C-s' to resume searching. So `M-e C-k C-s'. [-- Attachment #2: Type: text/html, Size: 5133 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Incremental search don't append wrongly typed characters 2012-12-12 23:07 ` Drew Adams @ 2012-12-12 23:54 ` Drew Adams 2012-12-13 2:53 ` Drew Adams 0 siblings, 1 reply; 6+ messages in thread From: Drew Adams @ 2012-12-12 23:54 UTC (permalink / raw) To: 'Dmitry Gusev'; +Cc: help-gnu-emacs [-- Attachment #1: Type: text/plain, Size: 1853 bytes --] 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. 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. 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. [-- Attachment #2: Type: text/html, Size: 3593 bytes --] ^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: Incremental search don't append wrongly typed characters 2012-12-12 23:54 ` Drew Adams @ 2012-12-13 2:53 ` Drew Adams 0 siblings, 0 replies; 6+ messages in thread From: Drew Adams @ 2012-12-13 2:53 UTC (permalink / raw) To: 'Dmitry Gusev'; +Cc: help-gnu-emacs >>> 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) ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-12-13 2:53 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 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 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).