239 |
(set-keymap-parent emacs-lisp-mode-map lisp-mode-shared-map) |
(set-keymap-parent emacs-lisp-mode-map lisp-mode-shared-map) |
240 |
(define-key emacs-lisp-mode-map "\e\t" 'lisp-complete-symbol) |
(define-key emacs-lisp-mode-map "\e\t" 'lisp-complete-symbol) |
241 |
(define-key emacs-lisp-mode-map "\e\C-x" 'eval-defun) |
(define-key emacs-lisp-mode-map "\e\C-x" 'eval-defun) |
242 |
|
(define-key emacs-lisp-mode-map "\e\C-q" 'indent-pp-sexp) |
243 |
(define-key emacs-lisp-mode-map [menu-bar] (make-sparse-keymap)) |
(define-key emacs-lisp-mode-map [menu-bar] (make-sparse-keymap)) |
244 |
(define-key emacs-lisp-mode-map [menu-bar emacs-lisp] |
(define-key emacs-lisp-mode-map [menu-bar emacs-lisp] |
245 |
(cons "Emacs-Lisp" map)) |
(cons "Emacs-Lisp" map)) |
356 |
(setq imenu-case-fold-search t) |
(setq imenu-case-fold-search t) |
357 |
(set-syntax-table lisp-mode-syntax-table) |
(set-syntax-table lisp-mode-syntax-table) |
358 |
(run-mode-hooks 'lisp-mode-hook)) |
(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)))) |
367 |
|
|
368 |
;; Used in old LispM code. |
;; Used in old LispM code. |
369 |
(defalias 'common-lisp-mode 'lisp-mode) |
(defalias 'common-lisp-mode 'lisp-mode) |
378 |
(let ((map (make-sparse-keymap))) |
(let ((map (make-sparse-keymap))) |
379 |
(set-keymap-parent map lisp-mode-shared-map) |
(set-keymap-parent map lisp-mode-shared-map) |
380 |
(define-key map "\e\C-x" 'eval-defun) |
(define-key map "\e\C-x" 'eval-defun) |
381 |
|
(define-key map "\e\C-q" 'indent-pp-sexp) |
382 |
(define-key map "\e\t" 'lisp-complete-symbol) |
(define-key map "\e\t" 'lisp-complete-symbol) |
383 |
(define-key map "\n" 'eval-print-last-sexp) |
(define-key map "\n" 'eval-print-last-sexp) |
384 |
map) |
map) |
458 |
"Return a string representing CHAR as a character rather than as an integer. |
"Return a string representing CHAR as a character rather than as an integer. |
459 |
If CHAR is not a character, return nil." |
If CHAR is not a character, return nil." |
460 |
(and (integerp char) |
(and (integerp char) |
461 |
(characterp (event-basic-type char)) |
(eventp char) |
462 |
(let ((c (event-basic-type char))) |
(let ((c (event-basic-type char))) |
463 |
(concat |
(concat |
464 |
"?" |
"?" |
470 |
(cond |
(cond |
471 |
((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c)) |
((memq c '(?\; ?\( ?\) ?\{ ?\} ?\[ ?\] ?\" ?\' ?\\)) (string ?\\ c)) |
472 |
((eq c 127) "\\C-?") |
((eq c 127) "\\C-?") |
473 |
(t (string c))))))) |
(t |
474 |
|
(condition-case nil |
475 |
|
(string c) |
476 |
|
(error nil)))))))) |
477 |
|
|
478 |
(defun eval-last-sexp-1 (eval-last-sexp-arg-internal) |
(defun eval-last-sexp-1 (eval-last-sexp-arg-internal) |
479 |
"Evaluate sexp before point; print value in minibuffer. |
"Evaluate sexp before point; print value in minibuffer. |
537 |
(prin1-to-string value))) |
(prin1-to-string value))) |
538 |
(print-length eval-expression-print-length) |
(print-length eval-expression-print-length) |
539 |
(print-level eval-expression-print-level) |
(print-level eval-expression-print-level) |
|
(char-string (prin1-char value)) |
|
540 |
(beg (point)) |
(beg (point)) |
541 |
end) |
end) |
542 |
(prog1 |
(prog1 |
543 |
(prin1 value) |
(prin1 value) |
544 |
(if (and (eq standard-output t) char-string) |
(let ((str (eval-expression-print-format value))) |
545 |
(princ (concat " = " char-string))) |
(if str (princ str))) |
546 |
(setq end (point)) |
(setq end (point)) |
547 |
(when (and (bufferp standard-output) |
(when (and (bufferp standard-output) |
548 |
(or (not (null print-length)) |
(or (not (null print-length)) |
570 |
value))) |
value))) |
571 |
|
|
572 |
(defun eval-defun-1 (form) |
(defun eval-defun-1 (form) |
573 |
"Change defvar into defconst within FORM. |
"Treat some expressions specially. |
574 |
Likewise for other constructs as necessary." |
Reset the `defvar' and `defcustom' variables to the initial value. |
575 |
|
Reinitialize the face according to the `defface' specification." |
576 |
;; The code in edebug-defun should be consistent with this, but not |
;; The code in edebug-defun should be consistent with this, but not |
577 |
;; the same, since this gets a macroexpended form. |
;; the same, since this gets a macroexpended form. |
578 |
(cond ((not (listp form)) |
(cond ((not (listp form)) |
590 |
;; Force variable to be bound. |
;; Force variable to be bound. |
591 |
(set-default (eval (nth 1 form)) (eval (nth 1 (nth 2 form)))) |
(set-default (eval (nth 1 form)) (eval (nth 1 (nth 2 form)))) |
592 |
form) |
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)) |
599 |
|
form) |
600 |
((eq (car form) 'progn) |
((eq (car form) 'progn) |
601 |
(cons 'progn (mapcar 'eval-defun-1 (cdr form)))) |
(cons 'progn (mapcar 'eval-defun-1 (cdr form)))) |
602 |
(t form))) |
(t form))) |
632 |
(setq beg (point)) |
(setq beg (point)) |
633 |
(setq form (read (current-buffer))) |
(setq form (read (current-buffer))) |
634 |
(setq end (point))) |
(setq end (point))) |
635 |
;; Alter the form if necessary, changing defvar into defconst, etc. |
;; Alter the form if necessary. |
636 |
(setq form (eval-defun-1 (macroexpand form))) |
(setq form (eval-defun-1 (macroexpand form))) |
637 |
(list beg end standard-output |
(list beg end standard-output |
638 |
`(lambda (ignore) |
`(lambda (ignore) |
1104 |
(indent-sexp endmark) |
(indent-sexp endmark) |
1105 |
(set-marker endmark nil)))) |
(set-marker endmark nil)))) |
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 |
|
|
1120 |
;;;; Lisp paragraph filling commands. |
;;;; Lisp paragraph filling commands. |
1121 |
|
|
1122 |
(defcustom emacs-lisp-docstring-fill-column 65 |
(defcustom emacs-lisp-docstring-fill-column 65 |