aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2000-11-14 09:52:24 +0000
committerStefan Monnier2000-11-14 09:52:24 +0000
commit1594a23a930fda645452eb02d480bb61091cdf65 (patch)
treeebfa3d118533ba15b1f88efc45803079f5f15636
parentbdab1d433f14d4b92441763e430932774c5b41b6 (diff)
downloademacs-1594a23a930fda645452eb02d480bb61091cdf65.tar.gz
emacs-1594a23a930fda645452eb02d480bb61091cdf65.zip
(lisp-mode-variables):
Set font-lock-defaults. (lisp-mode-shared-map): Init inside the defvar. (emacs-lisp-mode, lisp-mode, lisp-interaction-mode): Use define-derived-mode.
-rw-r--r--lisp/emacs-lisp/lisp-mode.el53
1 files changed, 17 insertions, 36 deletions
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index 321de2d8531..471e10c7eb0 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -139,7 +139,12 @@ ine-condition\\|ine-widget\\|face\\)\\s-+'?\\(\\sw\\(\\sw\\|\\s_\\)+\\)")
139 (make-local-variable 'imenu-generic-expression) 139 (make-local-variable 'imenu-generic-expression)
140 (setq imenu-generic-expression lisp-imenu-generic-expression) 140 (setq imenu-generic-expression lisp-imenu-generic-expression)
141 (make-local-variable 'multibyte-syntax-as-symbol) 141 (make-local-variable 'multibyte-syntax-as-symbol)
142 (setq multibyte-syntax-as-symbol t)) 142 (setq multibyte-syntax-as-symbol t)
143 (setq font-lock-defaults
144 '((lisp-font-lock-keywords
145 lisp-font-lock-keywords-1 lisp-font-lock-keywords-2)
146 nil nil (("+-*/.<>=!?$%_&~^:" . "w")) beginning-of-defun
147 (font-lock-mark-block-function . mark-defun))))
143 148
144(defun lisp-outline-level () 149(defun lisp-outline-level ()
145 "Lisp mode `outline-level' function." 150 "Lisp mode `outline-level' function."
@@ -149,15 +154,13 @@ ine-condition\\|ine-widget\\|face\\)\\s-+'?\\(\\sw\\(\\sw\\|\\s_\\)+\\)")
149 (- (match-end 0) (match-beginning 0)))) 154 (- (match-end 0) (match-beginning 0))))
150 155
151 156
152(defvar lisp-mode-shared-map () 157(defvar lisp-mode-shared-map
158 (let ((map (make-sparse-keymap)))
159 (define-key map "\e\C-q" 'indent-sexp)
160 (define-key map "\177" 'backward-delete-char-untabify)
161 map)
153 "Keymap for commands shared by all sorts of Lisp modes.") 162 "Keymap for commands shared by all sorts of Lisp modes.")
154 163
155(if lisp-mode-shared-map
156 ()
157 (setq lisp-mode-shared-map (make-sparse-keymap))
158 (define-key lisp-mode-shared-map "\e\C-q" 'indent-sexp)
159 (define-key lisp-mode-shared-map "\177" 'backward-delete-char-untabify))
160
161(defvar emacs-lisp-mode-map () 164(defvar emacs-lisp-mode-map ()
162 "Keymap for Emacs Lisp mode. 165 "Keymap for Emacs Lisp mode.
163All commands in `lisp-mode-shared-map' are inherited by this map.") 166All commands in `lisp-mode-shared-map' are inherited by this map.")
@@ -232,7 +235,7 @@ All commands in `lisp-mode-shared-map' are inherited by this map.")
232 :type 'hook 235 :type 'hook
233 :group 'lisp) 236 :group 'lisp)
234 237
235(defun emacs-lisp-mode () 238(define-derived-mode emacs-lisp-mode nil "Emacs-Lisp"
236 "Major mode for editing Lisp code to run in Emacs. 239 "Major mode for editing Lisp code to run in Emacs.
237Commands: 240Commands:
238Delete converts tabs to spaces as it moves back. 241Delete converts tabs to spaces as it moves back.
@@ -240,15 +243,8 @@ Blank lines separate paragraphs. Semicolons start comments.
240\\{emacs-lisp-mode-map} 243\\{emacs-lisp-mode-map}
241Entry to this mode calls the value of `emacs-lisp-mode-hook' 244Entry to this mode calls the value of `emacs-lisp-mode-hook'
242if that value is non-nil." 245if that value is non-nil."
243 (interactive)
244 (kill-all-local-variables)
245 (use-local-map emacs-lisp-mode-map)
246 (set-syntax-table emacs-lisp-mode-syntax-table)
247 (setq major-mode 'emacs-lisp-mode)
248 (setq mode-name "Emacs-Lisp")
249 (lisp-mode-variables nil) 246 (lisp-mode-variables nil)
250 (setq imenu-case-fold-search nil) 247 (setq imenu-case-fold-search nil))
251 (run-hooks 'emacs-lisp-mode-hook))
252 248
253(defvar lisp-mode-map 249(defvar lisp-mode-map
254 (let ((map (make-sparse-keymap))) 250 (let ((map (make-sparse-keymap)))
@@ -259,7 +255,7 @@ if that value is non-nil."
259 "Keymap for ordinary Lisp mode. 255 "Keymap for ordinary Lisp mode.
260All commands in `lisp-mode-shared-map' are inherited by this map.") 256All commands in `lisp-mode-shared-map' are inherited by this map.")
261 257
262(defun lisp-mode () 258(define-derived-mode lisp-mode nil "Lisp"
263 "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp. 259 "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp.
264Commands: 260Commands:
265Delete converts tabs to spaces as it moves back. 261Delete converts tabs to spaces as it moves back.
@@ -270,15 +266,8 @@ or to switch back to an existing one.
270 266
271Entry to this mode calls the value of `lisp-mode-hook' 267Entry to this mode calls the value of `lisp-mode-hook'
272if that value is non-nil." 268if that value is non-nil."
273 (interactive)
274 (kill-all-local-variables)
275 (use-local-map lisp-mode-map)
276 (setq major-mode 'lisp-mode)
277 (setq mode-name "Lisp")
278 (lisp-mode-variables t) 269 (lisp-mode-variables t)
279 (setq imenu-case-fold-search t) 270 (setq imenu-case-fold-search t))
280 (set-syntax-table lisp-mode-syntax-table)
281 (run-hooks 'lisp-mode-hook))
282 271
283;; This will do unless inf-lisp.el is loaded. 272;; This will do unless inf-lisp.el is loaded.
284(defun lisp-eval-defun (&optional and-go) 273(defun lisp-eval-defun (&optional and-go)
@@ -296,7 +285,7 @@ if that value is non-nil."
296 "Keymap for Lisp Interaction mode. 285 "Keymap for Lisp Interaction mode.
297All commands in `lisp-mode-shared-map' are inherited by this map.") 286All commands in `lisp-mode-shared-map' are inherited by this map.")
298 287
299(defun lisp-interaction-mode () 288(define-derived-mode lisp-interaction-mode emacs-lisp-mode "Lisp Interaction"
300 "Major mode for typing and evaluating Lisp forms. 289 "Major mode for typing and evaluating Lisp forms.
301Like Lisp mode except that \\[eval-print-last-sexp] evals the Lisp expression 290Like Lisp mode except that \\[eval-print-last-sexp] evals the Lisp expression
302before point, and prints its value into the buffer, advancing point. 291before point, and prints its value into the buffer, advancing point.
@@ -307,15 +296,7 @@ Paragraphs are separated only by blank lines.
307Semicolons start comments. 296Semicolons start comments.
308\\{lisp-interaction-mode-map} 297\\{lisp-interaction-mode-map}
309Entry to this mode calls the value of `lisp-interaction-mode-hook' 298Entry to this mode calls the value of `lisp-interaction-mode-hook'
310if that value is non-nil." 299if that value is non-nil.")
311 (interactive)
312 (kill-all-local-variables)
313 (use-local-map lisp-interaction-mode-map)
314 (setq major-mode 'lisp-interaction-mode)
315 (setq mode-name "Lisp Interaction")
316 (set-syntax-table emacs-lisp-mode-syntax-table)
317 (lisp-mode-variables nil)
318 (run-hooks 'lisp-interaction-mode-hook))
319 300
320(defun eval-print-last-sexp () 301(defun eval-print-last-sexp ()
321 "Evaluate sexp before point; print value into current buffer." 302 "Evaluate sexp before point; print value into current buffer."