summaryrefslogtreecommitdiff
path: root/lisp/cus-edit.el
diff options
context:
space:
mode:
authorDave Love <fx@gnu.org>2000-06-20 09:48:09 +0000
committerDave Love <fx@gnu.org>2000-06-20 09:48:09 +0000
commit26c67de87de7acf661a9c4db059d03774e02102f (patch)
tree9eb77bda89297fce4394a6ff2418d3cb18d7d677 /lisp/cus-edit.el
parent2538076d09018b427d06be133ab194ea946e8971 (diff)
downloademacs-26c67de87de7acf661a9c4db059d03774e02102f.tar.gz
emacs-26c67de87de7acf661a9c4db059d03774e02102f.tar.bz2
emacs-26c67de87de7acf661a9c4db059d03774e02102f.zip
(customize-changed-options): Check arg.
(customize-version-lessp): Don't require decimal point.
Diffstat (limited to 'lisp/cus-edit.el')
-rw-r--r--lisp/cus-edit.el25
1 files changed, 18 insertions, 7 deletions
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 42f5d0978be..9005e0a3fec 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -936,7 +936,11 @@ version."
(interactive "sCustomize options changed, since version (default all versions): ")
(if (equal since-version "")
- (setq since-version nil))
+ (setq since-version nil)
+ (unless (condition-case nil
+ (numberp (read since-version))
+ (error nil))
+ (signal 'wrong-type-argument (list 'numberp since-version))))
(unless since-version
(setq since-version customize-changed-options-previous-release))
(let ((found nil)
@@ -987,17 +991,24 @@ version."
"*Customize Changed Options*"))))
(defun customize-version-lessp (version1 version2)
+ ;; Why are the versions strings, and given that they are, why aren't
+ ;; they converted to numbers and compared as such here? -- fx
+
;; In case someone made a mistake and left out the quotes
;; in the :version value.
(if (numberp version2)
(setq version2 (prin1-to-string version2)))
(let (major1 major2 minor1 minor2)
- (string-match "\\([0-9]+\\)[.]\\([0-9]+\\)" version1)
- (setq major1 (read (match-string 1 version1)))
- (setq minor1 (read (match-string 2 version1)))
- (string-match "\\([0-9]+\\)[.]\\([0-9]+\\)" version2)
- (setq major2 (read (match-string 1 version2)))
- (setq minor2 (read (match-string 2 version2)))
+ (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version1)
+ (setq major1 (read (or (match-string 1 version1)
+ "0")))
+ (setq minor1 (read (or (match-string 3 version1)
+ "0")))
+ (string-match "\\([0-9]+\\)\\(\\.\\([0-9]+\\)\\)?" version2)
+ (setq major2 (read (or (match-string 1 version2)
+ "0")))
+ (setq minor2 (read (or (match-string 3 version2)
+ "0")))
(or (< major1 major2)
(and (= major1 major2)
(< minor1 minor2)))))