From b2a15250f652d800838f66abc1f877f0cad0d323 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 19 Aug 2010 01:25:36 +0200 Subject: [PATCH] * lisp/simple.el (prog-mode-map): New var. (prog-indent-sexp): New command. --- lisp/ChangeLog | 3 +++ lisp/simple.el | 13 +++++++++++++ 2 files changed, 16 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c56f069eba5..ce5baa1b1a1 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2010-08-18 Stefan Monnier + * simple.el (prog-mode-map): New var. + (prog-indent-sexp): New command. + * progmodes/octave-mod.el (octave-mode-menu): Make toggle buttons. * progmodes/prolog.el (smie): Require. diff --git a/lisp/simple.el b/lisp/simple.el index 5a2c9e70ad6..7c941fd63b9 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -424,6 +424,19 @@ Other major modes are defined by comparison with this one." ;; Major mode meant to be the parent of programming modes. +(defvar prog-mode-map + (let ((map (make-sparse-keymap))) + (define-key map [?\C-\M-q] 'prog-indent-sexp) + map) + "Keymap used for programming modes.") + +(defun prog-indent-sexp () + "Indent the expression after point." + (interactive) + (let ((start (point)) + (end (save-excursion (forward-sexp 1) (point)))) + (indent-region start end nil))) + (define-derived-mode prog-mode fundamental-mode "Prog" "Major mode for editing programming language source code." (set (make-local-variable 'require-final-newline) mode-require-final-newline) -- 2.39.2