comparison lisp/cus-edit.el @ 49218:ddeb57b6c977

(customize-changed-options): Doc addition. Load the version deps earlier. Use other tests for groups and variables. Handle faces.
author Markus Rost <rost@math.uni-bielefeld.de>
date Mon, 13 Jan 2003 23:43:30 +0000
parents 697ca5db73b8
children b99be2b86231
comparison
equal deleted inserted replaced
49217:9b41cceb4485 49218:ddeb57b6c977
948 customization groups, as well as older options and faces whose default 948 customization groups, as well as older options and faces whose default
949 values have changed since the previous major Emacs release. 949 values have changed since the previous major Emacs release.
950 950
951 With argument SINCE-VERSION (a string), customize all user option 951 With argument SINCE-VERSION (a string), customize all user option
952 variables that were added (or their meanings were changed) since that 952 variables that were added (or their meanings were changed) since that
953 version." 953 version.
954
955 Custom version numbers are actually associated to symbols. A symbol
956 with version number VERSION will be listed with all its definitions as
957 custom variable, face, or group."
954 958
955 (interactive "sCustomize options changed, since version (default all versions): ") 959 (interactive "sCustomize options changed, since version (default all versions): ")
956 (if (equal since-version "") 960 (if (equal since-version "")
957 (setq since-version nil) 961 (setq since-version nil)
958 (unless (condition-case nil 962 (unless (condition-case nil
959 (numberp (read since-version)) 963 (numberp (read since-version))
960 (error nil)) 964 (error nil))
961 (signal 'wrong-type-argument (list 'numberp since-version)))) 965 (signal 'wrong-type-argument (list 'numberp since-version))))
962 (unless since-version 966 (unless since-version
963 (setq since-version customize-changed-options-previous-release)) 967 (setq since-version customize-changed-options-previous-release))
964 (let ((found nil) 968
965 (versions nil)) 969 ;; Load the information for versions since since-version. We use
966 (mapatoms (lambda (symbol) 970 ;; custom-load-symbol for this.
967 (and (or (boundp symbol) 971 (put 'custom-versions-load-alist 'custom-loads nil)
968 ;; For variables not yet loaded. 972 (dolist (elt custom-versions-load-alist)
969 (get symbol 'standard-value) 973 (if (customize-version-lessp since-version (car elt))
970 ;; For groups the previous test fails, this one 974 (dolist (load (cdr elt))
971 ;; could be used to determine if symbol is a 975 (custom-add-load 'custom-versions-load-alist load))))
972 ;; group. Is there a better way for this? 976 (custom-load-symbol 'custom-versions-load-alist)
973 (get symbol 'group-documentation)) 977 (put 'custom-versions-load-alist 'custom-loads nil)
974 (let ((version (get symbol 'custom-version))) 978
975 (and version 979 (let (found)
976 (or (null since-version) 980 (mapatoms
977 (customize-version-lessp since-version version)) 981 (lambda (symbol)
978 (if (member version versions) 982 (let ((version (get symbol 'custom-version)))
979 t 983 (if version
980 ;;; Collect all versions that we use. 984 (when (customize-version-lessp since-version version)
981 (push version versions)))) 985 (if (or (get symbol 'custom-group)
982 (setq found 986 (get symbol 'group-documentation))
983 ;; We have to set the right thing here, 987 (push (list symbol 'custom-group) found))
984 ;; depending if we have a group or a 988 (if (custom-variable-p symbol)
985 ;; variable. 989 (push (list symbol 'custom-variable) found))
986 (if (get symbol 'group-documentation) 990 (if (custom-facep symbol)
987 (cons (list symbol 'custom-group) found) 991 (push (list symbol 'custom-face) found)))))))
988 (cons (list symbol 'custom-variable) found)))))) 992 (if found
989 (if (not found) 993 (custom-buffer-create (custom-sort-items found t 'first)
990 (error "No user option defaults have been changed since Emacs %s" 994 "*Customize Changed Options*")
991 since-version) 995 (error "No user option defaults have been changed since Emacs %s"
992 (let ((flist nil)) 996 since-version))))
993 (while versions
994 (push (copy-sequence
995 (cdr (assoc (car versions) custom-versions-load-alist)))
996 flist)
997 (setq versions (cdr versions)))
998 (put 'custom-versions-load-alist 'custom-loads
999 ;; Get all the files that correspond to element from the
1000 ;; VERSIONS list. This could use some simplification.
1001 (apply 'nconc flist)))
1002 ;; Because we set all the files needed to be loaded as a
1003 ;; `custom-loads' property to `custom-versions-load-alist' this
1004 ;; call will actually load them.
1005 (custom-load-symbol 'custom-versions-load-alist)
1006 ;; Clean up
1007 (put 'custom-versions-load-alist 'custom-loads nil)
1008 (custom-buffer-create (custom-sort-items found t 'first)
1009 "*Customize Changed Options*"))))
1010 997
1011 (defun customize-version-lessp (version1 version2) 998 (defun customize-version-lessp (version1 version2)
1012 ;; Why are the versions strings, and given that they are, why aren't 999 ;; Why are the versions strings, and given that they are, why aren't
1013 ;; they converted to numbers and compared as such here? -- fx 1000 ;; they converted to numbers and compared as such here? -- fx
1014 1001