emacs-devel
[Top][All Lists]
Advanced

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

Re: New special-mode parent


From: Lennart Borgman (gmail)
Subject: Re: New special-mode parent
Date: Fri, 13 Jun 2008 18:24:15 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

Stefan Monnier wrote:
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)
       map))
(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?


I did not follow the vc discussion, but I like the idea of inherited general key binding sets. Though I am not sure they have to be in the form of a major mode. (Maybe sometimes multiple keymap parents would be useful, but that is another question.)

To me your suggestion here looks good. I would however prefer `special-view-mode'.




reply via email to

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