From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.help Subject: isearch key bindings [was: Why function behaves differently when bound to different key combo?] Date: Fri, 28 Nov 2008 20:54:09 +0000 Message-ID: <20081128205409.GB10822@muc.de> References: <6daf5632-fd9e-4ade-a2d3-b23ca738f9da@r37g2000prr.googlegroups.com> <52652ad0-4657-49d4-ab3e-5066de443801@o40g2000prn.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1227904947 27128 80.91.229.12 (28 Nov 2008 20:42:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 28 Nov 2008 20:42:27 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Xah Lee Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 28 21:43:28 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L6ABP-000885-D0 for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Nov 2008 21:43:23 +0100 Original-Received: from localhost ([127.0.0.1]:39542 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L6AAF-0003WQ-FK for geh-help-gnu-emacs@m.gmane.org; Fri, 28 Nov 2008 15:42:11 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L6A8y-00034w-FU for help-gnu-emacs@gnu.org; Fri, 28 Nov 2008 15:40:52 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L6A8y-00034F-2y for help-gnu-emacs@gnu.org; Fri, 28 Nov 2008 15:40:52 -0500 Original-Received: from [199.232.76.173] (port=60699 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L6A8x-000342-KR for help-gnu-emacs@gnu.org; Fri, 28 Nov 2008 15:40:51 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:4787 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L6A8x-0007zY-1U for help-gnu-emacs@gnu.org; Fri, 28 Nov 2008 15:40:51 -0500 Original-Received: (qmail 58008 invoked by uid 3782); 28 Nov 2008 20:40:38 -0000 Original-Received: from acm.muc.de (pD9E51F18.dip.t-dialin.net [217.229.31.24]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Fri, 28 Nov 2008 21:40:35 +0100 Original-Received: (qmail 11783 invoked by uid 1000); 28 Nov 2008 20:54:09 -0000 Content-Disposition: inline In-Reply-To: <52652ad0-4657-49d4-ab3e-5066de443801@o40g2000prn.googlegroups.com> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.6-4.9 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:60203 Archived-At: 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" > 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 "") 'isearch-ring-retreat) > (define-key isearch-mode-map (kbd "") '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).