Hi Mike!
This or similar is needed to be able to run Dired in SXEmacs. The
reason is because, in SXEmacs, the variable, `emacs-version' has a
value like...
"steve(a)sxemacs.org--2005/sxemacs--main--22.1.1--patch-15"
The others, `emacs-*-version' have what you'd expect...
emacs-major-version => 22
emacs-minor-version => 1
emacs-beta-version => 1
I have tried very hard to maintain the current semantics so that this
patch doesn't affect _any_ currently supported emacsen.
Mike, it would be great if you could include this in you next Dired
release.
(a similar patch to EFS will follow in a moment)
dired patch:
ChangeLog files diff command: cvs -q diff -U 0
Files affected: ChangeLog
Source files diff command: cvs -q diff -uN
Files affected: dired.el diff.el
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/dired/ChangeLog,v
retrieving revision 1.19
diff -u -U0 -r1.19 ChangeLog
--- ChangeLog 4 Oct 2004 08:54:24 -0000 1.19
+++ ChangeLog 14 Jan 2005 02:37:37 -0000
@@ -0,0 +1,7 @@
+2005-01-14 Steve Youngs <steve(a)sxemacs.org>
+
+ * dired.el: Use `emacs-*-version' variables for finding version
+ information instead of string-matching through `emacs-version'.
+
+ * diff.el (diff-emacs-19-p): Ditto.
+
Index: diff.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/dired/diff.el,v
retrieving revision 1.4
diff -u -u -r1.4 diff.el
--- diff.el 2 Oct 2004 14:06:17 -0000 1.4
+++ diff.el 14 Jan 2005 02:37:23 -0000
@@ -72,7 +72,7 @@
;;; Internal variables
(defconst diff-emacs-19-p
- (let ((ver (string-to-int (substring emacs-version 0 2))))
+ (let ((ver emacs-major-version))
(>= ver 19)))
(or diff-emacs-19-p (require 'emacs-19))
Index: dired.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/dired/dired.el,v
retrieving revision 1.7
diff -u -u -r1.7 dired.el
--- dired.el 2 Oct 2004 14:06:19 -0000 1.7
+++ dired.el 14 Jan 2005 02:37:25 -0000
@@ -80,13 +80,15 @@
;; Testing against the string `Lucid' breaks InfoDock. How many years has
;; it been since Lucid went away?
(let ((lucid-p (string-match "XEmacs" emacs-version))
- ver subver)
- (or (string-match "^\\([0-9]+\\)\\.\\([0-9]+\\)" emacs-version)
- (error "dired does not work with emacs version %s" emacs-version))
- (setq ver (string-to-int (substring emacs-version (match-beginning 1)
- (match-end 1)))
- subver (string-to-int (substring emacs-version (match-beginning 2)
- (match-end 2))))
+ (ver emacs-major-version)
+ (subver emacs-minor-version))
+ (unless ver
+ (or (string-match "^\\([0-9]+\\)\\.\\([0-9]+\\)" emacs-version)
+ (error "dired does not work with emacs version %s" emacs-version))
+ (setq ver (string-to-int (substring emacs-version (match-beginning 1)
+ (match-end 1)))
+ subver (string-to-int (substring emacs-version (match-beginning 2)
+ (match-end 2)))))
(cond
((= ver 18)
(require 'emacs-19)
@@ -6616,11 +6618,12 @@
;;;; --------------------------------------------------------------
(let ((lucid-p (string-match "XEmacs" emacs-version))
- ver)
- (or (string-match "^\\([0-9]+\\)\\." emacs-version)
- (error "Weird emacs version %s" emacs-version))
- (setq ver (string-to-int (substring emacs-version (match-beginning 1)
- (match-end 1))))
+ (ver emacs-major-version))
+ (unless ver
+ (or (string-match "^\\([0-9]+\\)\\." emacs-version)
+ (error "Weird emacs version %s" emacs-version))
+ (setq ver (string-to-int (substring emacs-version (match-beginning 1)
+ (match-end 1)))))
;; Reading with history.
(if (>= ver 19)
--
|---<Steve Youngs>---------------<GnuPG KeyID: A94B3003>---|
| In space, |
| No one can hear you rip a stinky |
|------------------------------------<steve(a)sxemacs.org>---|