comparison lisp/cus-edit.el @ 19883:519eab181c36

(custom-face-menu): Use custom-face-save-command. not custom-face-save. (custom-face-save-command): New function. (custom-variable-save): Fix error message.
author Richard M. Stallman <rms@gnu.org>
date Fri, 12 Sep 1997 07:04:41 +0000
parents 0c1b4a44db76
children 539d06d1f0da
comparison
equal deleted inserted replaced
19882:b6aaf1f70676 19883:519eab181c36
1845 (t 1845 (t
1846 ;; Edit mode. 1846 ;; Edit mode.
1847 (let* ((format (widget-get type :format)) 1847 (let* ((format (widget-get type :format))
1848 tag-format value-format) 1848 tag-format value-format)
1849 (unless (string-match ":" format) 1849 (unless (string-match ":" format)
1850 (error "Bad format.")) 1850 (error "Bad format"))
1851 (setq tag-format (substring format 0 (match-end 0))) 1851 (setq tag-format (substring format 0 (match-end 0)))
1852 (setq value-format (substring format (match-end 0))) 1852 (setq value-format (substring format (match-end 0)))
1853 (push (widget-create-child-and-convert 1853 (push (widget-create-child-and-convert
1854 widget 'item 1854 widget 'item
1855 :format tag-format 1855 :format tag-format
2007 (child (car (widget-get widget :children))) 2007 (child (car (widget-get widget :children)))
2008 (symbol (widget-value widget)) 2008 (symbol (widget-value widget))
2009 (set (or (get symbol 'custom-set) 'set-default)) 2009 (set (or (get symbol 'custom-set) 'set-default))
2010 val) 2010 val)
2011 (cond ((eq state 'hidden) 2011 (cond ((eq state 'hidden)
2012 (error "Cannot set hidden variable.")) 2012 (error "Cannot set hidden variable"))
2013 ((setq val (widget-apply child :validate)) 2013 ((setq val (widget-apply child :validate))
2014 (goto-char (widget-get val :from)) 2014 (goto-char (widget-get val :from))
2015 (error "%s" (widget-get val :error))) 2015 (error "%s" (widget-get val :error)))
2016 ((memq form '(lisp mismatch)) 2016 ((memq form '(lisp mismatch))
2017 (funcall set symbol (eval (setq val (widget-value child)))) 2017 (funcall set symbol (eval (setq val (widget-value child))))
2029 (child (car (widget-get widget :children))) 2029 (child (car (widget-get widget :children)))
2030 (symbol (widget-value widget)) 2030 (symbol (widget-value widget))
2031 (set (or (get symbol 'custom-set) 'set-default)) 2031 (set (or (get symbol 'custom-set) 'set-default))
2032 val) 2032 val)
2033 (cond ((eq state 'hidden) 2033 (cond ((eq state 'hidden)
2034 (error "Cannot set hidden variable.")) 2034 (error "Cannot set hidden variable"))
2035 ((setq val (widget-apply child :validate)) 2035 ((setq val (widget-apply child :validate))
2036 (goto-char (widget-get val :from)) 2036 (goto-char (widget-get val :from))
2037 (error "%s" (widget-get val :error))) 2037 (error "%s" (widget-get val :error)))
2038 ((memq form '(lisp mismatch)) 2038 ((memq form '(lisp mismatch))
2039 (put symbol 'saved-value (list (widget-value child))) 2039 (put symbol 'saved-value (list (widget-value child)))
2313 (widget-put widget :children (list edit))) 2313 (widget-put widget :children (list edit)))
2314 (message "Creating face editor...done")))))) 2314 (message "Creating face editor...done"))))))
2315 2315
2316 (defvar custom-face-menu 2316 (defvar custom-face-menu
2317 '(("Set for Current Session" custom-face-set) 2317 '(("Set for Current Session" custom-face-set)
2318 ("Save for Future Sessions" custom-face-save) 2318 ("Save for Future Sessions" custom-face-save-command)
2319 ("Reset to Saved" custom-face-reset-saved 2319 ("Reset to Saved" custom-face-reset-saved
2320 (lambda (widget) 2320 (lambda (widget)
2321 (get (widget-value widget) 'saved-face))) 2321 (get (widget-value widget) 'saved-face)))
2322 ("Reset to Standard Setting" custom-face-reset-standard 2322 ("Reset to Standard Setting" custom-face-reset-standard
2323 (lambda (widget) 2323 (lambda (widget)
2392 (put symbol 'customized-face value) 2392 (put symbol 'customized-face value)
2393 (face-spec-set symbol value) 2393 (face-spec-set symbol value)
2394 (custom-face-state-set widget) 2394 (custom-face-state-set widget)
2395 (custom-redraw-magic widget))) 2395 (custom-redraw-magic widget)))
2396 2396
2397 (defun custom-face-save-command (widget)
2398 "Save in `.emacs' the face attributes in WIDGET."
2399 (custom-face-save widget)
2400 (custom-save-all))
2401
2397 (defun custom-face-save (widget) 2402 (defun custom-face-save (widget)
2398 "Make the face attributes in WIDGET default." 2403 "Prepare for saving WIDGET's face attributes, but don't write `.emacs'."
2399 (let* ((symbol (widget-value widget)) 2404 (let* ((symbol (widget-value widget))
2400 (child (car (widget-get widget :children))) 2405 (child (car (widget-get widget :children)))
2401 (value (widget-value child))) 2406 (value (widget-value child)))
2402 (face-spec-set symbol value) 2407 (face-spec-set symbol value)
2403 (put symbol 'saved-face value) 2408 (put symbol 'saved-face value)