commit: Remove a couple of XEmacs-specific duplicate functions, find-paths.el
Aidan Kehoe
kehoea at parhasard.net
Wed Feb 3 04:03:32 EST 2010
changeset: 4919:9c6ea1581159
parent: 4915:bedf3747a6d7
user: Aidan Kehoe <kehoea at parhasard.net>
date: Wed Feb 03 09:04:35 2010 +0000
files: lisp/ChangeLog lisp/find-paths.el lisp/packages.el lisp/setup-paths.el
description:
Remove a couple of XEmacs-specific duplicate functions, find-paths.el
2010-02-03 Aidan Kehoe <kehoea at parhasard.net>
Delete a couple of XEmacs-specific functions that duplicate CL
functions.
* find-paths.el (paths-filter, paths-uniq-append):
Remove #'paths-filter, a reimplementation of #'remove-if-not, and
#'paths-uniq-append, a reimplementation of #'union with test
#'equal.
(paths-decode-directory-path): Don't use #'path-filter here.
* packages.el (packages-package-hierarchy-directory-names):
Don't use #'path-filter here.
(packages-find-installation-package-directories):
Use #'union, not #'paths-uniq-append here.
* setup-paths.el (paths-find-invocation-roots)
(paths-find-emacs-roots, paths-construct-info-path)
(paths-construct-info-path):
Replace #'paths-filter with #'remove-if-not, #'paths-uniq-append
with #'union.
diff -r bedf3747a6d7 -r 9c6ea1581159 lisp/ChangeLog
--- a/lisp/ChangeLog Wed Feb 03 00:20:08 2010 +0000
+++ b/lisp/ChangeLog Wed Feb 03 09:04:35 2010 +0000
@@ -1,3 +1,23 @@
+2010-02-03 Aidan Kehoe <kehoea at parhasard.net>
+
+ Delete a couple of XEmacs-specific functions that duplicate CL
+ functions.
+
+ * find-paths.el (paths-filter, paths-uniq-append):
+ Remove #'paths-filter, a reimplementation of #'remove-if-not, and
+ #'paths-uniq-append, a reimplementation of #'union with test
+ #'equal.
+ (paths-decode-directory-path): Don't use #'path-filter here.
+ * packages.el (packages-package-hierarchy-directory-names):
+ Don't use #'path-filter here.
+ (packages-find-installation-package-directories):
+ Use #'union, not #'paths-uniq-append here.
+ * setup-paths.el (paths-find-invocation-roots)
+ (paths-find-emacs-roots, paths-construct-info-path)
+ (paths-construct-info-path):
+ Replace #'paths-filter with #'remove-if-not, #'paths-uniq-append
+ with #'union.
+
2010-02-01 Aidan Kehoe <kehoea at parhasard.net>
* loadhist.el (symbol-file):
diff -r bedf3747a6d7 -r 9c6ea1581159 lisp/find-paths.el
--- a/lisp/find-paths.el Wed Feb 03 00:20:08 2010 +0000
+++ b/lisp/find-paths.el Wed Feb 03 09:04:35 2010 +0000
@@ -352,25 +352,6 @@
(setq directories (cdr directories)))
(reverse reverse-directories)))
-(defun paths-uniq-append (list-1 list-2)
- "Append LIST-1 and LIST-2, omitting EQUAL duplicates."
- (let ((reverse-survivors '()))
- (while list-2
- (if (null (member (car list-2) list-1))
- (setq reverse-survivors (cons (car list-2) reverse-survivors)))
- (setq list-2 (cdr list-2)))
- (append list-1
- (reverse reverse-survivors))))
-
-(defun paths-filter (predicate list)
- "Delete all matches of PREDICATE from LIST."
- (let ((reverse-result '()))
- (while list
- (if (funcall predicate (car list))
- (setq reverse-result (cons (car list) reverse-result)))
- (setq list (cdr list)))
- (nreverse reverse-result)))
-
(defun paths-decode-directory-path (string &optional drop-empties)
"Split STRING at path separators into a directory list.
Non-\"\" components are converted into directory form.
@@ -384,9 +365,7 @@
(file-name-as-directory component)))
components)))
(if drop-empties
- (paths-filter #'(lambda (component)
- (null (string-equal "" component)))
- directories)
+ (delete "" directories)
directories)))
;;; find-paths.el ends here
diff -r bedf3747a6d7 -r 9c6ea1581159 lisp/packages.el
--- a/lisp/packages.el Wed Feb 03 00:20:08 2010 +0000
+++ b/lisp/packages.el Wed Feb 03 09:04:35 2010 +0000
@@ -106,11 +106,10 @@
"Returns a list package hierarchy directory names.
These are the valid immediate directory names of package
directories, directories with higher priority first"
- (paths-filter #'(lambda (x) x)
- `("site-packages"
- ,(when (featurep 'infodock) "infodock-packages")
- ,(when (featurep 'mule) "mule-packages")
- "xemacs-packages")))
+ (delq nil `("site-packages"
+ ,(when (featurep 'infodock) "infodock-packages")
+ ,(when (featurep 'mule) "mule-packages")
+ "xemacs-packages")))
(defun package-get-key-1 (info key)
"Locate keyword `key' in list."
@@ -386,8 +385,8 @@
(defun packages-find-installation-package-directories (roots)
"Find the package directories in the XEmacs installation.
ROOTS is a list of installation roots."
- (paths-uniq-append (paths-find-version-directories roots (list "") nil nil nil t)
- (paths-find-site-directories roots (list "") nil)))
+ (union (paths-find-version-directories roots (list "") nil nil nil t)
+ (paths-find-site-directories roots (list "") nil) :test #'equal))
(defun packages-find-package-hierarchies (package-directories &optional envvar default)
"Find package hierarchies in a list of package directories.
diff -r bedf3747a6d7 -r 9c6ea1581159 lisp/setup-paths.el
--- a/lisp/setup-paths.el Wed Feb 03 00:20:08 2010 +0000
+++ b/lisp/setup-paths.el Wed Feb 03 09:04:35 2010 +0000
@@ -127,8 +127,7 @@
(maybe-root-2 (file-name-as-directory
(paths-construct-path '(".." "..") executable-directory))))
- (paths-filter root-p
- (list maybe-root-1 maybe-root-2))))
+ (delete-if-not root-p (list maybe-root-1 maybe-root-2))))
(defun paths-find-emacs-roots (invocation-directory
invocation-name
@@ -143,17 +142,17 @@
invocation-name
root-p))
(potential-installation-roots
- (paths-uniq-append
+ (union
(and configure-exec-prefix-directory
(list (file-name-as-directory
configure-exec-prefix-directory)))
(and configure-prefix-directory
(list (file-name-as-directory
- configure-prefix-directory)))))
+ configure-prefix-directory)))
+:test #'equal))
(installation-roots
- (paths-filter root-p potential-installation-roots)))
- (paths-uniq-append invocation-roots
- installation-roots)))
+ (remove-if-not root-p potential-installation-roots)))
+ (union invocation-roots installation-roots :test #'equal)))
(defun paths-find-site-lisp-directory (roots)
"Find the site Lisp directory of the XEmacs hierarchy.
@@ -261,7 +260,7 @@
LAST-PACKAGE-HIERARCHIES are lists of package hierarchy roots,
respectively."
(let ((info-path-envval (getenv "INFOPATH")))
- (paths-uniq-append
+ (union
(append
(let ((info-directory
(paths-find-version-directory roots (list "info")
@@ -275,9 +274,11 @@
(and info-path-envval
(paths-decode-directory-path info-path-envval 'drop-empties)))
(and (null info-path-envval)
- (paths-uniq-append
+ (union
(paths-directories-which-exist configure-info-path)
- (paths-directories-which-exist paths-default-info-directories))))))
+ (paths-directories-which-exist paths-default-info-directories)
+:test #'equal))
+:test #'equal)))
(defun paths-find-doc-directory (roots)
"Find the documentation directory.
More information about the XEmacs-Patches
mailing list