Mercurial > hg > xemacs-beta
comparison lisp/lisp-mode.el @ 404:2f8bb876ab1d r21-2-32
Import from CVS: tag r21-2-32
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:16:07 +0200 |
parents | 74fd4e045ea6 |
children | b8cc9ab3f761 |
comparison
equal
deleted
inserted
replaced
403:9f011ab08d48 | 404:2f8bb876ab1d |
---|---|
1 ;;; lisp-mode.el --- Lisp mode, and its idiosyncratic commands. | 1 ;;; lisp-mode.el --- Lisp mode, and its idiosyncratic commands. |
2 | 2 |
3 ;; Copyright (C) 1985, 1996, 1997 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1985, 1996, 1997 Free Software Foundation, Inc. |
4 ;; Copyright (C) 1995 Tinker Systems | 4 ;; Copyright (C) 1995 Tinker Systems. |
5 | 5 |
6 ;; Maintainer: FSF | 6 ;; Maintainer: FSF |
7 ;; Keywords: lisp, languages, dumped | 7 ;; Keywords: lisp, languages, dumped |
8 | 8 |
9 ;; This file is part of XEmacs. | 9 ;; This file is part of XEmacs. |
30 ;; This file is dumped with XEmacs. | 30 ;; This file is dumped with XEmacs. |
31 | 31 |
32 ;; The base major mode for editing Lisp code (used also for Emacs Lisp). | 32 ;; The base major mode for editing Lisp code (used also for Emacs Lisp). |
33 ;; This mode is documented in the Emacs manual | 33 ;; This mode is documented in the Emacs manual |
34 | 34 |
35 ;; July/05/97 slb Converted to use easymenu. | |
36 | |
37 ;;; Code: | 35 ;;; Code: |
38 | 36 |
39 (defgroup lisp nil | 37 (defgroup lisp nil |
40 "Lisp support, including Emacs Lisp." | 38 "Lisp support, including Emacs Lisp." |
41 :group 'languages | 39 :group 'languages |
44 (defvar lisp-mode-syntax-table nil) | 42 (defvar lisp-mode-syntax-table nil) |
45 (defvar emacs-lisp-mode-syntax-table nil) | 43 (defvar emacs-lisp-mode-syntax-table nil) |
46 (defvar lisp-mode-abbrev-table nil) | 44 (defvar lisp-mode-abbrev-table nil) |
47 | 45 |
48 ;; XEmacs change | 46 ;; XEmacs change |
49 (defvar lisp-interaction-mode-popup-menu nil) | 47 (defvar lisp-interaction-mode-popup-menu |
50 (defvar lisp-interaction-mode-popup-menu-1 | |
51 (purecopy '("Lisp-Interaction" | 48 (purecopy '("Lisp-Interaction" |
52 ["Evaluate Last S-expression" eval-last-sexp] | 49 ["Evaluate Last %_S-expression" eval-last-sexp] |
53 ["Evaluate Entire Buffer" eval-current-buffer] | 50 ["Evaluate %_Whole Buffer" eval-current-buffer] |
54 ["Evaluate Region" eval-region | 51 ["Evaluate Re%_gion" eval-region |
55 :active (region-exists-p)] | 52 :active (region-exists-p)] |
56 "---" | 53 "---" |
57 ["Evaluate This Defun" eval-defun] | 54 ["%_Evaluate This Defun" eval-defun] |
58 ;; FSF says "Instrument Function for Debugging" | 55 ["%_Instrument This Defun for Debugging" edebug-defun] |
59 ["Debug This Defun" edebug-defun] | |
60 "---" | 56 "---" |
61 ["Trace a Function" trace-function-background] | 57 ["Find %_Function Source..." find-function |
62 ["Untrace All Functions" untrace-all | 58 :active (fboundp 'find-function)] |
59 ["Find %_Variable Source..." find-variable | |
60 :active (fboundp 'find-variable)] | |
61 ["%_Trace Function..." trace-function-background] | |
62 ["%_Untrace All Functions" untrace-all | |
63 :active (fboundp 'untrace-all)] | 63 :active (fboundp 'untrace-all)] |
64 "---" | 64 "---" |
65 ["Comment Out Region" comment-region | 65 ["%_Comment Out Region" comment-region |
66 :active (region-exists-p)] | 66 :active (region-exists-p)] |
67 ["Indent Region" indent-region | |
68 :active (region-exists-p)] | |
69 ["Indent Line" lisp-indent-line] | |
70 "---" | 67 "---" |
71 ["Debug On Error" (setq debug-on-error (not debug-on-error)) | 68 ["Indent %_Line or Region" |
72 :style toggle :selected debug-on-error] | 69 (if (region-exists-p) |
73 ["Debug On Quit" (setq debug-on-quit (not debug-on-quit)) | 70 (call-interactively 'indent-region) |
74 :style toggle :selected debug-on-quit] | 71 (call-interactively 'lisp-indent-line))] |
75 ["Debug on Signal" (setq debug-on-signal (not debug-on-signal)) | 72 ["Indent B%_alanced Expression" indent-sexp] |
76 :style toggle :selected debug-on-signal] | 73 ["Indent %_Defun" |
74 (progn | |
75 (beginning-of-defun) | |
76 (indent-sexp))] | |
77 "---" | |
78 "Look for debug-on-error under Options->General" | |
77 ))) | 79 ))) |
78 | 80 |
79 (defvar emacs-lisp-mode-popup-menu nil) | 81 (defvar emacs-lisp-mode-popup-menu |
80 (defvar emacs-lisp-mode-popup-menu-1 | |
81 (purecopy | 82 (purecopy |
82 (nconc | 83 (nconc |
83 '("Emacs-Lisp" | 84 '("Emacs-Lisp" |
84 ["Byte-compile This File" emacs-lisp-byte-compile] | 85 ["%_Byte-Compile This File" emacs-lisp-byte-compile] |
85 ["Byte-compile/load This" emacs-lisp-byte-compile-and-load] | 86 ["B%_yte-Compile/Load This File" emacs-lisp-byte-compile-and-load] |
86 ["Byte-recompile Directory..." byte-recompile-directory] | 87 ["Byte-%_Recompile Directory..." byte-recompile-directory] |
87 "---") | 88 "---") |
88 (cdr lisp-interaction-mode-popup-menu-1)))) | 89 (cdr lisp-interaction-mode-popup-menu)))) |
89 | 90 |
90 ;Don't have a menubar entry in Lisp Interaction mode. Otherwise, the | 91 ;Don't have a menubar entry in Lisp Interaction mode. Otherwise, the |
91 ;*scratch* buffer has a Lisp menubar item! Very confusing. | 92 ;*scratch* buffer has a Lisp menubar item! Very confusing. |
92 ;(defvar lisp-interaction-mode-menubar-menu | 93 ;(defvar lisp-interaction-mode-menubar-menu |
93 ; (purecopy (cons "Lisp" (cdr lisp-interaction-mode-popup-menu)))) | 94 ; (purecopy (cons "Lisp" (cdr lisp-interaction-mode-popup-menu)))) |
94 | 95 |
95 (defvar emacs-lisp-mode-menubar-menu nil) | 96 (defvar emacs-lisp-mode-menubar-menu |
96 (defvar emacs-lisp-mode-menubar-menu-1 | 97 (purecopy (cons "%_Lisp" (cdr emacs-lisp-mode-popup-menu)))) |
97 (purecopy (cons "Lisp" (cdr emacs-lisp-mode-popup-menu-1)))) | |
98 | 98 |
99 (if (not emacs-lisp-mode-syntax-table) | 99 (if (not emacs-lisp-mode-syntax-table) |
100 (let ((i 0)) | 100 (let ((i 0)) |
101 (setq emacs-lisp-mode-syntax-table (make-syntax-table)) | 101 (setq emacs-lisp-mode-syntax-table (make-syntax-table)) |
102 (while (< i ?0) | 102 (while (< i ?0) |
272 (kill-all-local-variables) | 272 (kill-all-local-variables) |
273 (use-local-map emacs-lisp-mode-map) | 273 (use-local-map emacs-lisp-mode-map) |
274 (set-syntax-table emacs-lisp-mode-syntax-table) | 274 (set-syntax-table emacs-lisp-mode-syntax-table) |
275 ;; XEmacs changes | 275 ;; XEmacs changes |
276 (setq major-mode 'emacs-lisp-mode | 276 (setq major-mode 'emacs-lisp-mode |
277 ;; mode-popup-menu emacs-lisp-mode-popup-menu | 277 mode-popup-menu emacs-lisp-mode-popup-menu |
278 mode-name "Emacs-Lisp") | 278 mode-name "Emacs-Lisp") |
279 ;; (if (and (featurep 'menubar) | 279 (if (and (featurep 'menubar) |
280 ;; current-menubar) | 280 current-menubar) |
281 ;; (progn | 281 (progn |
282 ;; make a local copy of the menubar, so our modes don't | 282 ;; make a local copy of the menubar, so our modes don't |
283 ;; change the global menubar | 283 ;; change the global menubar |
284 ;; (set-buffer-menubar current-menubar) | 284 (set-buffer-menubar current-menubar) |
285 ;; (add-submenu nil emacs-lisp-mode-menubar-menu))) | 285 (add-submenu nil emacs-lisp-mode-menubar-menu))) |
286 (unless emacs-lisp-mode-popup-menu | |
287 (easy-menu-define emacs-lisp-mode-popup-menu emacs-lisp-mode-map "" | |
288 emacs-lisp-mode-popup-menu-1)) | |
289 (easy-menu-add emacs-lisp-mode-popup-menu) | |
290 (lisp-mode-variables nil) | 286 (lisp-mode-variables nil) |
291 (run-hooks 'emacs-lisp-mode-hook)) | 287 (run-hooks 'emacs-lisp-mode-hook)) |
292 | 288 |
293 (put 'emacs-lisp-mode 'font-lock-lisp-like t) | 289 (put 'emacs-lisp-mode 'font-lock-lisp-like t) |
294 | 290 |
364 (interactive) | 360 (interactive) |
365 (kill-all-local-variables) | 361 (kill-all-local-variables) |
366 (use-local-map lisp-interaction-mode-map) | 362 (use-local-map lisp-interaction-mode-map) |
367 (setq major-mode 'lisp-interaction-mode) | 363 (setq major-mode 'lisp-interaction-mode) |
368 (setq mode-name "Lisp Interaction") | 364 (setq mode-name "Lisp Interaction") |
369 ;; XEmacs change | 365 (setq mode-popup-menu lisp-interaction-mode-popup-menu) |
370 ;; (setq mode-popup-menu lisp-interaction-mode-popup-menu) | |
371 (unless lisp-interaction-mode-popup-menu | |
372 (easy-menu-define lisp-interaction-mode-popup-menu | |
373 lisp-interaction-mode-map | |
374 "" | |
375 lisp-interaction-mode-popup-menu-1)) | |
376 (easy-menu-add lisp-interaction-mode-popup-menu) | |
377 | 366 |
378 (set-syntax-table emacs-lisp-mode-syntax-table) | 367 (set-syntax-table emacs-lisp-mode-syntax-table) |
379 (lisp-mode-variables nil) | 368 (lisp-mode-variables nil) |
380 (run-hooks 'lisp-interaction-mode-hook)) | 369 (run-hooks 'lisp-interaction-mode-hook)) |
381 | 370 |
758 (put 'save-restriction 'lisp-indent-function 0) | 747 (put 'save-restriction 'lisp-indent-function 0) |
759 (put 'save-match-data 'lisp-indent-function 0) | 748 (put 'save-match-data 'lisp-indent-function 0) |
760 (put 'let 'lisp-indent-function 1) | 749 (put 'let 'lisp-indent-function 1) |
761 (put 'let* 'lisp-indent-function 1) | 750 (put 'let* 'lisp-indent-function 1) |
762 (put 'let-specifier 'lisp-indent-function 1) | 751 (put 'let-specifier 'lisp-indent-function 1) |
752 (put 'flet 'lisp-indent-function 1) | |
763 (put 'while 'lisp-indent-function 1) | 753 (put 'while 'lisp-indent-function 1) |
764 (put 'if 'lisp-indent-function 2) | 754 (put 'if 'lisp-indent-function 2) |
765 (put 'catch 'lisp-indent-function 1) | 755 (put 'catch 'lisp-indent-function 1) |
766 (put 'condition-case 'lisp-indent-function 2) | 756 (put 'condition-case 'lisp-indent-function 2) |
767 (put 'call-with-condition-handler 'lisp-indent-function 2) | 757 (put 'call-with-condition-handler 'lisp-indent-function 2) |