From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Menu suggestion Date: 30 Apr 2004 19:30:46 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: References: <877jw1r9i8.fsf@peder.flower> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1083354030 32314 80.91.224.253 (30 Apr 2004 19:40:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 30 Apr 2004 19:40:30 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Fri Apr 30 21:40:15 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BJdrq-0006zI-00 for ; Fri, 30 Apr 2004 21:40:14 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BJdrp-0002p5-00 for ; Fri, 30 Apr 2004 21:40:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BJdpE-0000yN-RP for emacs-devel@quimby.gnus.org; Fri, 30 Apr 2004 15:37:32 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BJdol-0000ip-GP for emacs-devel@gnu.org; Fri, 30 Apr 2004 15:37:03 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BJdo9-0000Pq-Tu for emacs-devel@gnu.org; Fri, 30 Apr 2004 15:36:57 -0400 Original-Received: from [195.41.46.235] (helo=pfepa.post.tele.dk) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BJdjY-0007HY-2O for emacs-devel@gnu.org; Fri, 30 Apr 2004 15:31:40 -0400 Original-Received: from kfs-l.imdomain.dk.cua.dk (0x503e2644.bynxx3.adsl-dhcp.tele.dk [80.62.38.68]) by pfepa.post.tele.dk (Postfix) with SMTP id 60E5A47FE6C; Fri, 30 Apr 2004 21:31:31 +0200 (CEST) Original-To: Stefan Monnier In-Reply-To: Original-Lines: 114 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:22461 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:22461 Stefan Monnier writes: > > Today I mostly use the arrow keys. > > I started with arrow keys and nowadays I still mostly use arrow keys. I use them too -- and I even have alternate bindings on C-f and C-b to commands which do the same as vi's f and b commands *), and CUA-mode remaps C-v and M-v. But I do use C-n and C-p (quite often), but mostly to scroll through minibuffer history... It seems that a good part of the emacs developers don't actually use the emacs bindings -- so how can we expect our users to learn them ? *) Here is my find-char functions: ;;; find-char.el --- find character forward/backward ;; Copyright (C) 1998, 2004 Free Software Foundation, Inc. ;; Author: Kim F. Storm ;; Keywords: keyboard navigation ;; Revision: 1.2 ;; This file is [not yet] part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 2, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. ;;; Commentary: ;; This is the find-char package which allow fast movement to a specific ;; character in the text, similar to the 'f' and 'b' commands in vi. ;; ;; Since the forward and backward char commands are bound to the right ;; and left arrow keys, the C-f and C-b keys are readily available for ;; binding these commands: ;; ;; (global-set-key "\C-b" 'find-char-backward) ;; (global-set-key "\C-f" 'find-char-forward) ;; ;; If the C-f or C-b is repeated immediately after the previous C-f or C-b ;; command, the command moves point to the next/prev occurrence of the same ;; character. ;; ;; For example, to move point to the third next 'x' in the text, simply ;; enter C-f x C-f C-f (or M-3 C-f x) (provide 'find-char) (defvar find-char-last-ok nil) (defvar find-char-last-char ? ) ;;;###autoload (defun find-char-forward (count &optional backward) "Find COUNT'th forward occurrence of character read from minibuffer. If command is repeated immediately, move to next occurrence of same character." (interactive "p") (let ((case-fold-search nil) (char (if (and (> count 0) (or (and find-char-last-ok (eq last-command this-command)) (eq last-command (if backward 'find-char-forward 'find-char-backward)))) find-char-last-char (message "Find character %sward (%c): " (if backward "back" "for") find-char-last-char) (read-char)))) (if (/= char last-command-char) ; C-f C-f repeats last search. (setq find-char-last-char char)) (setq count (if (> 0 count) (- count) (if (= 0 count) 1 count))) (if (setq find-char-last-ok (if backward (progn (backward-char) (or (eq (char-after (point)) find-char-last-char) (search-backward (char-to-string find-char-last-char) nil t count) (forward-char))) (forward-char) (or (eq (char-after (point)) find-char-last-char) (if (search-forward (char-to-string find-char-last-char) nil t count) (progn (backward-char) t)) (backward-char)))) t (ding) (message "%c not found" find-char-last-char)) )) ;;;###autoload (defun find-char-backward (count) "Find COUNT'th backward occurrence of character read from minibuffer. If command is repeated immediately, move to previous occurrence of same character." (interactive "p") (find-char-forward count t)) -- Kim F. Storm http://www.cua.dk