emacs-devel
[Top][All Lists]
Advanced

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

Re: Menu suggestion


From: Kim F. Storm
Subject: Re: Menu suggestion
Date: 30 Apr 2004 19:30:46 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Stefan Monnier <address@hidden> 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 <address@hidden>
;; 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 <address@hidden> http://www.cua.dk





reply via email to

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