From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lennart Borgman (gmail)" Newsgroups: gmane.emacs.devel Subject: Re: New special-mode parent Date: Fri, 13 Jun 2008 18:24:15 +0200 Message-ID: <48529F2F.7030907@gmail.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1213374282 28167 80.91.229.12 (13 Jun 2008 16:24:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Jun 2008 16:24:42 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 13 18:25:25 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 1K7C5Y-0006aN-M2 for ged-emacs-devel@m.gmane.org; Fri, 13 Jun 2008 18:25:20 +0200 Original-Received: from localhost ([127.0.0.1]:59357 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7C4k-0003J8-Ky for ged-emacs-devel@m.gmane.org; Fri, 13 Jun 2008 12:24:30 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K7C4e-0003I5-T2 for emacs-devel@gnu.org; Fri, 13 Jun 2008 12:24:24 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K7C4d-0003H1-Gk for emacs-devel@gnu.org; Fri, 13 Jun 2008 12:24:24 -0400 Original-Received: from [199.232.76.173] (port=45079 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K7C4d-0003Gy-BD for emacs-devel@gnu.org; Fri, 13 Jun 2008 12:24:23 -0400 Original-Received: from ch-smtp02.sth.basefarm.net ([80.76.149.213]:39767) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1K7C4d-0007PB-2o for emacs-devel@gnu.org; Fri, 13 Jun 2008 12:24:23 -0400 Original-Received: from c83-254-145-59.bredband.comhem.se ([83.254.145.59]:61099 helo=[127.0.0.1]) by ch-smtp02.sth.basefarm.net with esmtp (Exim 4.68) (envelope-from ) id 1K7C4b-0004hS-79; Fri, 13 Jun 2008 18:24:21 +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 In-Reply-To: X-Antivirus: avast! (VPS 080613-0, 2008-06-13), Outbound message X-Antivirus-Status: Clean X-Originating-IP: 83.254.145.59 X-Scan-Result: No virus found in message 1K7C4b-0004hS-79. X-Scan-Signature: ch-smtp02.sth.basefarm.net 1K7C4b-0004hS-79 d464199c644be7ca4a72ecd24892dafc X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) 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:99121 Archived-At: 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'.