|
27 | 27 | (cond |
28 | 28 | ((not (file-exists-p path)) |
29 | 29 | (eask-error "File does not exist %s" path)) |
30 | | - ((or (string-suffix-p ".tar" path) |
31 | | - (string-suffix-p ".tar.gz" path)) |
32 | | - ;; tar file |
| 30 | + ;; TAR file |
| 31 | + ((string-match-p "[.]+tar[.]*" path) |
33 | 32 | ;; Note this can throw strange errors if |
| 33 | + ;; |
34 | 34 | ;; - there is no -pkg.el in the tar file |
35 | 35 | ;; - the tar file was built in a folder with a different name |
36 | | - ;; tar files created with eask package are fine |
| 36 | + ;; |
| 37 | + ;; TAR files created with eask package are fine. |
37 | 38 | (require 'tar-mode) |
38 | 39 | (let ((pkg-desc (with-current-buffer (find-file (expand-file-name path)) |
39 | 40 | (eask-ignore-errors-silent (package-tar-file-info))))) |
40 | 41 | (unless pkg-desc |
41 | | - ;; package-dir-info will return nil if there is no -pkg.el and no .el files at path |
| 42 | + ;; `package-dir-info' will return nil if there is no `-pkg.el' |
| 43 | + ;; and no `.el' files at path |
42 | 44 | (eask-error "No package in %s" path)) |
43 | | - (package-desc-name pkg-desc)) |
44 | | - ) |
45 | | - (t ;; .el file or directory |
46 | | - ;; Note package-dir-info doesn't work outside of dired mode! |
| 45 | + (package-desc-name pkg-desc))) |
| 46 | + ;; .el file or directory |
| 47 | + (t |
| 48 | + ;; Note `package-dir-info' doesn't work outside of dired mode! |
47 | 49 | (let ((pkg-desc (with-current-buffer (dired (expand-file-name path)) |
48 | 50 | (eask-ignore-errors-silent (package-dir-info))))) |
49 | 51 | (unless pkg-desc |
50 | | - ;; package-dir-info will return nil if there is no -pkg.el and no .el files at path |
| 52 | + ;; `package-dir-info' will return nil if there is no `-pkg.el' |
| 53 | + ;; and no `.el' files at path |
51 | 54 | (eask-error "No package in %s" path)) |
52 | 55 | (package-desc-name pkg-desc))))) |
53 | 56 |
|
|
0 commit comments