comparison lisp/cus-edit.el @ 17521:ddce9ecc6f6a

(custom-face-set): Don't copy an empty face, just call custom-face-display-set. (custom-face-reset-saved, custom-face-save, custom-face-reset-factory): Likewise. (custom-face-display-set): Define this here. (custom-display-match-frame): Define here.
author Richard M. Stallman <rms@gnu.org>
date Mon, 21 Apr 1997 03:55:17 +0000
parents 30a567b89fb6
children a5cf59eee84b
comparison
equal deleted inserted replaced
17520:f33d7729b6a1 17521:ddce9ecc6f6a
5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk> 5 ;; Author: Per Abrahamsen <abraham@dina.kvl.dk>
6 ;; Keywords: help, faces 6 ;; Keywords: help, faces
7 ;; Version: 1.84 7 ;; Version: 1.84
8 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/ 8 ;; X-URL: http://www.dina.kvl.dk/~abraham/custom/
9 9
10 ;; This file is part of GNU Emacs.
11
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; any later version.
16
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
26
10 ;;; Commentary: 27 ;;; Commentary:
11 ;; 28 ;;
12 ;; See `custom.el'. 29 ;; See `custom.el'.
13 30
14 ;;; Code: 31 ;;; Code:
15 32
16 (require 'cus-face) 33 (require 'cus-face)
17 (require 'wid-edit) 34 (require 'wid-edit)
18 (require 'easymenu) 35 (require 'easymenu)
36
37 (defun custom-face-display-set (face spec &optional frame)
38 (face-spec-set face spec frame))
39
40 (defun custom-display-match-frame (display frame)
41 (face-spec-set-match-display display frame))
19 42
20 (define-widget-keywords :custom-prefixes :custom-menu :custom-show 43 (define-widget-keywords :custom-prefixes :custom-menu :custom-show
21 :custom-magic :custom-state :custom-level :custom-form 44 :custom-magic :custom-state :custom-level :custom-form
22 :custom-set :custom-save :custom-reset-current :custom-reset-saved 45 :custom-set :custom-save :custom-reset-current :custom-reset-saved
23 :custom-reset-factory) 46 :custom-reset-factory)
1637 "Make the face attributes in WIDGET take effect." 1660 "Make the face attributes in WIDGET take effect."
1638 (let* ((symbol (widget-value widget)) 1661 (let* ((symbol (widget-value widget))
1639 (child (car (widget-get widget :children))) 1662 (child (car (widget-get widget :children)))
1640 (value (widget-value child))) 1663 (value (widget-value child)))
1641 (put symbol 'customized-face value) 1664 (put symbol 'customized-face value)
1642 (when (fboundp 'copy-face)
1643 (copy-face 'custom-face-empty symbol))
1644 (custom-face-display-set symbol value) 1665 (custom-face-display-set symbol value)
1645 (custom-face-state-set widget) 1666 (custom-face-state-set widget)
1646 (custom-redraw-magic widget))) 1667 (custom-redraw-magic widget)))
1647 1668
1648 (defun custom-face-save (widget) 1669 (defun custom-face-save (widget)
1649 "Make the face attributes in WIDGET default." 1670 "Make the face attributes in WIDGET default."
1650 (let* ((symbol (widget-value widget)) 1671 (let* ((symbol (widget-value widget))
1651 (child (car (widget-get widget :children))) 1672 (child (car (widget-get widget :children)))
1652 (value (widget-value child))) 1673 (value (widget-value child)))
1653 (when (fboundp 'copy-face)
1654 (copy-face 'custom-face-empty symbol))
1655 (custom-face-display-set symbol value) 1674 (custom-face-display-set symbol value)
1656 (put symbol 'saved-face value) 1675 (put symbol 'saved-face value)
1657 (put symbol 'customized-face nil) 1676 (put symbol 'customized-face nil)
1658 (custom-face-state-set widget) 1677 (custom-face-state-set widget)
1659 (custom-redraw-magic widget))) 1678 (custom-redraw-magic widget)))
1664 (child (car (widget-get widget :children))) 1683 (child (car (widget-get widget :children)))
1665 (value (get symbol 'saved-face))) 1684 (value (get symbol 'saved-face)))
1666 (unless value 1685 (unless value
1667 (error "No saved value for this face")) 1686 (error "No saved value for this face"))
1668 (put symbol 'customized-face nil) 1687 (put symbol 'customized-face nil)
1669 (when (fboundp 'copy-face)
1670 (copy-face 'custom-face-empty symbol))
1671 (custom-face-display-set symbol value) 1688 (custom-face-display-set symbol value)
1672 (widget-value-set child value) 1689 (widget-value-set child value)
1673 (custom-face-state-set widget) 1690 (custom-face-state-set widget)
1674 (custom-redraw-magic widget))) 1691 (custom-redraw-magic widget)))
1675 1692
1682 (error "No factory default for this face")) 1699 (error "No factory default for this face"))
1683 (put symbol 'customized-face nil) 1700 (put symbol 'customized-face nil)
1684 (when (get symbol 'saved-face) 1701 (when (get symbol 'saved-face)
1685 (put symbol 'saved-face nil) 1702 (put symbol 'saved-face nil)
1686 (custom-save-all)) 1703 (custom-save-all))
1687 (when (fboundp 'copy-face)
1688 (copy-face 'custom-face-empty symbol))
1689 (custom-face-display-set symbol value) 1704 (custom-face-display-set symbol value)
1690 (widget-value-set child value) 1705 (widget-value-set child value)
1691 (custom-face-state-set widget) 1706 (custom-face-state-set widget)
1692 (custom-redraw-magic widget))) 1707 (custom-redraw-magic widget)))
1693 1708