summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2010-08-28 21:31:45 -0400
committerChong Yidong <cyd@stupidchicken.com>2010-08-28 21:31:45 -0400
commite2046ecf21f7272f289297ddee897c19defcd0a4 (patch)
tree6259770749b82a96f3f572303ad194acef83583f /lisp
parent6fe79b7c7c4bf6df3a0dcae2969d5d83f4e28dc9 (diff)
downloademacs-e2046ecf21f7272f289297ddee897c19defcd0a4.tar.gz
emacs-e2046ecf21f7272f289297ddee897c19defcd0a4.tar.bz2
emacs-e2046ecf21f7272f289297ddee897c19defcd0a4.zip
Let version-to-list handle versions like "10.3d".
* lisp/subr.el (version-regexp-alist): Don't use "a" and "b" for "alpha" and "beta". (version-to-list): Handle versions like "10.3d".
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/subr.el15
2 files changed, 16 insertions, 5 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a1564ac4a5f..d4ba7de1635 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2010-08-29 Chong Yidong <cyd@stupidchicken.com>
+
+ * subr.el (version-regexp-alist): Don't use "a" and "b" for
+ "alpha" and "beta".
+ (version-to-list): Handle versions like "10.3d".
+
2010-08-28 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/macroexp.el (macroexpand-all-1): Use pcase.
diff --git a/lisp/subr.el b/lisp/subr.el
index 90480ea0e7f..0852ec58b5a 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -3584,11 +3584,11 @@ Usually the separator is \".\", but it can be any other string.")
(defconst version-regexp-alist
- '(("^[-_+ ]?a\\(lpha\\)?$" . -3)
+ '(("^[-_+ ]?alpha$" . -3)
("^[-_+]$" . -3) ; treat "1.2.3-20050920" and "1.2-3" as alpha releases
("^[-_+ ]cvs$" . -3) ; treat "1.2.3-CVS" as alpha release
- ("^[-_+ ]?b\\(eta\\)?$" . -2)
- ("^[-_+ ]?\\(pre\\|rc\\)$" . -1))
+ ("^[-_+ ]?beta$" . -2)
+ ("^[-_+ ]?\\(pre\\|rcc\\)$" . -1))
"*Specify association between non-numeric version and its priority.
This association is used to handle version string like \"1.0pre2\",
@@ -3681,8 +3681,13 @@ See documentation for `version-separator' and `version-regexp-alist'."
(setq al version-regexp-alist)
(while (and al (not (string-match (caar al) s)))
(setq al (cdr al)))
- (or al (error "Invalid version syntax: '%s'" ver))
- (setq lst (cons (cdar al) lst)))))
+ (cond (al
+ (push (cdar al) lst))
+ ;; Convert 22.3a to 22.3.1.
+ ((string-match "^[-_+ ]?\\([a-zA-Z]\\)$" s)
+ (push (- (aref (downcase (match-string 1 s)) 0) ?a -1)
+ lst))
+ (t (error "Invalid version syntax: '%s'" ver))))))
(if (null lst)
(error "Invalid version syntax: '%s'" ver)
(nreverse lst)))))