[Top][All Lists]

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

New special-mode parent

From: Stefan Monnier
Subject: New special-mode parent
Date: Fri, 13 Jun 2008 11:49:08 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

While thinking about the key-binding problems we have in vc-annotate it
occurred to me that it should use a view-mode minor mode, but rather it
should inherit from a sort of view-mode major mode, so it can override
its key-bindings.  And it occurred to me that it should be called
`special-mode' and should probably be used by most "special" major modes
(those that set the mode-class property to `special').

So I'm considering adding to subr.el a simple parent major mode:

   (defvar special-mode-map
     (let ((map (make-sparse-keymap)))
       (suppress-keymap map)
       (define-key map "q" 'quit-window)
       (define-key map " " 'scroll-up)
       (define-key map "\C-?" 'scroll-down)
       (define-key map "?" 'describe-mode)
       (define-key map ">" 'end-of-buffer)
       (define-key map "<" 'beginning-of-buffer)
       (define-key map "g" 'revert-buffer)
   (put 'special-mode 'mode-class 'special)
   (define-derived-mode special-mode nil "Special"
     "Parent major mode from which special major modes should inherit."
     (setq buffer-read-only t))

The above is 100% guaranteed thoroughly untested (written directly in
this *mail* buffer), so it's just a rough approximation, but should give
you some idea of where I'm going.

Any comment?


reply via email to

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