* Why function behaves differently when bound to different key combo?
@ 2008-11-28 4:38 seberino
2008-11-28 6:22 ` Phil Carmody
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: seberino @ 2008-11-28 4:38 UTC (permalink / raw)
To: help-gnu-emacs
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)
chris
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Why function behaves differently when bound to different key combo?
2008-11-28 4:38 Why function behaves differently when bound to different key combo? seberino
@ 2008-11-28 6:22 ` Phil Carmody
2008-11-28 6:28 ` Andy Stewart
2008-11-28 14:00 ` Xah Lee
2 siblings, 0 replies; 7+ messages in thread
From: Phil Carmody @ 2008-11-28 6:22 UTC (permalink / raw)
To: help-gnu-emacs
"seberino@spawar.navy.mil" <seberino@spawar.navy.mil> writes:
> 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)
"""
C-s runs the command isearch-forward
which is an interactive compiled Lisp function in `isearch.el'.
Do incremental search forward.
With a prefix argument, do an incremental regular expression search instead.
As you type characters, they add to the search string and are found.
The following non-printing keys are bound in `isearch-mode-map'.
"""
And isearch-mode-map contains this:
(19 . isearch-repeat-forward)
(19 is C-s.) So you need to rebind that too.
Phil
--
I tried the Vista speech recognition by running the tutorial. I was
amazed, it was awesome, recognised every word I said. Then I said the
wrong word ... and it typed the right one. It was actually just
detecting a sound and printing the expected word! -- pbhj on /.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Why function behaves differently when bound to different key combo?
2008-11-28 4:38 Why function behaves differently when bound to different key combo? seberino
2008-11-28 6:22 ` Phil Carmody
@ 2008-11-28 6:28 ` Andy Stewart
2008-11-28 14:00 ` Xah Lee
2 siblings, 0 replies; 7+ messages in thread
From: Andy Stewart @ 2008-11-28 6:28 UTC (permalink / raw)
To: help-gnu-emacs
Also binding C-f to `isearch-repeat-forward'.
"seberino@spawar.navy.mil" <seberino@spawar.navy.mil> writes:
> 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)
>
> chris
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Why function behaves differently when bound to different key combo?
2008-11-28 4:38 Why function behaves differently when bound to different key combo? seberino
2008-11-28 6:22 ` Phil Carmody
2008-11-28 6:28 ` Andy Stewart
@ 2008-11-28 14:00 ` Xah Lee
2008-11-28 20:54 ` isearch key bindings [was: Why function behaves differently when bound to different key combo?] Alan Mackenzie
[not found] ` <mailman.1453.1227904853.26697.help-gnu-emacs@gnu.org>
2 siblings, 2 replies; 7+ messages in thread
From: Xah Lee @ 2008-11-28 14:00 UTC (permalink / raw)
To: help-gnu-emacs
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/
☄
^ permalink raw reply [flat|nested] 7+ messages in thread
* isearch key bindings [was: Why function behaves differently when bound to different key combo?]
2008-11-28 14:00 ` Xah Lee
@ 2008-11-28 20:54 ` Alan Mackenzie
[not found] ` <mailman.1453.1227904853.26697.help-gnu-emacs@gnu.org>
1 sibling, 0 replies; 7+ messages in thread
From: Alan Mackenzie @ 2008-11-28 20:54 UTC (permalink / raw)
To: Xah Lee; +Cc: help-gnu-emacs
Well, good evening, Xah!
On Fri, Nov 28, 2008 at 06:00:13AM -0800, Xah Lee wrote:
> 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)
Yes, but why would anybody want M-s to be isearch?
> (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)
> )
> )
If you put that functionality in isearch-mode-hook, you'll rebind these
keys EVERY time you start an isearch. I suppose, with the power of
modern PCs, you won't notice too much, but the cells in the isearch key
map might get a little worn out. :-)
> 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.
I think you're very wrong there. Different users will use different
subsets of them, but do feel free to try to identify those which are
never used. I think you'd be surprised.
> 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.
Emacs UI is good rather than modern. The term "find" is less accurate
than "search", because often the editor fails to find what you're looking
for. But it always searches. C-s is thus more mnemonic.
> Xah
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: isearch key bindings [was: Why function behaves differently when bound to different key combo?]
[not found] ` <mailman.1453.1227904853.26697.help-gnu-emacs@gnu.org>
@ 2008-11-30 2:38 ` Xah Lee
2008-11-30 15:22 ` Kevin Rodgers
0 siblings, 1 reply; 7+ messages in thread
From: Xah Lee @ 2008-11-30 2:38 UTC (permalink / raw)
To: help-gnu-emacs
On Nov 28, 12:54 pm, Alan Mackenzie <a...@muc.de> wrote:
> > (global-set-key (kbd "M-s") 'isearch-forward)
> > (global-set-key (kbd "M-S") 'isearch-backward)
>
> Yes, but why would anybody want M-s to be isearch?
isearch is one of the most frequently used command (roughly within top
15). See:
• Emacs's Command Frequency
http://xahlee.org/emacs/command-frequency.html
under my ergonomic keybinding map, frequently used keys are on home
row. So, isearch is on homerow, and it happens to be on key for the
right pinky. On dvorak, that's s. I pulled the code example from my
map, so that's how it's is s.
• A Ergonomic Keyboard Shortcut Layout For Emacs
http://xahlee.org/emacs/ergonomic_emacs_keybinding.html
> If you put that functionality inisearch-mode-hook, you'll rebind these
> keys EVERY time you start anisearch. I suppose, with the power of
> modern PCs, you won't notice too much, but the cells in theisearchkey
> map might get a little worn out. :-)
Thanks. I haven't thought of that. I'll have to make it minor mode
soon.
> > PS when you look intoisearch'smap, 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 byisearchare
> > never used once in their life.
>
> I think you're very wrong there. Different users will use different
> subsets of them, but do feel free to try to identify those which are
> never used. I think you'd be surprised.
Alan, do you have accumalated more keystroke for the stat?
the best way to objectively find out what commands are actually most
frequently used, is thru the stat program.
If you could, please tell your friends, and other developers on the
emacs list to try the command frequency.el.
http://xahlee.org/emacs/command-frequency.el
when we have a the stat from lots people, then a good look on emacs
keybinding can be had.
Xah
∑ http://xahlee.org/
☄
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: isearch key bindings [was: Why function behaves differently when bound to different key combo?]
2008-11-30 2:38 ` Xah Lee
@ 2008-11-30 15:22 ` Kevin Rodgers
0 siblings, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2008-11-30 15:22 UTC (permalink / raw)
To: help-gnu-emacs
Xah Lee wrote:
> On Nov 28, 12:54 pm, Alan Mackenzie <a...@muc.de> wrote:
>> If you put that functionality inisearch-mode-hook, you'll rebind these
>> keys EVERY time you start anisearch. I suppose, with the power of
>> modern PCs, you won't notice too much, but the cells in theisearchkey
>> map might get a little worn out. :-)
>
> Thanks. I haven't thought of that. I'll have to make it minor mode
> soon.
I think that's overkill, and that Alan was hinting that you could just
move those define-key forms to the top level. (Since isearch is dumped
into the emacs executable, isearch-mode-map is defined at startup.) Or
you could be extra-safe and use eval-after-load.
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-11-30 15:22 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-28 4:38 Why function behaves differently when bound to different key combo? seberino
2008-11-28 6:22 ` Phil Carmody
2008-11-28 6:28 ` Andy Stewart
2008-11-28 14:00 ` Xah Lee
2008-11-28 20:54 ` isearch key bindings [was: Why function behaves differently when bound to different key combo?] Alan Mackenzie
[not found] ` <mailman.1453.1227904853.26697.help-gnu-emacs@gnu.org>
2008-11-30 2:38 ` Xah Lee
2008-11-30 15:22 ` Kevin Rodgers
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).