all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: emacs-devel@gnu.org
Subject: New special-mode parent
Date: Fri, 13 Jun 2008 11:49:08 -0400	[thread overview]
Message-ID: <jwviqwd1hc3.fsf-monnier+emacs@gnu.org> (raw)


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




             reply	other threads:[~2008-06-13 15:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-13 15:49 Stefan Monnier [this message]
2008-06-13 16:24 ` New special-mode parent 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwviqwd1hc3.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.