Emacs key binding for isearch-forward

I am using Emacs v24.3 on Windows 7. I am trying to learn how to reassign key bindings.

I created a .emacs file in my home directory and contains one line:

(global-set-key (kbd "Cf") 'isearch-forward) 

I am running Emacs using runemacs.exe. I find a nonexistent file, type a few words (click at the beginning of the text) and type CF to find. An I-search: prompt will appear, and I can step by step search for the text. So far so.

The problem is that the behavior should be the same as the default isearch-forward keystroke Cs , it is not. When I type CF second time to search for the next row event, the only thing that happens is the I-search prompt that appears in the minibuffer.

I cannot search for the next line of the line. In addition, the Del key should repeat the search in the opposite direction. This does not happen to me when I perform a search using CF (although this happens when searching using Cs .).

So this one key match seems to break two things. Am I misconfigured? Or are these errors? If I am mistaken, how do I match CF with the isearch-forward command?

+4
source share
2 answers

Along with your one line add:

 (define-key isearch-mode-map "\Cf" 'isearch-repeat-forward) 

The problem is that isearch has its own bindings, which are active after starting an incremental search. Adding the above expression reassigns the binding for isearch-repeat-forward .

If you are interested in these bindings, you can enter Ch b by doing an incremental search to explore the full layout.

+7
source

No, I don’t think what this textbook says. I think you mean the SEARCHING section and this text:

 >> Type Cs again, to search for the next occurrence of "cursor". >> Now type `<DEL>` four times and see how the cursor moves. If you are in the middle of an incremental search and type <DEL>, the search "retreats" to an earlier location. If you type <DEL> just after you had typed Cs to advance to the next occurrence of a search string, the <DEL> moves the cursor back to an earlier occurrence. If there are no earlier occurrences, the `<DEL>` erases the last character in the search string. For instance, suppose you have typed "c", to search for the first occurrence of "c". Now if you type "u", the cursor will move to the first occurrence of "cu". Now type <DEL>. This erases the "u" from the search string, and the cursor moves back to the first occurrence of "c". 

A <DEL> does not search backward. It removes the character from the search string and the search moves to the previous result (only) for the resulting string. But the first <DEL> after Cs does not change the search string. It simply moves to the previous beat (only).

The text of the textbook is not incorrect, although it can be a little difficult to read. If you have a suggestion to improve it, or just want Emacs Dev to know that you find this unclear, use the Mx report-emacs-bug .

0
source

Source: https://habr.com/ru/post/1496268/


All Articles