Mercurial > emacs
comparison lisp/emacs-lisp/lisp-mode.el @ 89943:4c90ffeb71c5
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-15
Merge from emacs--cvs-trunk--0
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-218
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-220
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-221
Restore deleted tagline in etc/TUTORIAL.ru
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-222
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-228
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-229
Remove TeX output files from the archive
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-230
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-247
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-248
src/lisp.h (CYCLE_CHECK): Macro moved from xfaces.c
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-249
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-256
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-258
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-263
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-264
Update from CVS: lispref/display.texi: emacs -> Emacs.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-265
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-274
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-275
Update from CVS: man/makefile.w32-in: Revert last change
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-276
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-295
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-296
Allow restarting an existing debugger session that's exited
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-297
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-299
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-300
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-327
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-328
Update from CVS: src/.gdbinit (xsymbol): Fix last change.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-329
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-344
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-345
Tweak source regexps so that building in place won't cause problems
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-346
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-351
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-352
Update from CVS: lisp/flymake.el: New file.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-353
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-361
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-362
Support " [...]" style defaults in minibuffer-electric-default-mode
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-363
(read-number): Use canonical format for default in prompt.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-364
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-367
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-368
Improve display-supports-face-attributes-p on non-ttys
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-369
Rewrite face-differs-from-default-p
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-370
Move `display-supports-face-attributes-p' entirely into C code
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-371
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-372
Simplify face-differs-from-default-p; don't consider :stipple.
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-373
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-374
(tty_supports_face_attributes_p): Ensure attributes differ from default
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-375
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-376
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-377
(Fdisplay_supports_face_attributes_p): Work around bootstrapping problem
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-378
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-380
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-381
Face merging cleanups
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-382
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-384
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-385
src/xfaces.c (push_named_merge_point): Return 0 if a cycle is detected
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-386
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-395
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-396
Tweak arch tagging to make build/install-in-place less annoying
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-397
Work around vc-arch problems when building eshell
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-398
Tweak permissions
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-399
Tweak directory permissions
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-400
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-401
More build-in-place tweaking of arch tagging
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-402
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-403
Yet more build-in-place tweaking of arch tagging
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-404
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-409
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-410
Make sure image types are initialized for lookup too
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-411
- miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-416
Update from CVS
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 28 Jun 2004 07:56:49 +0000 |
parents | 68c22ea6027c 9650d55ad73d |
children | d8411455de48 |
comparison
equal
deleted
inserted
replaced
89942:9cb747ae49af | 89943:4c90ffeb71c5 |
---|---|
237 (let ((map (make-sparse-keymap "Emacs-Lisp"))) | 237 (let ((map (make-sparse-keymap "Emacs-Lisp"))) |
238 (setq emacs-lisp-mode-map (make-sparse-keymap)) | 238 (setq emacs-lisp-mode-map (make-sparse-keymap)) |
239 (set-keymap-parent emacs-lisp-mode-map lisp-mode-shared-map) | 239 (set-keymap-parent emacs-lisp-mode-map lisp-mode-shared-map) |
240 (define-key emacs-lisp-mode-map "\e\t" 'lisp-complete-symbol) | 240 (define-key emacs-lisp-mode-map "\e\t" 'lisp-complete-symbol) |
241 (define-key emacs-lisp-mode-map "\e\C-x" 'eval-defun) | 241 (define-key emacs-lisp-mode-map "\e\C-x" 'eval-defun) |
242 (define-key emacs-lisp-mode-map "\e\C-q" 'indent-pp-sexp) | |
242 (define-key emacs-lisp-mode-map [menu-bar] (make-sparse-keymap)) | 243 (define-key emacs-lisp-mode-map [menu-bar] (make-sparse-keymap)) |
243 (define-key emacs-lisp-mode-map [menu-bar emacs-lisp] | 244 (define-key emacs-lisp-mode-map [menu-bar emacs-lisp] |
244 (cons "Emacs-Lisp" map)) | 245 (cons "Emacs-Lisp" map)) |
245 (define-key map [edebug-defun] | 246 (define-key map [edebug-defun] |
246 '("Instrument Function for Debugging" . edebug-defun)) | 247 '("Instrument Function for Debugging" . edebug-defun)) |
353 (make-local-variable 'font-lock-keywords-case-fold-search) | 354 (make-local-variable 'font-lock-keywords-case-fold-search) |
354 (setq font-lock-keywords-case-fold-search t) | 355 (setq font-lock-keywords-case-fold-search t) |
355 (setq imenu-case-fold-search t) | 356 (setq imenu-case-fold-search t) |
356 (set-syntax-table lisp-mode-syntax-table) | 357 (set-syntax-table lisp-mode-syntax-table) |
357 (run-mode-hooks 'lisp-mode-hook)) | 358 (run-mode-hooks 'lisp-mode-hook)) |
359 (put 'lisp-mode 'find-tag-default-function 'lisp-find-tag-default) | |
360 | |
361 (defun lisp-find-tag-default () | |
362 (let ((default (find-tag-default))) | |
363 (when (stringp default) | |
364 (if (string-match ":+" default) | |
365 (substring default (match-end 0)) | |
366 default)))) | |
358 | 367 |
359 ;; Used in old LispM code. | 368 ;; Used in old LispM code. |
360 (defalias 'common-lisp-mode 'lisp-mode) | 369 (defalias 'common-lisp-mode 'lisp-mode) |
361 | 370 |
362 ;; This will do unless inf-lisp.el is loaded. | 371 ;; This will do unless inf-lisp.el is loaded. |
367 | 376 |
368 (defvar lisp-interaction-mode-map | 377 (defvar lisp-interaction-mode-map |
369 (let ((map (make-sparse-keymap))) | 378 (let ((map (make-sparse-keymap))) |
370 (set-keymap-parent map lisp-mode-shared-map) | 379 (set-keymap-parent map lisp-mode-shared-map) |
371 (define-key map "\e\C-x" 'eval-defun) | 380 (define-key map "\e\C-x" 'eval-defun) |
381 (define-key map "\e\C-q" 'indent-pp-sexp) | |
372 (define-key map "\e\t" 'lisp-complete-symbol) | 382 (define-key map "\e\t" 'lisp-complete-symbol) |
373 (define-key map "\n" 'eval-print-last-sexp) | 383 (define-key map "\n" 'eval-print-last-sexp) |
374 map) | 384 map) |
375 "Keymap for Lisp Interaction mode. | 385 "Keymap for Lisp Interaction mode. |
376 All commands in `lisp-mode-shared-map' are inherited by this map.") | 386 All commands in `lisp-mode-shared-map' are inherited by this map.") |
446 | 456 |
447 (defun prin1-char (char) | 457 (defun prin1-char (char) |
448 "Return a string representing CHAR as a character rather than as an integer. | 458 "Return a string representing CHAR as a character rather than as an integer. |
449 If CHAR is not a character, return nil." | 459 If CHAR is not a character, return nil." |
450 (and (integerp char) | 460 (and (integerp char) |
451 (characterp (event-basic-type char)) | 461 (eventp char) |
452 (let ((c (event-basic-type char))) | 462 (let ((c (event-basic-type char))) |
453 (concat | 463 (concat |
454 "?" | 464 "?" |
455 (mapconcat | 465 (mapconcat |
456 (lambda (modif) | 466 (lambda (modif) |
458 (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-)))) | 468 (t (string ?\\ (upcase (aref (symbol-name modif) 0)) ?-)))) |
459 (event-modifiers char) "") | 469 (event-modifiers char) "") |
460 (cond | 470 (cond |
461 ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c)) | 471 ((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c)) |
462 ((eq c 127) "\\C-?") | 472 ((eq c 127) "\\C-?") |
463 (t (string c))))))) | 473 (t |
474 (condition-case nil | |
475 (string c) | |
476 (error nil)))))))) | |
464 | 477 |
465 (defun eval-last-sexp-1 (eval-last-sexp-arg-internal) | 478 (defun eval-last-sexp-1 (eval-last-sexp-arg-internal) |
466 "Evaluate sexp before point; print value in minibuffer. | 479 "Evaluate sexp before point; print value in minibuffer. |
467 With argument, print output into current buffer." | 480 With argument, print output into current buffer." |
468 (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))) | 481 (let ((standard-output (if eval-last-sexp-arg-internal (current-buffer) t))) |
522 (defun eval-last-sexp-print-value (value) | 535 (defun eval-last-sexp-print-value (value) |
523 (let ((unabbreviated (let ((print-length nil) (print-level nil)) | 536 (let ((unabbreviated (let ((print-length nil) (print-level nil)) |
524 (prin1-to-string value))) | 537 (prin1-to-string value))) |
525 (print-length eval-expression-print-length) | 538 (print-length eval-expression-print-length) |
526 (print-level eval-expression-print-level) | 539 (print-level eval-expression-print-level) |
527 (char-string (prin1-char value)) | |
528 (beg (point)) | 540 (beg (point)) |
529 end) | 541 end) |
530 (prog1 | 542 (prog1 |
531 (prin1 value) | 543 (prin1 value) |
532 (if (and (eq standard-output t) char-string) | 544 (let ((str (eval-expression-print-format value))) |
533 (princ (concat " = " char-string))) | 545 (if str (princ str))) |
534 (setq end (point)) | 546 (setq end (point)) |
535 (when (and (bufferp standard-output) | 547 (when (and (bufferp standard-output) |
536 (or (not (null print-length)) | 548 (or (not (null print-length)) |
537 (not (null print-level))) | 549 (not (null print-level))) |
538 (not (string= unabbreviated | 550 (not (string= unabbreviated |
556 (unless (eq old-value new-value) | 568 (unless (eq old-value new-value) |
557 (setq debug-on-error new-value)) | 569 (setq debug-on-error new-value)) |
558 value))) | 570 value))) |
559 | 571 |
560 (defun eval-defun-1 (form) | 572 (defun eval-defun-1 (form) |
561 "Change defvar into defconst within FORM. | 573 "Treat some expressions specially. |
562 Likewise for other constructs as necessary." | 574 Reset the `defvar' and `defcustom' variables to the initial value. |
575 Reinitialize the face according to the `defface' specification." | |
563 ;; The code in edebug-defun should be consistent with this, but not | 576 ;; The code in edebug-defun should be consistent with this, but not |
564 ;; the same, since this gets a macroexpended form. | 577 ;; the same, since this gets a macroexpended form. |
565 (cond ((not (listp form)) | 578 (cond ((not (listp form)) |
566 form) | 579 form) |
567 ((and (eq (car form) 'defvar) | 580 ((and (eq (car form) 'defvar) |
574 ;; `custom-declare-variable' with a quoted value arg. | 587 ;; `custom-declare-variable' with a quoted value arg. |
575 ((and (eq (car form) 'custom-declare-variable) | 588 ((and (eq (car form) 'custom-declare-variable) |
576 (default-boundp (eval (nth 1 form)))) | 589 (default-boundp (eval (nth 1 form)))) |
577 ;; Force variable to be bound. | 590 ;; Force variable to be bound. |
578 (set-default (eval (nth 1 form)) (eval (nth 1 (nth 2 form)))) | 591 (set-default (eval (nth 1 form)) (eval (nth 1 (nth 2 form)))) |
592 form) | |
593 ;; `defface' is macroexpanded to `custom-declare-face'. | |
594 ((eq (car form) 'custom-declare-face) | |
595 ;; Reset the face. | |
596 (put (eval (nth 1 form)) 'face-defface-spec nil) | |
597 (setq face-new-frame-defaults | |
598 (assq-delete-all (eval (nth 1 form)) face-new-frame-defaults)) | |
579 form) | 599 form) |
580 ((eq (car form) 'progn) | 600 ((eq (car form) 'progn) |
581 (cons 'progn (mapcar 'eval-defun-1 (cdr form)))) | 601 (cons 'progn (mapcar 'eval-defun-1 (cdr form)))) |
582 (t form))) | 602 (t form))) |
583 | 603 |
610 (end-of-defun) | 630 (end-of-defun) |
611 (beginning-of-defun) | 631 (beginning-of-defun) |
612 (setq beg (point)) | 632 (setq beg (point)) |
613 (setq form (read (current-buffer))) | 633 (setq form (read (current-buffer))) |
614 (setq end (point))) | 634 (setq end (point))) |
615 ;; Alter the form if necessary, changing defvar into defconst, etc. | 635 ;; Alter the form if necessary. |
616 (setq form (eval-defun-1 (macroexpand form))) | 636 (setq form (eval-defun-1 (macroexpand form))) |
617 (list beg end standard-output | 637 (list beg end standard-output |
618 `(lambda (ignore) | 638 `(lambda (ignore) |
619 ;; Skipping to the end of the specified region | 639 ;; Skipping to the end of the specified region |
620 ;; will make eval-region return. | 640 ;; will make eval-region return. |
1082 (and (bolp) (not (eolp)) | 1102 (and (bolp) (not (eolp)) |
1083 (lisp-indent-line)) | 1103 (lisp-indent-line)) |
1084 (indent-sexp endmark) | 1104 (indent-sexp endmark) |
1085 (set-marker endmark nil)))) | 1105 (set-marker endmark nil)))) |
1086 | 1106 |
1107 (defun indent-pp-sexp (&optional arg) | |
1108 "Indent each line of the list or, with prefix ARG, pretty-printify the list." | |
1109 (interactive "P") | |
1110 (if arg | |
1111 (save-excursion | |
1112 (save-restriction | |
1113 (narrow-to-region (point) (progn (forward-sexp 1) (point))) | |
1114 (pp-buffer) | |
1115 (goto-char (point-max)) | |
1116 (if (eq (char-before) ?\n) | |
1117 (delete-char -1))))) | |
1118 (indent-sexp)) | |
1119 | |
1087 ;;;; Lisp paragraph filling commands. | 1120 ;;;; Lisp paragraph filling commands. |
1088 | 1121 |
1089 (defcustom emacs-lisp-docstring-fill-column 65 | 1122 (defcustom emacs-lisp-docstring-fill-column 65 |
1090 "Value of `fill-column' to use when filling a docstring. | 1123 "Value of `fill-column' to use when filling a docstring. |
1091 Any non-integer value means do not use a different value of | 1124 Any non-integer value means do not use a different value of |