Mercurial > emacs
comparison lisp/emacs-lisp/lisp-mode.el @ 56003:9650d55ad73d
(eval-defun-1): Add `defface'. Fix docstring.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Thu, 10 Jun 2004 04:16:05 +0000 |
parents | fcd2e17daffa |
children | c28ce21eb5ae 4c90ffeb71c5 |
comparison
equal
deleted
inserted
replaced
56002:80100e7e948a | 56003:9650d55ad73d |
---|---|
568 (unless (eq old-value new-value) | 568 (unless (eq old-value new-value) |
569 (setq debug-on-error new-value)) | 569 (setq debug-on-error new-value)) |
570 value))) | 570 value))) |
571 | 571 |
572 (defun eval-defun-1 (form) | 572 (defun eval-defun-1 (form) |
573 "Change defvar into defconst within FORM. | 573 "Treat some expressions specially. |
574 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." | |
575 ;; 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 |
576 ;; the same, since this gets a macroexpended form. | 577 ;; the same, since this gets a macroexpended form. |
577 (cond ((not (listp form)) | 578 (cond ((not (listp form)) |
578 form) | 579 form) |
579 ((and (eq (car form) 'defvar) | 580 ((and (eq (car form) 'defvar) |
586 ;; `custom-declare-variable' with a quoted value arg. | 587 ;; `custom-declare-variable' with a quoted value arg. |
587 ((and (eq (car form) 'custom-declare-variable) | 588 ((and (eq (car form) 'custom-declare-variable) |
588 (default-boundp (eval (nth 1 form)))) | 589 (default-boundp (eval (nth 1 form)))) |
589 ;; Force variable to be bound. | 590 ;; Force variable to be bound. |
590 (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)) | |
591 form) | 599 form) |
592 ((eq (car form) 'progn) | 600 ((eq (car form) 'progn) |
593 (cons 'progn (mapcar 'eval-defun-1 (cdr form)))) | 601 (cons 'progn (mapcar 'eval-defun-1 (cdr form)))) |
594 (t form))) | 602 (t form))) |
595 | 603 |
622 (end-of-defun) | 630 (end-of-defun) |
623 (beginning-of-defun) | 631 (beginning-of-defun) |
624 (setq beg (point)) | 632 (setq beg (point)) |
625 (setq form (read (current-buffer))) | 633 (setq form (read (current-buffer))) |
626 (setq end (point))) | 634 (setq end (point))) |
627 ;; Alter the form if necessary, changing defvar into defconst, etc. | 635 ;; Alter the form if necessary. |
628 (setq form (eval-defun-1 (macroexpand form))) | 636 (setq form (eval-defun-1 (macroexpand form))) |
629 (list beg end standard-output | 637 (list beg end standard-output |
630 `(lambda (ignore) | 638 `(lambda (ignore) |
631 ;; Skipping to the end of the specified region | 639 ;; Skipping to the end of the specified region |
632 ;; will make eval-region return. | 640 ;; will make eval-region return. |