comparison lisp/emacs-lisp/lisp-mode.el @ 92493:402ee2cfca27

* bindings.el (mode-line-remote): Add mouse-face. Improve tooltip. (standard-mode-line-position): Add mouse-face. * progmodes/compile.el (compilation-menu-map): (compilation-mode-map): * progmodes/grep.el (grep-mode-map): Add :help. * emacs-lisp/lisp-mode.el (emacs-lisp-mode-map): Define and initialize in one step. Add :help. Use :enable to activate menu items. Show the key binding for edebug-defun. (lisp-interaction-mode-map): Add a menu. * term.el (term-mode-map): Define and initialize in one step. * ediff-init.el (ediff-color-display-p): Simplify. (Xor): Remove unused function. (ediff-with-syntax-table): Simplify for emacs. * ediff-hook.el (menu-bar-ediff-menu): Don't depend on the menu-bar being loaded, it always is.
author Dan Nicolaescu <dann@ics.uci.edu>
date Wed, 05 Mar 2008 04:09:24 +0000
parents 107ccd98fa12
children cdc0b4ed6c22
comparison
equal deleted inserted replaced
92492:dbef59debced 92493:402ee2cfca27
34 (defvar font-lock-doc-face) 34 (defvar font-lock-doc-face)
35 (defvar font-lock-keywords-case-fold-search) 35 (defvar font-lock-keywords-case-fold-search)
36 (defvar font-lock-string-face) 36 (defvar font-lock-string-face)
37 37
38 (defvar lisp-mode-abbrev-table nil) 38 (defvar lisp-mode-abbrev-table nil)
39
40 (define-abbrev-table 'lisp-mode-abbrev-table ())
39 41
40 (defvar emacs-lisp-mode-syntax-table 42 (defvar emacs-lisp-mode-syntax-table
41 (let ((table (make-syntax-table))) 43 (let ((table (make-syntax-table)))
42 (let ((i 0)) 44 (let ((i 0))
43 (while (< i ?0) 45 (while (< i ?0)
85 (modify-syntax-entry ?\[ "_ " table) 87 (modify-syntax-entry ?\[ "_ " table)
86 (modify-syntax-entry ?\] "_ " table) 88 (modify-syntax-entry ?\] "_ " table)
87 (modify-syntax-entry ?# "' 14b" table) 89 (modify-syntax-entry ?# "' 14b" table)
88 (modify-syntax-entry ?| "\" 23bn" table) 90 (modify-syntax-entry ?| "\" 23bn" table)
89 table)) 91 table))
90
91 (define-abbrev-table 'lisp-mode-abbrev-table ())
92 92
93 (defvar lisp-imenu-generic-expression 93 (defvar lisp-imenu-generic-expression
94 (list 94 (list
95 (list nil 95 (list nil
96 (purecopy (concat "^\\s-*(" 96 (purecopy (concat "^\\s-*("
268 ;; function-key-map, this should remain disabled!! 268 ;; function-key-map, this should remain disabled!!
269 ;;;(define-key map [backspace] 'backward-delete-char-untabify) 269 ;;;(define-key map [backspace] 'backward-delete-char-untabify)
270 map) 270 map)
271 "Keymap for commands shared by all sorts of Lisp modes.") 271 "Keymap for commands shared by all sorts of Lisp modes.")
272 272
273 (defvar emacs-lisp-mode-map () 273 (defvar emacs-lisp-mode-map
274 (let ((map (make-sparse-keymap "Emacs-Lisp"))
275 (menu-map (make-sparse-keymap "Emacs-Lisp")))
276 (set-keymap-parent map lisp-mode-shared-map)
277 (define-key map "\e\t" 'lisp-complete-symbol)
278 (define-key map "\e\C-x" 'eval-defun)
279 (define-key map "\e\C-q" 'indent-pp-sexp)
280 (define-key map [menu-bar emacs-lisp] (cons "Emacs-Lisp" menu-map))
281 (define-key menu-map [edebug-defun]
282 '(menu-item "Instrument Function for Debugging" edebug-defun
283 :help "Evaluate the top level form point is in, stepping through with Edebug"
284 :keys "C-u C-M-x"))
285 (define-key menu-map [byte-recompile]
286 '(menu-item "Byte-recompile Directory..." byte-recompile-directory
287 :help "Recompile every `.el' file in DIRECTORY that needs recompilation"))
288 (define-key menu-map [emacs-byte-compile-and-load]
289 '(menu-item "Byte-compile And Load" emacs-lisp-byte-compile-and-load
290 :help "Byte-compile the current file (if it has changed), then load compiled code"))
291 (define-key menu-map [byte-compile]
292 '(menu-item "Byte-compile This File" emacs-lisp-byte-compile
293 :help "Byte compile the file containing the current buffer"))
294 (define-key menu-map [separator-eval] '("--"))
295 (define-key menu-map [eval-buffer]
296 '(menu-item "Evaluate Buffer" eval-buffer
297 :help "Execute the current buffer as Lisp code"))
298 (define-key menu-map [eval-region]
299 '(menu-item "Evaluate Region" eval-region
300 :help "Execute the region as Lisp code"
301 :enable (mark-active)))
302 (define-key menu-map [eval-sexp]
303 '(menu-item "Evaluate Last S-expression" eval-last-sexp
304 :help "Evaluate sexp before point; print value in minibuffer"))
305 (define-key menu-map [separator-format] '("--"))
306 (define-key menu-map [comment-region]
307 '(menu-item "Comment Out Region" comment-region
308 :help "Comment or uncomment each line in the region"
309 :enable (mark-active)))
310 (define-key menu-map [indent-region]
311 '(menu-item "Indent Region" indent-region
312 :help "Indent each nonblank line in the region"
313 :enable (mark-active)))
314 (define-key menu-map [indent-line] '("Indent Line" . lisp-indent-line))
315 map)
274 "Keymap for Emacs Lisp mode. 316 "Keymap for Emacs Lisp mode.
275 All commands in `lisp-mode-shared-map' are inherited by this map.") 317 All commands in `lisp-mode-shared-map' are inherited by this map.")
276
277 (if emacs-lisp-mode-map
278 ()
279 (let ((map (make-sparse-keymap "Emacs-Lisp")))
280 (setq emacs-lisp-mode-map (make-sparse-keymap))
281 (set-keymap-parent emacs-lisp-mode-map lisp-mode-shared-map)
282 (define-key emacs-lisp-mode-map "\e\t" 'lisp-complete-symbol)
283 (define-key emacs-lisp-mode-map "\e\C-x" 'eval-defun)
284 (define-key emacs-lisp-mode-map "\e\C-q" 'indent-pp-sexp)
285 (define-key emacs-lisp-mode-map [menu-bar] (make-sparse-keymap))
286 (define-key emacs-lisp-mode-map [menu-bar emacs-lisp]
287 (cons "Emacs-Lisp" map))
288 (define-key map [edebug-defun]
289 '("Instrument Function for Debugging" . edebug-defun))
290 (define-key map [byte-recompile]
291 '("Byte-recompile Directory..." . byte-recompile-directory))
292 (define-key map [emacs-byte-compile-and-load]
293 '("Byte-compile And Load" . emacs-lisp-byte-compile-and-load))
294 (define-key map [byte-compile]
295 '("Byte-compile This File" . emacs-lisp-byte-compile))
296 (define-key map [separator-eval] '("--"))
297 (define-key map [eval-buffer] '("Evaluate Buffer" . eval-buffer))
298 (define-key map [eval-region] '("Evaluate Region" . eval-region))
299 (define-key map [eval-sexp] '("Evaluate Last S-expression" . eval-last-sexp))
300 (define-key map [separator-format] '("--"))
301 (define-key map [comment-region] '("Comment Out Region" . comment-region))
302 (define-key map [indent-region] '("Indent Region" . indent-region))
303 (define-key map [indent-line] '("Indent Line" . lisp-indent-line))
304 (put 'eval-region 'menu-enable 'mark-active)
305 (put 'comment-region 'menu-enable 'mark-active)
306 (put 'indent-region 'menu-enable 'mark-active)))
307 318
308 (defun emacs-lisp-byte-compile () 319 (defun emacs-lisp-byte-compile ()
309 "Byte compile the file containing the current buffer." 320 "Byte compile the file containing the current buffer."
310 (interactive) 321 (interactive)
311 (if buffer-file-name 322 (if buffer-file-name
415 "Send the current defun to the Lisp process made by \\[run-lisp]." 426 "Send the current defun to the Lisp process made by \\[run-lisp]."
416 (interactive) 427 (interactive)
417 (error "Process lisp does not exist")) 428 (error "Process lisp does not exist"))
418 429
419 (defvar lisp-interaction-mode-map 430 (defvar lisp-interaction-mode-map
420 (let ((map (make-sparse-keymap))) 431 (let ((map (make-sparse-keymap))
432 (menu-map (make-sparse-keymap "Lisp-Interaction")))
421 (set-keymap-parent map lisp-mode-shared-map) 433 (set-keymap-parent map lisp-mode-shared-map)
422 (define-key map "\e\C-x" 'eval-defun) 434 (define-key map "\e\C-x" 'eval-defun)
423 (define-key map "\e\C-q" 'indent-pp-sexp) 435 (define-key map "\e\C-q" 'indent-pp-sexp)
424 (define-key map "\e\t" 'lisp-complete-symbol) 436 (define-key map "\e\t" 'lisp-complete-symbol)
425 (define-key map "\n" 'eval-print-last-sexp) 437 (define-key map "\n" 'eval-print-last-sexp)
438 (define-key map [menu-bar lisp-interaction] (cons "Lisp-Interaction" menu-map))
439 (define-key menu-map [eval-defun]
440 '(menu-item "Evaluate Defun" eval-defun
441 :help "Evaluate the top-level form containing point, or after point"))
442 (define-key menu-map [eval-print-last-sexp]
443 '(menu-item "Evaluate and print" eval-print-last-sexp
444 :help "Evaluate sexp before point; print value into current buffer"))
445 (define-key map [edebug-defun-lisp-interaction]
446 '(menu-item "Instrument Function for Debugging" edebug-defun
447 :help "Evaluate the top level form point is in, stepping through with Edebug"
448 :keys "C-u C-M-x"))
449 (define-key menu-map [indent-pp-sexp]
450 '(menu-item "Indent or Pretty-Print" indent-pp-sexp
451 :help "Indent each line of the list starting just after point, or prettyprint it"))
452 (define-key menu-map [lisp-complete-symbol]
453 '(menu-item "Complete Lisp Symbol" lisp-complete-symbol
454 :help "Perform completion on Lisp symbol preceding point"))
426 map) 455 map)
427 "Keymap for Lisp Interaction mode. 456 "Keymap for Lisp Interaction mode.
428 All commands in `lisp-mode-shared-map' are inherited by this map.") 457 All commands in `lisp-mode-shared-map' are inherited by this map.")
429 458
430 (defvar lisp-interaction-mode-abbrev-table lisp-mode-abbrev-table) 459 (defvar lisp-interaction-mode-abbrev-table lisp-mode-abbrev-table)