Mercurial > hg > xemacs-beta
comparison lisp/cus-edit.el @ 444:576fb035e263 r21-2-37
Import from CVS: tag r21-2-37
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:36:19 +0200 |
parents | abe6d1db359e |
children | e7ef97881643 |
comparison
equal
deleted
inserted
replaced
443:a8296e22da4e | 444:576fb035e263 |
---|---|
680 (put var 'variable-comment nil)) | 680 (put var 'variable-comment nil)) |
681 (comment | 681 (comment |
682 (put var 'variable-comment comment)))) | 682 (put var 'variable-comment comment)))) |
683 | 683 |
684 ;;;###autoload | 684 ;;;###autoload |
685 (defun customize-set-variable (var val &optional comment) | 685 (defun customize-set-variable (variable value &optional comment) |
686 "Set the default for VARIABLE to VALUE. VALUE is a Lisp object. | 686 "Set the default for VARIABLE to VALUE. VALUE is any Lisp object. |
687 | 687 |
688 If VARIABLE has a `custom-set' property, that is used for setting | 688 If VARIABLE has a `custom-set' property, that is used for setting |
689 VARIABLE, otherwise `set-default' is used. | 689 VARIABLE, otherwise `set-default' is used. |
690 | 690 |
691 The `customized-value' property of the VARIABLE will be set to a list | 691 The `customized-value' property of the VARIABLE will be set to a list |
699 | 699 |
700 If given a prefix (or a COMMENT argument), also prompt for a comment." | 700 If given a prefix (or a COMMENT argument), also prompt for a comment." |
701 (interactive (custom-prompt-variable "Set variable: " | 701 (interactive (custom-prompt-variable "Set variable: " |
702 "Set customized value for %s to: " | 702 "Set customized value for %s to: " |
703 current-prefix-arg)) | 703 current-prefix-arg)) |
704 (funcall (or (get var 'custom-set) 'set-default) var val) | 704 (funcall (or (get variable 'custom-set) 'set-default) variable value) |
705 (put var 'customized-value (list (custom-quote val))) | 705 (put variable 'customized-value (list (custom-quote value))) |
706 (cond ((string= comment "") | 706 (cond ((string= comment "") |
707 (put var 'variable-comment nil) | 707 (put variable 'variable-comment nil) |
708 (put var 'customized-variable-comment nil)) | 708 (put variable 'customized-variable-comment nil)) |
709 (comment | 709 (comment |
710 (put var 'variable-comment comment) | 710 (put variable 'variable-comment comment) |
711 (put var 'customized-variable-comment comment)))) | 711 (put variable 'customized-variable-comment comment)))) |
712 | 712 |
713 | 713 |
714 ;;;###autoload | 714 ;;;###autoload |
715 (defun customize-save-variable (var val &optional comment) | 715 (defun customize-save-variable (variable value &optional comment) |
716 "Set the default for VARIABLE to VALUE, and save it for future sessions. | 716 "Set the default for VARIABLE to VALUE, and save it for future sessions. |
717 If VARIABLE has a `custom-set' property, that is used for setting | 717 If VARIABLE has a `custom-set' property, that is used for setting |
718 VARIABLE, otherwise `set-default' is used. | 718 VARIABLE, otherwise `set-default' is used. |
719 | 719 |
720 The `customized-value' property of the VARIABLE will be set to a list | 720 The `customized-value' property of the VARIABLE will be set to a list |
728 | 728 |
729 If given a prefix (or a COMMENT argument), also prompt for a comment." | 729 If given a prefix (or a COMMENT argument), also prompt for a comment." |
730 (interactive (custom-prompt-variable "Set and ave variable: " | 730 (interactive (custom-prompt-variable "Set and ave variable: " |
731 "Set and save value for %s as: " | 731 "Set and save value for %s as: " |
732 current-prefix-arg)) | 732 current-prefix-arg)) |
733 (funcall (or (get var 'custom-set) 'set-default) var val) | 733 (funcall (or (get variable 'custom-set) 'set-default) variable value) |
734 (put var 'saved-value (list (custom-quote val))) | 734 (put variable 'saved-value (list (custom-quote value))) |
735 (custom-push-theme 'theme-value var 'user 'set (list (custom-quote val))) | 735 (custom-push-theme 'theme-value variable 'user 'set (list (custom-quote value))) |
736 (cond ((string= comment "") | 736 (cond ((string= comment "") |
737 (put var 'variable-comment nil) | 737 (put variable 'variable-comment nil) |
738 (put var 'saved-variable-comment nil)) | 738 (put variable 'saved-variable-comment nil)) |
739 (comment | 739 (comment |
740 (put var 'variable-comment comment) | 740 (put variable 'variable-comment comment) |
741 (put var 'saved-variable-comment comment))) | 741 (put variable 'saved-variable-comment comment))) |
742 (custom-save-all)) | 742 (custom-save-all)) |
743 | 743 |
744 ;;;###autoload | 744 ;;;###autoload |
745 (defun customize (group) | 745 (defun customize (group) |
746 "Select a customization buffer which you can use to set user options. | 746 "Select a customization buffer which you can use to set user options. |
1986 (widget-put widget :custom-magic magic) | 1986 (widget-put widget :custom-magic magic) |
1987 (push magic buttons)) | 1987 (push magic buttons)) |
1988 ;; Insert documentation. | 1988 ;; Insert documentation. |
1989 ;; #### NOTE: this is ugly!!!! I need to do update the :buttons property | 1989 ;; #### NOTE: this is ugly!!!! I need to do update the :buttons property |
1990 ;; before the call to `widget-default-format-handler'. Otherwise, I | 1990 ;; before the call to `widget-default-format-handler'. Otherwise, I |
1991 ;; loose my current `buttons'. This function shouldn't be called like | 1991 ;; lose my current `buttons'. This function shouldn't be called like |
1992 ;; this anyway. The doc string widget should be added like the others. | 1992 ;; this anyway. The doc string widget should be added like the others. |
1993 ;; --dv | 1993 ;; --dv |
1994 (widget-put widget :buttons buttons) | 1994 (widget-put widget :buttons buttons) |
1995 (widget-default-format-handler widget ?h) | 1995 (widget-default-format-handler widget ?h) |
1996 ;; The comment field | 1996 ;; The comment field |
3268 (custom-save-resets 'theme-value 'custom-reset-variables nil) | 3268 (custom-save-resets 'theme-value 'custom-reset-variables nil) |
3269 (let ((standard-output (current-buffer))) | 3269 (let ((standard-output (current-buffer))) |
3270 (unless (bolp) | 3270 (unless (bolp) |
3271 (princ "\n")) | 3271 (princ "\n")) |
3272 (princ "(custom-set-variables") | 3272 (princ "(custom-set-variables") |
3273 (mapatoms (lambda (symbol) | 3273 (mapatoms (lambda (symbol) |
3274 (let ((spec (car-safe (get symbol 'theme-value))) | 3274 (let ((spec (car-safe (get symbol 'theme-value))) |
3275 (requests (get symbol 'custom-requests)) | 3275 (requests (get symbol 'custom-requests)) |
3276 (now (not (or (get symbol 'standard-value) | 3276 (now (not (or (get symbol 'standard-value) |
3277 (and (not (boundp symbol)) | 3277 (and (not (boundp symbol)) |
3278 (not (eq (get symbol 'force-value) | 3278 (not (eq (get symbol 'force-value) |
3343 (princ "\n"))))) | 3343 (princ "\n"))))) |
3344 | 3344 |
3345 (defun custom-save-resets (property setter special) | 3345 (defun custom-save-resets (property setter special) |
3346 (let (started-writing ignored-special) | 3346 (let (started-writing ignored-special) |
3347 (setq ignored-special ignored-special) ;; suppress byte-compiler warning | 3347 (setq ignored-special ignored-special) ;; suppress byte-compiler warning |
3348 ;; (custom-save-delete setter) Done by caller | 3348 ;; (custom-save-delete setter) Done by caller |
3349 (let ((standard-output (current-buffer)) | 3349 (let ((standard-output (current-buffer)) |
3350 (mapper `(lambda (object) | 3350 (mapper `(lambda (object) |
3351 (let ((spec (car-safe (get object (quote ,property))))) | 3351 (let ((spec (car-safe (get object (quote ,property))))) |
3352 (when (and (not (memq object ignored-special)) | 3352 (when (and (not (memq object ignored-special)) |
3353 (eq (car spec) 'user) | 3353 (eq (car spec) 'user) |
3368 (setq ignored-special special) | 3368 (setq ignored-special special) |
3369 (mapatoms mapper) | 3369 (mapatoms mapper) |
3370 (when started-writing | 3370 (when started-writing |
3371 (princ ")\n")))) | 3371 (princ ")\n")))) |
3372 ) | 3372 ) |
3373 | 3373 |
3374 | 3374 |
3375 (defun custom-save-loaded-themes () | 3375 (defun custom-save-loaded-themes () |
3376 (let ((themes (reverse (get 'user 'theme-loads-themes))) | 3376 (let ((themes (reverse (get 'user 'theme-loads-themes))) |
3377 (standard-output (current-buffer))) | 3377 (standard-output (current-buffer))) |
3378 (when themes | 3378 (when themes |
3379 (unless (bolp) (princ "\n")) | 3379 (unless (bolp) (princ "\n")) |
3380 (princ "(custom-load-themes") | 3380 (princ "(custom-load-themes") |
3381 (mapc (lambda (theme) | 3381 (mapc (lambda (theme) |
3382 (princ "\n '") | 3382 (princ "\n '") |
3383 (prin1 theme)) themes) | 3383 (prin1 theme)) themes) |
3384 (princ " )\n")))) | 3384 (princ " )\n")))) |
3385 | 3385 |
3386 ;;;###autoload | 3386 ;;;###autoload |
3387 (defun customize-save-customized () | 3387 (defun customize-save-customized () |
3388 "Save all user options which have been set in this session." | 3388 "Save all user options which have been set in this session." |
3389 (interactive) | 3389 (interactive) |