From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: New special-mode parent Date: Fri, 13 Jun 2008 11:49:08 -0400 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1213372236 20311 80.91.229.12 (13 Jun 2008 15:50:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Jun 2008 15:50:36 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 13 17:51:19 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K7BYR-0007pu-JP for ged-emacs-devel@m.gmane.org; Fri, 13 Jun 2008 17:51:07 +0200 Original-Received: from localhost ([127.0.0.1]:34352 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7BXd-0007eB-JD for ged-emacs-devel@m.gmane.org; Fri, 13 Jun 2008 11:50:17 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K7BXZ-0007dY-Ji for emacs-devel@gnu.org; Fri, 13 Jun 2008 11:50:13 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K7BXX-0007d2-8g for emacs-devel@gnu.org; Fri, 13 Jun 2008 11:50:12 -0400 Original-Received: from [199.232.76.173] (port=59795 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7BXX-0007cz-6T for emacs-devel@gnu.org; Fri, 13 Jun 2008 11:50:11 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:40017) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K7BXW-0002pA-V8 for emacs-devel@gnu.org; Fri, 13 Jun 2008 11:50:11 -0400 Original-Received: from ceviche.home (vpn-132-204-232-131.acd.umontreal.ca [132.204.232.131]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id m5DFo8mA023947 for ; Fri, 13 Jun 2008 11:50:09 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 6C4EDB4088; Fri, 13 Jun 2008 11:49:08 -0400 (EDT) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered HAS_X_HELO=0, RV3037=0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:99116 Archived-At: 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