comparison lisp/emacs-lisp/lisp-mode.el @ 32294:a6eff9b566ae

(lisp-imenu-generic-expression): Don't insist on symbols starting with word syntax. (lisp-mode-shared-map): Renamed from shared-lisp-mode-map. (eval-defun-1): Doc fix. (indent-sexp): Use nconc to build up indent-stack.
author Dave Love <fx@gnu.org>
date Sun, 08 Oct 2000 17:23:50 +0000
parents d470d496fd53
children b5c06c30c15f
comparison
equal deleted inserted replaced
32293:0e46ff2f2582 32294:a6eff9b566ae
147 1000 147 1000
148 (looking-at outline-regexp) 148 (looking-at outline-regexp)
149 (- (match-end 0) (match-beginning 0)))) 149 (- (match-end 0) (match-beginning 0))))
150 150
151 151
152 (defvar shared-lisp-mode-map () 152 (defvar lisp-mode-shared-map ()
153 "Keymap for commands shared by all sorts of Lisp modes.") 153 "Keymap for commands shared by all sorts of Lisp modes.")
154 154
155 (if shared-lisp-mode-map 155 (if lisp-mode-shared-map
156 () 156 ()
157 (setq shared-lisp-mode-map (make-sparse-keymap)) 157 (setq lisp-mode-shared-map (make-sparse-keymap))
158 (define-key shared-lisp-mode-map "\e\C-q" 'indent-sexp) 158 (define-key lisp-mode-shared-map "\e\C-q" 'indent-sexp)
159 (define-key shared-lisp-mode-map "\177" 'backward-delete-char-untabify)) 159 (define-key lisp-mode-shared-map "\177" 'backward-delete-char-untabify))
160 160
161 (defvar emacs-lisp-mode-map () 161 (defvar emacs-lisp-mode-map ()
162 "Keymap for Emacs Lisp mode. 162 "Keymap for Emacs Lisp mode.
163 All commands in `shared-lisp-mode-map' are inherited by this map.") 163 All commands in `lisp-mode-shared-map' are inherited by this map.")
164 164
165 (if emacs-lisp-mode-map 165 (if emacs-lisp-mode-map
166 () 166 ()
167 (let ((map (make-sparse-keymap "Emacs-Lisp"))) 167 (let ((map (make-sparse-keymap "Emacs-Lisp")))
168 (setq emacs-lisp-mode-map (make-sparse-keymap)) 168 (setq emacs-lisp-mode-map (make-sparse-keymap))
169 (set-keymap-parent emacs-lisp-mode-map shared-lisp-mode-map) 169 (set-keymap-parent emacs-lisp-mode-map lisp-mode-shared-map)
170 (define-key emacs-lisp-mode-map "\e\t" 'lisp-complete-symbol) 170 (define-key emacs-lisp-mode-map "\e\t" 'lisp-complete-symbol)
171 (define-key emacs-lisp-mode-map "\e\C-x" 'eval-defun) 171 (define-key emacs-lisp-mode-map "\e\C-x" 'eval-defun)
172 (define-key emacs-lisp-mode-map [menu-bar] (make-sparse-keymap)) 172 (define-key emacs-lisp-mode-map [menu-bar] (make-sparse-keymap))
173 (define-key emacs-lisp-mode-map [menu-bar emacs-lisp] 173 (define-key emacs-lisp-mode-map [menu-bar emacs-lisp]
174 (cons "Emacs-Lisp" map)) 174 (cons "Emacs-Lisp" map))
250 (setq imenu-case-fold-search nil) 250 (setq imenu-case-fold-search nil)
251 (run-hooks 'emacs-lisp-mode-hook)) 251 (run-hooks 'emacs-lisp-mode-hook))
252 252
253 (defvar lisp-mode-map 253 (defvar lisp-mode-map
254 (let ((map (make-sparse-keymap))) 254 (let ((map (make-sparse-keymap)))
255 (set-keymap-parent map shared-lisp-mode-map) 255 (set-keymap-parent map lisp-mode-shared-map)
256 (define-key map "\e\C-x" 'lisp-eval-defun) 256 (define-key map "\e\C-x" 'lisp-eval-defun)
257 (define-key map "\C-c\C-z" 'run-lisp) 257 (define-key map "\C-c\C-z" 'run-lisp)
258 map) 258 map)
259 "Keymap for ordinary Lisp mode. 259 "Keymap for ordinary Lisp mode.
260 All commands in `shared-lisp-mode-map' are inherited by this map.") 260 All commands in `lisp-mode-shared-map' are inherited by this map.")
261 261
262 (defun lisp-mode () 262 (defun lisp-mode ()
263 "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp. 263 "Major mode for editing Lisp code for Lisps other than GNU Emacs Lisp.
264 Commands: 264 Commands:
265 Delete converts tabs to spaces as it moves back. 265 Delete converts tabs to spaces as it moves back.
286 (interactive) 286 (interactive)
287 (error "Process lisp does not exist")) 287 (error "Process lisp does not exist"))
288 288
289 (defvar lisp-interaction-mode-map 289 (defvar lisp-interaction-mode-map
290 (let ((map (make-sparse-keymap))) 290 (let ((map (make-sparse-keymap)))
291 (set-keymap-parent map shared-lisp-mode-map) 291 (set-keymap-parent map lisp-mode-shared-map)
292 (define-key map "\e\C-x" 'eval-defun) 292 (define-key map "\e\C-x" 'eval-defun)
293 (define-key map "\e\t" 'lisp-complete-symbol) 293 (define-key map "\e\t" 'lisp-complete-symbol)
294 (define-key map "\n" 'eval-print-last-sexp) 294 (define-key map "\n" 'eval-print-last-sexp)
295 map) 295 map)
296 "Keymap for Lisp Interaction mode. 296 "Keymap for Lisp Interaction mode.
297 All commands in `shared-lisp-mode-map' are inherited by this map.") 297 All commands in `lisp-mode-shared-map' are inherited by this map.")
298 298
299 (defun lisp-interaction-mode () 299 (defun lisp-interaction-mode ()
300 "Major mode for typing and evaluating Lisp forms. 300 "Major mode for typing and evaluating Lisp forms.
301 Like Lisp mode except that \\[eval-print-last-sexp] evals the Lisp expression 301 Like Lisp mode except that \\[eval-print-last-sexp] evals the Lisp expression
302 before point, and prints its value into the buffer, advancing point. 302 before point, and prints its value into the buffer, advancing point.
398 (setq new-value debug-on-error)) 398 (setq new-value debug-on-error))
399 (unless (eq old-value new-value) 399 (unless (eq old-value new-value)
400 (setq debug-on-error new-value)) 400 (setq debug-on-error new-value))
401 value))) 401 value)))
402 402
403 ;; Change defvar into defconst within FORM,
404 ;; and likewise for other constructs as necessary.
405 (defun eval-defun-1 (form) 403 (defun eval-defun-1 (form)
404 "Change defvar into defconst within FORM.
405 Likewise for other constructs as necessary."
406 ;; The code in edebug-defun should be consistent with this, but not
407 ;; the same, since this gets a macroexpended form.
406 (cond ((and (eq (car form) 'defvar) 408 (cond ((and (eq (car form) 'defvar)
407 (cdr-safe (cdr-safe form))) 409 (cdr-safe (cdr-safe form)))
408 ;; Force variable to be bound. 410 ;; Force variable to be bound.
409 (cons 'defconst (cdr form))) 411 (cons 'defconst (cdr form)))
410 ;; `defcustom' is now macroexpanded to 412 ;; `defcustom' is now macroexpanded to
838 (setcar (nthcdr 5 state) nil)) 840 (setcar (nthcdr 5 state) nil))
839 (setq inner-loop-done t))) 841 (setq inner-loop-done t)))
840 (and endpos 842 (and endpos
841 (<= next-depth 0) 843 (<= next-depth 0)
842 (progn 844 (progn
843 (setq indent-stack (append indent-stack 845 (setq indent-stack (nconc indent-stack
844 (make-list (- next-depth) nil)) 846 (make-list (- next-depth) nil))
845 last-depth (- last-depth next-depth) 847 last-depth (- last-depth next-depth)
846 next-depth 0))) 848 next-depth 0)))
847 (or outer-loop-done endpos 849 (or outer-loop-done endpos
848 (setq outer-loop-done (<= next-depth 0))) 850 (setq outer-loop-done (<= next-depth 0)))
849 (if outer-loop-done 851 (if outer-loop-done