aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Nicolaescu1998-06-22 02:10:41 +0000
committerDan Nicolaescu1998-06-22 02:10:41 +0000
commit1e484d64bdb278a6f10be7d8d594ccd60b81c7a7 (patch)
tree59e7acde64723faaa06aeb8132fe1d6ddd533e8c
parente65f17fee9e4a4935dddd18c1f83313603612c86 (diff)
downloademacs-1e484d64bdb278a6f10be7d8d594ccd60b81c7a7.tar.gz
emacs-1e484d64bdb278a6f10be7d8d594ccd60b81c7a7.zip
*** empty log message ***
-rw-r--r--lisp/cus-dep.el70
-rw-r--r--lisp/cus-edit.el33
-rw-r--r--lisp/midnight.el29
3 files changed, 108 insertions, 24 deletions
diff --git a/lisp/cus-dep.el b/lisp/cus-dep.el
index 006197aa3ab..7674599b705 100644
--- a/lisp/cus-dep.el
+++ b/lisp/cus-dep.el
@@ -27,6 +27,7 @@
27(require 'cl) 27(require 'cl)
28(require 'widget) 28(require 'widget)
29(require 'cus-face) 29(require 'cus-face)
30(require 'autoload)
30 31
31(defun custom-make-dependencies () 32(defun custom-make-dependencies ()
32 "Batch function to extract custom dependencies from .el files. 33 "Batch function to extract custom dependencies from .el files.
@@ -40,7 +41,8 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS"
40 (message "Directory %s" (car all-subdirs)) 41 (message "Directory %s" (car all-subdirs))
41 (let ((files (directory-files (car all-subdirs) nil "\\`[^=].*\\.el\\'")) 42 (let ((files (directory-files (car all-subdirs) nil "\\`[^=].*\\.el\\'"))
42 (default-directory default-directory) 43 (default-directory default-directory)
43 file) 44 file
45 is-autoloaded)
44 (cd (car all-subdirs)) 46 (cd (car all-subdirs))
45 (while files 47 (while files
46 (setq file (car files) 48 (setq file (car files)
@@ -54,11 +56,17 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS"
54 (condition-case nil 56 (condition-case nil
55 (while (re-search-forward "^(defcustom\\|^(defface\\|^(defgroup" 57 (while (re-search-forward "^(defcustom\\|^(defface\\|^(defgroup"
56 nil t) 58 nil t)
59 (setq is-autoloaded nil)
57 (beginning-of-line) 60 (beginning-of-line)
61 (save-excursion
62 (forward-line -1)
63 (if (looking-at generate-autoload-cookie)
64 (setq is-autoloaded t)))
58 (let ((expr (read (current-buffer)))) 65 (let ((expr (read (current-buffer))))
59 (condition-case nil 66 (condition-case nil
60 (progn 67 (progn
61 (eval expr) 68 (eval expr)
69 (put (nth 1 expr) 'custom-autoloaded is-autoloaded)
62 (put (nth 1 expr) 'custom-where name)) 70 (put (nth 1 expr) 'custom-where name))
63 (error nil)))) 71 (error nil))))
64 (error nil))))) 72 (error nil)))))
@@ -91,6 +99,66 @@ Usage: emacs -batch -l ./cus-dep.el -f custom-make-dependencies DIRS"
91 (when found 99 (when found
92 (insert "))\n")))))) 100 (insert "))\n"))))))
93 (insert "\ 101 (insert "\
102;;; These are for handling :version. We need to have a minimum of
103;;; information so `custom-changed-variables' could do its job.
104;;; For both groups and variables we have to set `custom-version'.
105;;; For variables we also set the `standard-value' and for groups
106;;; `group-documentation' (which is shown in the customize buffer, so
107;;; we don't have to load the file containing the group.
108
109;;; `custom-versions-load-alist' is an alist that has as car a version
110;;; number and as elts the files that have variables that contain that
111;;; version. These files should be loaded before showing the
112;;; customization buffer that `customize-changed-options' generates.
113
114
115;;; This macro is used so we don't modify the information about
116;;; variables and groups if it's already set. (We don't know when
117;;; cus-load.el is going to be loaded and at that time some of the
118;;; files might be loaded and some others might not).
119(defmacro custom-put-if-not (symbol propname value)
120 `(unless (get ,symbol ,propname)
121 (put ,symbol ,propname ,value)))
122
123")
124 (let ((version-alist nil))
125 (mapatoms (lambda (symbol)
126 (let ((version (get symbol 'custom-version))
127 where)
128 (when version
129 (setq where (get symbol 'custom-where))
130 (when (and where
131 ;; Don't bother to do anything if it's
132 ;; autoloaded because we will have all
133 ;; this info when emacs is running
134 ;; anyway.
135 (not (get symbol 'custom-autoloaded)))
136 (insert "(custom-put-if-not '" (symbol-name symbol)
137 " 'custom-version ")
138 (prin1 version (current-buffer))
139 (insert ")\n")
140 (insert "(put '" (symbol-name symbol))
141 (if (get symbol 'standard-value)
142 ;; This means it's a variable
143 (progn
144 (insert " 'standard-value t)\n")
145 (if (assoc version version-alist)
146 (unless
147 (member where
148 (cdr (assoc version version-alist)))
149 (push where (cdr (assoc version version-alist))))
150 (push (cons version (list where)) version-alist)))
151 ;; This is a group
152 (insert " 'group-documentation ")
153 (prin1 (get symbol 'group-documentation) (current-buffer))
154 (insert ")\n")))))))
155
156 (insert "\n(defvar custom-versions-load-alist "
157 (if version-alist "'" ""))
158 (prin1 version-alist (current-buffer))
159 (insert "\n \"For internal use by custom.\")\n"))
160
161 (insert "\
94 162
95\(provide 'cus-load) 163\(provide 'cus-load)
96 164
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 20ce781158c..0007ecefbd7 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -880,9 +880,12 @@ option."
880 (interactive "sCustomize options changed, since version (default all versions): ") 880 (interactive "sCustomize options changed, since version (default all versions): ")
881 (if (equal since-version "") 881 (if (equal since-version "")
882 (setq since-version nil)) 882 (setq since-version nil))
883 (let ((found nil)) 883 (let ((found nil)
884 (versions nil))
884 (mapatoms (lambda (symbol) 885 (mapatoms (lambda (symbol)
885 (and (or (boundp symbol) 886 (and (or (boundp symbol)
887 ;; For variables not yet loaded.
888 (get symbol 'standard-value)
886 ;; For groups the previous test fails, this one 889 ;; For groups the previous test fails, this one
887 ;; could be used to determine if symbol is a 890 ;; could be used to determine if symbol is a
888 ;; group. Is there a better way for this? 891 ;; group. Is there a better way for this?
@@ -890,7 +893,11 @@ option."
890 (let ((version (get symbol 'custom-version))) 893 (let ((version (get symbol 'custom-version)))
891 (and version 894 (and version
892 (or (null since-version) 895 (or (null since-version)
893 (customize-version-lessp since-version version)))) 896 (customize-version-lessp since-version version))
897 (if (member version versions)
898 t
899 ;;; Collect all versions that we use.
900 (push version versions))))
894 (setq found 901 (setq found
895 ;; We have to set the right thing here, 902 ;; We have to set the right thing here,
896 ;; depending if we have a group or a 903 ;; depending if we have a group or a
@@ -900,7 +907,23 @@ option."
900 (cons (list symbol 'custom-variable) found)))))) 907 (cons (list symbol 'custom-variable) found))))))
901 (if (not found) 908 (if (not found)
902 (error "No user options have changed defaults in recent Emacs versions") 909 (error "No user options have changed defaults in recent Emacs versions")
903 (custom-buffer-create (custom-sort-items found t nil) 910 (put 'custom-versions-load-alist 'custom-loads
911 ;; Get all the files that correspond to element from the
912 ;; VERSIONS list. This could use some simplification.
913 (let ((flist nil))
914 (while versions
915 (push (copy-sequence
916 (cdr (assoc (car versions) custom-versions-load-alist)))
917 flist)
918 (setq versions (cdr versions)))
919 (apply 'nconc flist)))
920 ;; Because we set all the files needed to be loaded as a
921 ;; `custom-loads' property to `custom-versions-load-alist' this
922 ;; call will actually load them.
923 (custom-load-symbol 'custom-versions-load-alist)
924 ;; Clean up
925 (put 'custom-versions-load-alist 'custom-loads nil)
926 (custom-buffer-create (custom-sort-items found t 'first)
904 "*Customize Changed Options*")))) 927 "*Customize Changed Options*"))))
905 928
906(defun customize-version-lessp (version1 version2) 929(defun customize-version-lessp (version1 version2)
@@ -1183,7 +1206,7 @@ Reset all values in this buffer to their standard settings."
1183 (length (length options))) 1206 (length (length options)))
1184 (mapcar (lambda (entry) 1207 (mapcar (lambda (entry)
1185 (prog2 1208 (prog2
1186 (message "Creating customization items %2d%%..." 1209 (message "Creating customization items ...%2d%%"
1187 (/ (* 100.0 count) length)) 1210 (/ (* 100.0 count) length))
1188 (widget-create (nth 1 entry) 1211 (widget-create (nth 1 entry)
1189 :tag (custom-unlispify-tag-name 1212 :tag (custom-unlispify-tag-name
@@ -1196,7 +1219,7 @@ Reset all values in this buffer to their standard settings."
1196 options)))) 1219 options))))
1197 (unless (eq (preceding-char) ?\n) 1220 (unless (eq (preceding-char) ?\n)
1198 (widget-insert "\n")) 1221 (widget-insert "\n"))
1199 (message "Creating customization items %2d%%...done" 100) 1222 (message "Creating customization items ...%2d%%done" 100)
1200 (unless (eq custom-buffer-style 'tree) 1223 (unless (eq custom-buffer-style 'tree)
1201 (mapcar 'custom-magic-reset custom-options)) 1224 (mapcar 'custom-magic-reset custom-options))
1202 (message "Creating customization setup...") 1225 (message "Creating customization setup...")
diff --git a/lisp/midnight.el b/lisp/midnight.el
index ec5db1fd0d9..01b987320d9 100644
--- a/lisp/midnight.el
+++ b/lisp/midnight.el
@@ -40,7 +40,8 @@
40 40
41(defgroup midnight nil 41(defgroup midnight nil
42 "Run something every day at midnight." 42 "Run something every day at midnight."
43 :group 'calendar) 43 :group 'calendar
44 :version "20.3")
44 45
45(defcustom midnight-mode t 46(defcustom midnight-mode t
46 "*Non-nil means run `midnight-hook' at midnight. 47 "*Non-nil means run `midnight-hook' at midnight.
@@ -49,7 +50,6 @@ call `cancel-timer' or `timer-activate' on `midnight-timer' instead."
49 :type 'boolean 50 :type 'boolean
50 :group 'midnight 51 :group 'midnight
51 :require 'midnight 52 :require 'midnight
52 :version "20.3"
53 :set (lambda (symb val) 53 :set (lambda (symb val)
54 (set symb val) (require 'midnight) 54 (set symb val) (require 'midnight)
55 (if val (timer-activate midnight-timer) 55 (if val (timer-activate midnight-timer)
@@ -83,8 +83,7 @@ Currently displayed and/or modified (unsaved) buffers, as well as buffers
83matching `clean-buffer-list-kill-never-buffer-names' and 83matching `clean-buffer-list-kill-never-buffer-names' and
84`clean-buffer-list-kill-never-regexps' are excluded." 84`clean-buffer-list-kill-never-regexps' are excluded."
85 :type 'integer 85 :type 'integer
86 :group 'midnight 86 :group 'midnight)
87 :version "20.3")
88 87
89(defcustom clean-buffer-list-delay-special 3600 88(defcustom clean-buffer-list-delay-special 3600
90 "*The number of seconds before some buffers become eligible for autokilling. 89 "*The number of seconds before some buffers become eligible for autokilling.
@@ -92,8 +91,7 @@ Buffers matched by `clean-buffer-list-kill-regexps' and
92`clean-buffer-list-kill-buffer-names' are killed if they were last 91`clean-buffer-list-kill-buffer-names' are killed if they were last
93displayed more than this many seconds ago." 92displayed more than this many seconds ago."
94 :type 'integer 93 :type 'integer
95 :group 'midnight 94 :group 'midnight)
96 :version "20.3")
97 95
98(defcustom clean-buffer-list-kill-regexps nil 96(defcustom clean-buffer-list-kill-regexps nil
99 "*List of regexps saying which buffers will be killed at midnight. 97 "*List of regexps saying which buffers will be killed at midnight.
@@ -106,8 +104,7 @@ See also `clean-buffer-list-kill-buffer-names',
106`clean-buffer-list-kill-never-regexps' and 104`clean-buffer-list-kill-never-regexps' and
107`clean-buffer-list-kill-never-buffer-names'." 105`clean-buffer-list-kill-never-buffer-names'."
108 :type 'list 106 :type 'list
109 :group 'midnight 107 :group 'midnight)
110 :version "20.3")
111 108
112(defcustom clean-buffer-list-kill-buffer-names 109(defcustom clean-buffer-list-kill-buffer-names
113 '("*Help*" "*Apropos*" "*Man " "*Buffer List*" "*Compile-Log*" "*info*") 110 '("*Help*" "*Apropos*" "*Man " "*Buffer List*" "*Compile-Log*" "*info*")
@@ -121,8 +118,7 @@ See also `clean-buffer-list-kill-regexps',
121`clean-buffer-list-kill-never-regexps' and 118`clean-buffer-list-kill-never-regexps' and
122`clean-buffer-list-kill-never-buffer-names'." 119`clean-buffer-list-kill-never-buffer-names'."
123 :type 'list 120 :type 'list
124 :group 'midnight 121 :group 'midnight)
125 :version "20.3")
126 122
127(defcustom clean-buffer-list-kill-never-buffer-names 123(defcustom clean-buffer-list-kill-never-buffer-names
128 '("*scratch*" "*Messages*") 124 '("*scratch*" "*Messages*")
@@ -132,8 +128,8 @@ Note that this does override `clean-buffer-list-kill-regexps' and
132`clean-buffer-list-kill-buffer-names' so a buffer matching any of these 128`clean-buffer-list-kill-buffer-names' so a buffer matching any of these
133two lists will NOT be killed if it is also present in this list." 129two lists will NOT be killed if it is also present in this list."
134 :type 'list 130 :type 'list
135 :group 'midnight 131 :group 'midnight)
136 :version "20.3") 132
137 133
138(defcustom clean-buffer-list-kill-never-regexps '("^ \*Minibuf-.*\*$") 134(defcustom clean-buffer-list-kill-never-regexps '("^ \*Minibuf-.*\*$")
139 "*List of regexp saying which buffers will never be killed at midnight. 135 "*List of regexp saying which buffers will never be killed at midnight.
@@ -143,8 +139,7 @@ Note that this does override `clean-buffer-list-kill-regexps' and
143`clean-buffer-list-kill-buffer-names' so a buffer matching any of these 139`clean-buffer-list-kill-buffer-names' so a buffer matching any of these
144two lists will NOT be killed if it also matches anything in this list." 140two lists will NOT be killed if it also matches anything in this list."
145 :type 'list 141 :type 'list
146 :group 'midnight 142 :group 'midnight)
147 :version "20.3")
148 143
149(defun midnight-find (el ls test &optional key) 144(defun midnight-find (el ls test &optional key)
150 "A stopgap solution to the absence of `find' in ELisp." 145 "A stopgap solution to the absence of `find' in ELisp."
@@ -198,8 +193,7 @@ The relevant vartiables are `clean-buffer-list-delay-general',
198 "The hook run `midnight-delay' seconds after midnight every day. 193 "The hook run `midnight-delay' seconds after midnight every day.
199The default value is `clean-buffer-list'." 194The default value is `clean-buffer-list'."
200 :type 'hook 195 :type 'hook
201 :group 'midnight 196 :group 'midnight)
202 :version "20.3")
203 197
204(defun midnight-next () 198(defun midnight-next ()
205 "Return the number of seconds till the next midnight." 199 "Return the number of seconds till the next midnight."
@@ -237,8 +231,7 @@ If you wish, you can use a string instead, it will be passed as the
237first argument to `run-at-time'." 231first argument to `run-at-time'."
238 :type 'sexp 232 :type 'sexp
239 :set 'midnight-delay-set 233 :set 'midnight-delay-set
240 :group 'midnight 234 :group 'midnight)
241 :version "20.3")
242 235
243(provide 'midnight) 236(provide 'midnight)
244 237