From: "Lennart Borgman (gmail)" <lennart.borgman@gmail.com>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
Subject: Re: New special-mode parent
Date: Fri, 13 Jun 2008 18:24:15 +0200 [thread overview]
Message-ID: <48529F2F.7030907@gmail.com> (raw)
In-Reply-To: <jwviqwd1hc3.fsf-monnier+emacs@gnu.org>
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'.
next prev parent reply other threads:[~2008-06-13 16:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-13 15:49 New special-mode parent Stefan Monnier
2008-06-13 16:24 ` Lennart Borgman (gmail) [this message]
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=48529F2F.7030907@gmail.com \
--to=lennart.borgman@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@IRO.UMontreal.CA \
/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.