comparison lisp/modes/lisp-mode.el @ 169:15872534500d r20-3b11

Import from CVS: tag r20-3b11
author cvs
date Mon, 13 Aug 2007 09:46:53 +0200
parents 28f395d8dc7a
children 8eaf7971accc
comparison
equal deleted inserted replaced
168:9851d5c6556e 169:15872534500d
28 ;;; Commentary: 28 ;;; Commentary:
29 29
30 ;; The base major mode for editing Lisp code (used also for Emacs Lisp). 30 ;; The base major mode for editing Lisp code (used also for Emacs Lisp).
31 ;; This mode is documented in the Emacs manual 31 ;; This mode is documented in the Emacs manual
32 32
33 ;; July/05/97 slb Converted to use easymenu.
34
33 ;;; Code: 35 ;;; Code:
34 36
35 (defvar lisp-mode-syntax-table nil "") 37 (defvar lisp-mode-syntax-table nil "")
36 (defvar emacs-lisp-mode-syntax-table nil "") 38 (defvar emacs-lisp-mode-syntax-table nil "")
37 (defvar lisp-mode-abbrev-table nil "") 39 (defvar lisp-mode-abbrev-table nil "")
38 40
39 ;; XEmacs change 41 ;; XEmacs change
40 (defvar lisp-interaction-mode-popup-menu 42 (defvar lisp-interaction-mode-popup-menu nil)
41 (purecopy '("Lisp Interaction Menu" 43 (defvar lisp-interaction-mode-popup-menu-1
44 (purecopy '("Lisp-Interaction"
42 ["Evaluate Last S-expression" eval-last-sexp t] 45 ["Evaluate Last S-expression" eval-last-sexp t]
43 ["Evaluate Entire Buffer" eval-current-buffer t] 46 ["Evaluate Entire Buffer" eval-current-buffer t]
44 ["Evaluate Region" eval-region (region-exists-p)] 47 ["Evaluate Region" eval-region (region-exists-p)]
45 "---" 48 "---"
46 ["Evaluate This Defun" eval-defun t] 49 ["Evaluate This Defun" eval-defun t]
58 :style toggle :selected debug-on-error] 61 :style toggle :selected debug-on-error]
59 ["Debug On Quit" (setq debug-on-quit (not debug-on-quit)) 62 ["Debug On Quit" (setq debug-on-quit (not debug-on-quit))
60 :style toggle :selected debug-on-quit] 63 :style toggle :selected debug-on-quit]
61 ))) 64 )))
62 65
63 (defvar emacs-lisp-mode-popup-menu 66 (defvar emacs-lisp-mode-popup-menu nil)
67 (defvar emacs-lisp-mode-popup-menu-1
64 (purecopy 68 (purecopy
65 (nconc 69 (nconc
66 '("Emacs-Lisp Menu" 70 '("Emacs-Lisp"
67 ["Byte-compile This File" emacs-lisp-byte-compile t] 71 ["Byte-compile This File" emacs-lisp-byte-compile t]
68 ["Byte-recompile Directory..." byte-recompile-directory t] 72 ["Byte-recompile Directory..." byte-recompile-directory t]
69 "---") 73 "---")
70 (cdr lisp-interaction-mode-popup-menu)))) 74 (cdr lisp-interaction-mode-popup-menu-1))))
71 75
72 ;Don't have a menubar entry in Lisp Interaction mode. Otherwise, the 76 ;Don't have a menubar entry in Lisp Interaction mode. Otherwise, the
73 ;*scratch* buffer has a Lisp menubar item! Very confusing. 77 ;*scratch* buffer has a Lisp menubar item! Very confusing.
74 ;(defvar lisp-interaction-mode-menubar-menu 78 ;(defvar lisp-interaction-mode-menubar-menu
75 ; (purecopy (cons "Lisp" (cdr lisp-interaction-mode-popup-menu)))) 79 ; (purecopy (cons "Lisp" (cdr lisp-interaction-mode-popup-menu))))
76 80
77 (defvar emacs-lisp-mode-menubar-menu 81 (defvar emacs-lisp-mode-menubar-menu nil)
78 (purecopy (cons "Lisp" (cdr emacs-lisp-mode-popup-menu)))) 82 (defvar emacs-lisp-mode-menubar-menu-1
83 (purecopy (cons "Lisp" (cdr emacs-lisp-mode-popup-menu-1))))
79 84
80 (if (not emacs-lisp-mode-syntax-table) 85 (if (not emacs-lisp-mode-syntax-table)
81 (let ((i 0)) 86 (let ((i 0))
82 (setq emacs-lisp-mode-syntax-table (make-syntax-table)) 87 (setq emacs-lisp-mode-syntax-table (make-syntax-table))
83 (while (< i ?0) 88 (while (< i ?0)
257 (kill-all-local-variables) 262 (kill-all-local-variables)
258 (use-local-map emacs-lisp-mode-map) 263 (use-local-map emacs-lisp-mode-map)
259 (set-syntax-table emacs-lisp-mode-syntax-table) 264 (set-syntax-table emacs-lisp-mode-syntax-table)
260 ;; XEmacs changes 265 ;; XEmacs changes
261 (setq major-mode 'emacs-lisp-mode 266 (setq major-mode 'emacs-lisp-mode
262 mode-popup-menu emacs-lisp-mode-popup-menu 267 ;; mode-popup-menu emacs-lisp-mode-popup-menu
263 mode-name "Emacs-Lisp") 268 mode-name "Emacs-Lisp")
264 (if (and (featurep 'menubar) 269 ;; (if (and (featurep 'menubar)
265 current-menubar) 270 ;; current-menubar)
266 (progn 271 ;; (progn
267 ;; make a local copy of the menubar, so our modes don't 272 ;; make a local copy of the menubar, so our modes don't
268 ;; change the global menubar 273 ;; change the global menubar
269 (set-buffer-menubar current-menubar) 274 ;; (set-buffer-menubar current-menubar)
270 (add-submenu nil emacs-lisp-mode-menubar-menu))) 275 ;; (add-submenu nil emacs-lisp-mode-menubar-menu)))
276 (unless emacs-lisp-mode-popup-menu
277 (easy-menu-define emacs-lisp-mode-popup-menu emacs-lisp-mode-map ""
278 emacs-lisp-mode-popup-menu-1))
279 (easy-menu-add emacs-lisp-mode-popup-menu)
271 (lisp-mode-variables nil) 280 (lisp-mode-variables nil)
272 (run-hooks 'emacs-lisp-mode-hook)) 281 (run-hooks 'emacs-lisp-mode-hook))
273 282
274 (defvar lisp-mode-map () 283 (defvar lisp-mode-map ()
275 "Keymap for ordinary Lisp mode. 284 "Keymap for ordinary Lisp mode.
344 (kill-all-local-variables) 353 (kill-all-local-variables)
345 (use-local-map lisp-interaction-mode-map) 354 (use-local-map lisp-interaction-mode-map)
346 (setq major-mode 'lisp-interaction-mode) 355 (setq major-mode 'lisp-interaction-mode)
347 (setq mode-name "Lisp Interaction") 356 (setq mode-name "Lisp Interaction")
348 ;; XEmacs change 357 ;; XEmacs change
349 (setq mode-popup-menu lisp-interaction-mode-popup-menu) 358 ;; (setq mode-popup-menu lisp-interaction-mode-popup-menu)
359 (unless lisp-interaction-mode-popup-menu
360 (easy-menu-define lisp-interaction-mode-popup-menu
361 lisp-interaction-mode-map
362 ""
363 lisp-interaction-mode-popup-menu-1))
364 (easy-menu-add lisp-interaction-mode-popup-menu)
365
350 (set-syntax-table emacs-lisp-mode-syntax-table) 366 (set-syntax-table emacs-lisp-mode-syntax-table)
351 (lisp-mode-variables nil) 367 (lisp-mode-variables nil)
352 (run-hooks 'lisp-interaction-mode-hook)) 368 (run-hooks 'lisp-interaction-mode-hook))
353 369
354 (defun eval-print-last-sexp () 370 (defun eval-print-last-sexp ()