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

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

Re: Howto change [enter] behaviour?


From: Kevin Rodgers
Subject: Re: Howto change [enter] behaviour?
Date: Fri, 14 Feb 2003 11:46:07 -0700
User-agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2

Fran├žois Fleuret wrote:

I am writing a major mode to play mp3s (I know something like this
already exists, but mine is simpler and it was more an exercice in
elisp than a real project ... anyway). My only problem so far is how
to change the behaviour of the [enter] key. How am I supposed to do
that ?


Doesn't what you already have work (i.e. call next-line)?  If not, what does
the Enter key do in your mode?


(defun mp3play-mode ()
  "Major mode to play mp3s taken in various directories"
  (interactive)

  (unless mp3play-mode-map
    (setq mp3play-mode-map (make-keymap))
    (suppress-keymap mp3play-mode-map)
    (define-key mp3play-mode-map "n" 'next-line)
    (define-key mp3play-mode-map "p" 'previous-line)
    (define-key mp3play-mode-map "q" 'mp3play-quit)
    (define-key mp3play-mode-map "k" 'mp3play-kill)
    (define-key mp3play-mode-map " " 'mp3play-play)
    (define-key mp3play-mode-map "r" 'mp3play-refresh-list)
    (define-key mp3play-mode-map "s" 'mp3play-stop)
    (define-key mp3play-mode-map "h" 'mp3play-help)
    (define-key mp3play-mode-map "?" 'mp3play-show-properties)
    (define-key mp3play-mode-map "\C-m" 'next-line)
    )

  (kill-all-local-variables)

  (use-local-map mp3play-mode-map)
  (setq mode-name "Mp3play")
  (setq major-mode 'mp3play-mode)
  (run-hooks 'mp3play-mode-hook)

  )


--
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;";>Kevin Rodgers</a>



reply via email to

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