help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Why function behaves differently when bound to different key combo?


From: Xah Lee
Subject: Re: Why function behaves differently when bound to different key combo?
Date: Fri, 28 Nov 2008 06:00:13 -0800 (PST)
User-agent: G2/1.0

On Nov 27, 8:38 pm, "seber...@spawar.navy.mil"
<seber...@spawar.navy.mil> wrote:
> Normally incremental search can be repeated by pressing C-s multiple
> times.
>
> Why if I remap incremental search to C-f I CANNOT repeat it by
> pressing C-f multiple times?....
>
> Here is how I remapped it...
>
> (global-set-key "\^f" 'isearch-forward)

other mentioned you need to bind isearch-repeart-forward too, but that
won't work if you just bind them to global map, because when you run
isearch, you are technically in isearch mino mode.

Here's what to do. for example, if you want M-s to be isearch, then
do:

(global-set-key (kbd "M-s") 'isearch-forward)
(global-set-key (kbd "M-S") 'isearch-backward)

(add-hook 'isearch-mode-hook
 (lambda ()
 (define-key isearch-mode-map (kbd "M-s") 'isearch-repeat-forward)
 (define-key isearch-mode-map (kbd "M-S") 'isearch-repeat-backward)

 (define-key isearch-mode-map (kbd "M-n") 'forward-char) ; was isearch-
ring-advance
 (define-key isearch-mode-map (kbd "M-p") 'kill-word) ; was isearch-
ring-retreat

 (define-key isearch-mode-map (kbd "M-c") 'previous-line) ; was
isearch-toggle-case-fold
 (define-key isearch-mode-map (kbd "M-r") 'forward-word) ; was isearch-
toggle-regexp
 (define-key isearch-mode-map (kbd "M-e") 'delete-backward-char) ; was
isearch-edit-string

 (define-key isearch-mode-map (kbd "<f11>") 'isearch-ring-retreat)
 (define-key isearch-mode-map (kbd "<f12>") 'isearch-ring-advance)
 )
)

more general guide here:

• How to Define Keyboard Shortcuts in Emacs
  http://xahlee.org/emacs/keyboard_shortcuts.html

• How To Reclaim Keybindings In Emacs
  http://xahlee.org/emacs/ergonomic_emacs_keybinding_minibuffer.html

-----------------

PS when you look into isearch's map, you'll notice that it defines
quite a lot other features/shortcuts. I'd say, 90% of them are never
used once for those who have 4 years of emacs experience . For veteran
emacs diehards, say those who used emacs over 10 years, if i can make
a guess with my 10 years of daily emacs use and observation of other
emacs users, i'd say 50% of the shortcuts provided by isearch are
never used once in their life. These complexity and buried features
should be reorganized. The proper isearch key should be Ctrl+f or Ctrl
+g. That's the universal modern UI standard.

  Xah
∑ http://xahlee.org/

reply via email to

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