diff options
author | Chong Yidong <cyd@stupidchicken.com> | 2011-03-19 14:27:55 -0400 |
---|---|---|
committer | Chong Yidong <cyd@stupidchicken.com> | 2011-03-19 14:27:55 -0400 |
commit | 4525ce3eb56a1f4b7c50eac9217854bbd170f660 (patch) | |
tree | 70e078b783c5886fc4e411734c39547678d5e7c9 /lisp/startup.el | |
parent | 0a19a6f87504ef65b1c946d5daa34b794d600b20 (diff) | |
download | emacs-4525ce3eb56a1f4b7c50eac9217854bbd170f660.tar.gz emacs-4525ce3eb56a1f4b7c50eac9217854bbd170f660.tar.bz2 emacs-4525ce3eb56a1f4b7c50eac9217854bbd170f660.zip |
Fix tar package handling, and clean up package-subdirectory-regexp usage.
* lisp/startup.el (package-subdirectory-regexp): Move from package.el.
Omit \\` and \\', and let callers add them.
* lisp/emacs-lisp/package.el (package-strip-version)
(package-load-all-descriptors): Add \\` and \\' to
package-subdirectory-regexp before using it.
(package-untar-buffer): New arg DIR; ensure that file untars only
into this expected directory. Remove superfluous delete-region.
(package-unpack): Caller changed.
(package-tar-file-info): Use package-subdirectory-regexp.
Diffstat (limited to 'lisp/startup.el')
-rw-r--r-- | lisp/startup.el | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/lisp/startup.el b/lisp/startup.el index 65b1a013c21..e8e85a41c77 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -392,6 +392,15 @@ Warning Warning!!! Pure space overflow !!!Warning Warning :type 'directory :initialize 'custom-initialize-delay) +(defconst package-subdirectory-regexp + "\\([^.].*?\\)-\\([0-9]+\\(?:[.][0-9]+\\|\\(?:pre\\|beta\\|alpha\\)[0-9]+\\)*\\)" + "Regular expression matching the name of a package subdirectory. +The first subexpression is the package name. +The second subexpression is the version string. + +The regexp should not contain a starting \"\\`\" or a trailing + \"\\'\"; those are added automatically by callers.") + (defun normal-top-level-add-subdirs-to-load-path () "Add all subdirectories of current directory to `load-path'. More precisely, this uses only the subdirectories whose names @@ -1194,9 +1203,9 @@ the `--debug-init' option to view a complete error backtrace." (when (file-directory-p dir) (dolist (subdir (directory-files dir)) (when (and (file-directory-p (expand-file-name subdir dir)) - ;; package-subdirectory-regexp from package.el - (string-match "\\`\\([^.].*?\\)-\\([0-9]+\\(?:[.][0-9]+\\|\\(?:pre\\|beta\\|alpha\\)[0-9]+\\)*\\)\\'" - subdir)) + (string-match + (concat "\\`" package-subdirectory-regexp "\\'") + subdir)) (throw 'package-dir-found t))))))) (package-initialize)) |