changeset 96124:48b2db6b4c28

(special-mode-map): New var. (special-mode): New major mode.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 20 Jun 2008 17:10:33 +0000
parents 7742c3c06407
children 673e286487b1
files etc/NEWS lisp/ChangeLog lisp/simple.el
diffstat 3 files changed, 30 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/etc/NEWS	Fri Jun 20 17:08:55 2008 +0000
+++ b/etc/NEWS	Fri Jun 20 17:10:33 2008 +0000
@@ -1241,6 +1241,9 @@
 
 * New Packages for Lisp Programming in Emacs 23.1
 
+** The new major mode `special-mode' is intended as a parent for
+major modes such as those that set the "'mode-class 'special" property.
+
 ** find-cmd.el can build `find' commands using lisp syntax.
 
 ** The package isearch-multi.el has been added.  It implements a new mode
--- a/lisp/ChangeLog	Fri Jun 20 17:08:55 2008 +0000
+++ b/lisp/ChangeLog	Fri Jun 20 17:10:33 2008 +0000
@@ -1,9 +1,14 @@
+2008-06-20  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* simple.el (special-mode-map): New var.
+	(special-mode): New major mode.
+
 2008-06-20  Dan Nicolaescu  <dann@ics.uci.edu>
 
 	* vc.el (vc-dir-hide-up-to-date): Undo previous change.
 	(vc-switch-backend): Simplify.
 	(Todo): Remove solved items.
-	
+
 	* vc-cvs.el (vc-cvs-parse-status, vc-cvs-parse-entry): Do not set
 	the vc-backend property.
 
@@ -14,8 +19,8 @@
 
 2008-06-20  Ulf Jasper  <ulf@web.de>
 
-	* net/newst-treeview.el (newsticker-treeview-own-frame): Changed
-	default value to nil.
+	* net/newst-treeview.el (newsticker-treeview-own-frame):
+	Change default value to nil.
 	(newsticker--treeview-list-add-item)
 	(newsticker--treeview-propertize-tag): Show item title in tooltip.
 
--- a/lisp/simple.el	Fri Jun 20 17:08:55 2008 +0000
+++ b/lisp/simple.el	Fri Jun 20 17:10:33 2008 +0000
@@ -391,6 +391,25 @@
   (unless delay-mode-hooks
     (run-hooks 'after-change-major-mode-hook)))
 
+;; Special major modes to view specially formatted data rather than files.
+
+(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))
+
 ;; Making and deleting lines.
 
 (defvar hard-newline (propertize "\n" 'hard t 'rear-nonsticky '(hard)))