unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* New special-mode parent
@ 2008-06-13 15:49 Stefan Monnier
  2008-06-13 16:24 ` Lennart Borgman (gmail)
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Stefan Monnier @ 2008-06-13 15:49 UTC (permalink / raw)
  To: emacs-devel


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?


        Stefan




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-06-14 21:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-13 15:49 New special-mode parent Stefan Monnier
2008-06-13 16:24 ` Lennart Borgman (gmail)
2008-06-13 16:56 ` Tom Tromey
2008-06-13 17:51   ` Stefan Monnier
2008-06-14 20:03     ` Tom Tromey
2008-06-14 21:46       ` Stefan Monnier
2008-06-13 18:25 ` Dan Nicolaescu
2008-06-13 21:52   ` Stefan Monnier
2008-06-14 11:27     ` Juanma Barranquero

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).