;;;###autoload
(defun package-install-file (file)
"Install a package from a file.
-The file can either be a tar file or an Emacs Lisp file."
+The file can either be a tar file, an Emacs Lisp file, or a
+directory."
(interactive "fPackage file name: ")
(with-temp-buffer
(if (file-directory-p file)
(status (if desc (package-desc-status desc) "orphan"))
(incompatible-reason (package--incompatible-p desc))
(signed (if desc (package-desc-signed desc))))
+ (when (string= status "avail-obso")
+ (setq status "available obsolete"))
(when incompatible-reason
(setq status "incompatible"))
(prin1 name)
(pkg-dir
(insert (propertize (if (member status '("unsigned" "dependency"))
"Installed"
- (capitalize status)) ;FIXME: Why comment-face?
- 'font-lock-face 'font-lock-comment-face))
+ (capitalize status))
+ 'font-lock-face 'font-lock-builtin-face))
(insert (substitute-command-keys " in ‘"))
- ;; Todo: Add button for uninstalling.
- (help-insert-xref-button (abbreviate-file-name
- (file-name-as-directory pkg-dir))
- 'help-package-def pkg-dir)
+ (let ((dir (abbreviate-file-name
+ (file-name-as-directory
+ (if (file-in-directory-p pkg-dir package-user-dir)
+ (file-relative-name pkg-dir package-user-dir)
+ pkg-dir)))))
+ (help-insert-xref-button dir 'help-package-def pkg-dir))
(if (and (package-built-in-p name)
(not (package-built-in-p name version)))
(insert (substitute-command-keys
(insert " (unsigned)."))
(when (and (package-desc-p desc)
(not required-by)
- (package-installed-p desc))
+ (member status '("unsigned" "installed")))
(insert " ")
(package-make-button "Delete"
'action #'package-delete-button-action
'package-desc desc)))
(incompatible-reason
- (insert (propertize "Incompatible" 'face font-lock-warning-face)
+ (insert (propertize "Incompatible" 'font-lock-face font-lock-warning-face)
" because it depends on ")
(if (stringp incompatible-reason)
(insert "Emacs " incompatible-reason ".")
'package-desc desc))
(t (insert (capitalize status) ".")))
(insert "\n")
- (insert " " (propertize "Archive" 'font-lock-face 'bold)
- ": " (or archive "n/a") "\n")
+ (unless (and pkg-dir (not archive)) ; Installed pkgs don't have archive.
+ (insert " " (propertize "Archive" 'font-lock-face 'bold)
+ ": " (or archive "n/a") "\n"))
(and version
(insert " "
(propertize "Version" 'font-lock-face 'bold) ": "
(package-version-join version) "\n"))
+ (insert " " (propertize "Summary" 'font-lock-face 'bold)
+ ": " (if desc (package-desc-summary desc)) "\n")
(setq reqs (if desc (package-desc-reqs desc)))
(when reqs
(help-insert-xref-button text 'help-package
(package-desc-name pkg))))
(insert "\n")))
- (insert " " (propertize "Summary" 'font-lock-face 'bold)
- ": " (if desc (package-desc-summary desc)) "\n")
(when homepage
(insert " " (propertize "Homepage" 'font-lock-face 'bold) ": ")
(help-insert-xref-button homepage 'help-url homepage)
(if (not ov) (format "%s" from)
(format "%s (%s)"
(make-text-button (package-version-join ov) nil
- 'face 'link
+ 'font-lock-face 'link
'follow-link t
'action
(lambda (_button)
:background "light grey"
:foreground "black")
'link)))
- (apply 'insert-text-button button-text 'face button-face 'follow-link t
+ (apply 'insert-text-button button-text 'font-lock-face button-face 'follow-link t
props)))
\f
(define-key map "~" 'package-menu-mark-obsolete-for-deletion)
(define-key map "x" 'package-menu-execute)
(define-key map "h" 'package-menu-quick-help)
+ (define-key map "H" #'package-menu-hide-package)
(define-key map "?" 'package-menu-describe-package)
(define-key map "(" #'package-menu-toggle-hiding)
(define-key map [menu-bar package-menu] (cons "Package" menu-map))
(defvar package--quick-help-keys
'(("install," "delete," "unmark," ("execute" . 1))
("next," "previous")
- ("refresh-contents," "g-redisplay," "filter," "(-toggle-obsolete" "help")))
+ ("Hide-package," "(-toggle-hidden")
+ ("refresh-contents," "g-redisplay," "filter," "help")))
(defun package--prettify-quick-help-key (desc)
"Prettify DESC to be displayed as a help menu."
(mapconcat #'package--prettify-quick-help-key desc " ")
(let ((place (cdr desc))
(out (car desc)))
- ;; (setq out (propertize out 'face 'paradox-comment-face))
(add-text-properties place (1+ place)
- '(face (bold font-lock-function-name-face))
+ '(face (bold font-lock-warning-face))
out)
out))
(package--prettify-quick-help-key (cons desc 0))))
(describe-package '5x5)
(goto-char (point-min))
(should (search-forward "5x5 is a built-in package." nil t))
- (should (search-forward "Status: Built-in." nil t))
- (should (search-forward "Summary: simple little puzzle game" nil t))
+ ;; Don't assume the descriptions are in any particular order.
+ (save-excursion (should (search-forward "Status: Built-in." nil t)))
+ (save-excursion (should (search-forward "Summary: simple little puzzle game" nil t)))
(should (search-forward "The aim of 5x5" nil t)))
;; Installed
(describe-package 'simple-single)
(goto-char (point-min))
(should (search-forward "simple-single is an installed package." nil t))
- (should (re-search-forward
- "Status: Installed in ['`‘]~/simple-single-1.3/['’] (unsigned)."
- nil t))
- (should (search-forward "Version: 1.3" nil t))
- (should (search-forward "Summary: A single-file package with no dependencies"
- nil t))
- (should (search-forward "Homepage: http://doodles.au" nil t))
- (should (re-search-forward "Keywords: \\[?frobnicate\\]?" nil t))
+ (save-excursion (should (re-search-forward "Status: Installed in ['`‘]simple-single-1.3/['’] (unsigned)." nil t)))
+ (save-excursion (should (search-forward "Version: 1.3" nil t)))
+ (save-excursion (should (search-forward "Summary: A single-file package with no dependencies" nil t)))
+ (save-excursion (should (search-forward "Homepage: http://doodles.au" nil t)))
+ (save-excursion (should (re-search-forward "Keywords: \\[?frobnicate\\]?" nil t)))
;; No description, though. Because at this point we don't know
;; what archive the package originated from, and we don't have
;; its readme file saved.