diff options
| author | Artur Malabarba | 2015-07-17 19:25:39 +0100 |
|---|---|---|
| committer | Artur Malabarba | 2015-07-17 23:42:16 +0100 |
| commit | ca66737c5313665a1646a64de8fa6181c9e11de5 (patch) | |
| tree | 6880136d28331ab9a1b2d61b2b50a184b7a97403 | |
| parent | e276b42800dc2b8263ebf24d7c449f53c819307b (diff) | |
| download | emacs-ca66737c5313665a1646a64de8fa6181c9e11de5.tar.gz emacs-ca66737c5313665a1646a64de8fa6181c9e11de5.zip | |
* lisp/emacs-lisp/package.el: Many small changes
Replace all instances of 'face with 'font-lock-face.
(describe-package-1): Improve some strings and move the summary up the
list.
(package-install-file): Update docstring.
(package-menu-hide-package): Bind to `H'.
| -rw-r--r-- | lisp/emacs-lisp/package.el | 43 | ||||
| -rw-r--r-- | test/automated/package-test.el | 18 |
2 files changed, 33 insertions, 28 deletions
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index fc5ef0b62c0..c7e3096a1ee 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el | |||
| @@ -1956,7 +1956,8 @@ Downloads and installs required packages as needed." | |||
| 1956 | ;;;###autoload | 1956 | ;;;###autoload |
| 1957 | (defun package-install-file (file) | 1957 | (defun package-install-file (file) |
| 1958 | "Install a package from a file. | 1958 | "Install a package from a file. |
| 1959 | The file can either be a tar file or an Emacs Lisp file." | 1959 | The file can either be a tar file, an Emacs Lisp file, or a |
| 1960 | directory." | ||
| 1960 | (interactive "fPackage file name: ") | 1961 | (interactive "fPackage file name: ") |
| 1961 | (with-temp-buffer | 1962 | (with-temp-buffer |
| 1962 | (if (file-directory-p file) | 1963 | (if (file-directory-p file) |
| @@ -2163,6 +2164,8 @@ will be deleted." | |||
| 2163 | (status (if desc (package-desc-status desc) "orphan")) | 2164 | (status (if desc (package-desc-status desc) "orphan")) |
| 2164 | (incompatible-reason (package--incompatible-p desc)) | 2165 | (incompatible-reason (package--incompatible-p desc)) |
| 2165 | (signed (if desc (package-desc-signed desc)))) | 2166 | (signed (if desc (package-desc-signed desc)))) |
| 2167 | (when (string= status "avail-obso") | ||
| 2168 | (setq status "available obsolete")) | ||
| 2166 | (when incompatible-reason | 2169 | (when incompatible-reason |
| 2167 | (setq status "incompatible")) | 2170 | (setq status "incompatible")) |
| 2168 | (prin1 name) | 2171 | (prin1 name) |
| @@ -2179,13 +2182,15 @@ will be deleted." | |||
| 2179 | (pkg-dir | 2182 | (pkg-dir |
| 2180 | (insert (propertize (if (member status '("unsigned" "dependency")) | 2183 | (insert (propertize (if (member status '("unsigned" "dependency")) |
| 2181 | "Installed" | 2184 | "Installed" |
| 2182 | (capitalize status)) ;FIXME: Why comment-face? | 2185 | (capitalize status)) |
| 2183 | 'font-lock-face 'font-lock-comment-face)) | 2186 | 'font-lock-face 'font-lock-builtin-face)) |
| 2184 | (insert (substitute-command-keys " in ‘")) | 2187 | (insert (substitute-command-keys " in ‘")) |
| 2185 | ;; Todo: Add button for uninstalling. | 2188 | (let ((dir (abbreviate-file-name |
| 2186 | (help-insert-xref-button (abbreviate-file-name | 2189 | (file-name-as-directory |
| 2187 | (file-name-as-directory pkg-dir)) | 2190 | (if (file-in-directory-p pkg-dir package-user-dir) |
| 2188 | 'help-package-def pkg-dir) | 2191 | (file-relative-name pkg-dir package-user-dir) |
| 2192 | pkg-dir))))) | ||
| 2193 | (help-insert-xref-button dir 'help-package-def pkg-dir)) | ||
| 2189 | (if (and (package-built-in-p name) | 2194 | (if (and (package-built-in-p name) |
| 2190 | (not (package-built-in-p name version))) | 2195 | (not (package-built-in-p name version))) |
| 2191 | (insert (substitute-command-keys | 2196 | (insert (substitute-command-keys |
| @@ -2198,13 +2203,13 @@ will be deleted." | |||
| 2198 | (insert " (unsigned).")) | 2203 | (insert " (unsigned).")) |
| 2199 | (when (and (package-desc-p desc) | 2204 | (when (and (package-desc-p desc) |
| 2200 | (not required-by) | 2205 | (not required-by) |
| 2201 | (package-installed-p desc)) | 2206 | (member status '("unsigned" "installed"))) |
| 2202 | (insert " ") | 2207 | (insert " ") |
| 2203 | (package-make-button "Delete" | 2208 | (package-make-button "Delete" |
| 2204 | 'action #'package-delete-button-action | 2209 | 'action #'package-delete-button-action |
| 2205 | 'package-desc desc))) | 2210 | 'package-desc desc))) |
| 2206 | (incompatible-reason | 2211 | (incompatible-reason |
| 2207 | (insert (propertize "Incompatible" 'face font-lock-warning-face) | 2212 | (insert (propertize "Incompatible" 'font-lock-face font-lock-warning-face) |
| 2208 | " because it depends on ") | 2213 | " because it depends on ") |
| 2209 | (if (stringp incompatible-reason) | 2214 | (if (stringp incompatible-reason) |
| 2210 | (insert "Emacs " incompatible-reason ".") | 2215 | (insert "Emacs " incompatible-reason ".") |
| @@ -2219,12 +2224,15 @@ will be deleted." | |||
| 2219 | 'package-desc desc)) | 2224 | 'package-desc desc)) |
| 2220 | (t (insert (capitalize status) "."))) | 2225 | (t (insert (capitalize status) "."))) |
| 2221 | (insert "\n") | 2226 | (insert "\n") |
| 2222 | (insert " " (propertize "Archive" 'font-lock-face 'bold) | 2227 | (unless (and pkg-dir (not archive)) ; Installed pkgs don't have archive. |
| 2223 | ": " (or archive "n/a") "\n") | 2228 | (insert " " (propertize "Archive" 'font-lock-face 'bold) |
| 2229 | ": " (or archive "n/a") "\n")) | ||
| 2224 | (and version | 2230 | (and version |
| 2225 | (insert " " | 2231 | (insert " " |
| 2226 | (propertize "Version" 'font-lock-face 'bold) ": " | 2232 | (propertize "Version" 'font-lock-face 'bold) ": " |
| 2227 | (package-version-join version) "\n")) | 2233 | (package-version-join version) "\n")) |
| 2234 | (insert " " (propertize "Summary" 'font-lock-face 'bold) | ||
| 2235 | ": " (if desc (package-desc-summary desc)) "\n") | ||
| 2228 | 2236 | ||
| 2229 | (setq reqs (if desc (package-desc-reqs desc))) | 2237 | (setq reqs (if desc (package-desc-reqs desc))) |
| 2230 | (when reqs | 2238 | (when reqs |
| @@ -2259,8 +2267,6 @@ will be deleted." | |||
| 2259 | (help-insert-xref-button text 'help-package | 2267 | (help-insert-xref-button text 'help-package |
| 2260 | (package-desc-name pkg)))) | 2268 | (package-desc-name pkg)))) |
| 2261 | (insert "\n"))) | 2269 | (insert "\n"))) |
| 2262 | (insert " " (propertize "Summary" 'font-lock-face 'bold) | ||
| 2263 | ": " (if desc (package-desc-summary desc)) "\n") | ||
| 2264 | (when homepage | 2270 | (when homepage |
| 2265 | (insert " " (propertize "Homepage" 'font-lock-face 'bold) ": ") | 2271 | (insert " " (propertize "Homepage" 'font-lock-face 'bold) ": ") |
| 2266 | (help-insert-xref-button homepage 'help-url homepage) | 2272 | (help-insert-xref-button homepage 'help-url homepage) |
| @@ -2290,7 +2296,7 @@ will be deleted." | |||
| 2290 | (if (not ov) (format "%s" from) | 2296 | (if (not ov) (format "%s" from) |
| 2291 | (format "%s (%s)" | 2297 | (format "%s (%s)" |
| 2292 | (make-text-button (package-version-join ov) nil | 2298 | (make-text-button (package-version-join ov) nil |
| 2293 | 'face 'link | 2299 | 'font-lock-face 'link |
| 2294 | 'follow-link t | 2300 | 'follow-link t |
| 2295 | 'action | 2301 | 'action |
| 2296 | (lambda (_button) | 2302 | (lambda (_button) |
| @@ -2365,7 +2371,7 @@ will be deleted." | |||
| 2365 | :background "light grey" | 2371 | :background "light grey" |
| 2366 | :foreground "black") | 2372 | :foreground "black") |
| 2367 | 'link))) | 2373 | 'link))) |
| 2368 | (apply 'insert-text-button button-text 'face button-face 'follow-link t | 2374 | (apply 'insert-text-button button-text 'font-lock-face button-face 'follow-link t |
| 2369 | props))) | 2375 | props))) |
| 2370 | 2376 | ||
| 2371 | 2377 | ||
| @@ -2386,6 +2392,7 @@ will be deleted." | |||
| 2386 | (define-key map "~" 'package-menu-mark-obsolete-for-deletion) | 2392 | (define-key map "~" 'package-menu-mark-obsolete-for-deletion) |
| 2387 | (define-key map "x" 'package-menu-execute) | 2393 | (define-key map "x" 'package-menu-execute) |
| 2388 | (define-key map "h" 'package-menu-quick-help) | 2394 | (define-key map "h" 'package-menu-quick-help) |
| 2395 | (define-key map "H" #'package-menu-hide-package) | ||
| 2389 | (define-key map "?" 'package-menu-describe-package) | 2396 | (define-key map "?" 'package-menu-describe-package) |
| 2390 | (define-key map "(" #'package-menu-toggle-hiding) | 2397 | (define-key map "(" #'package-menu-toggle-hiding) |
| 2391 | (define-key map [menu-bar package-menu] (cons "Package" menu-map)) | 2398 | (define-key map [menu-bar package-menu] (cons "Package" menu-map)) |
| @@ -2870,7 +2877,8 @@ If optional arg BUTTON is non-nil, describe its associated package." | |||
| 2870 | (defvar package--quick-help-keys | 2877 | (defvar package--quick-help-keys |
| 2871 | '(("install," "delete," "unmark," ("execute" . 1)) | 2878 | '(("install," "delete," "unmark," ("execute" . 1)) |
| 2872 | ("next," "previous") | 2879 | ("next," "previous") |
| 2873 | ("refresh-contents," "g-redisplay," "filter," "(-toggle-obsolete" "help"))) | 2880 | ("Hide-package," "(-toggle-hidden") |
| 2881 | ("refresh-contents," "g-redisplay," "filter," "help"))) | ||
| 2874 | 2882 | ||
| 2875 | (defun package--prettify-quick-help-key (desc) | 2883 | (defun package--prettify-quick-help-key (desc) |
| 2876 | "Prettify DESC to be displayed as a help menu." | 2884 | "Prettify DESC to be displayed as a help menu." |
| @@ -2879,9 +2887,8 @@ If optional arg BUTTON is non-nil, describe its associated package." | |||
| 2879 | (mapconcat #'package--prettify-quick-help-key desc " ") | 2887 | (mapconcat #'package--prettify-quick-help-key desc " ") |
| 2880 | (let ((place (cdr desc)) | 2888 | (let ((place (cdr desc)) |
| 2881 | (out (car desc))) | 2889 | (out (car desc))) |
| 2882 | ;; (setq out (propertize out 'face 'paradox-comment-face)) | ||
| 2883 | (add-text-properties place (1+ place) | 2890 | (add-text-properties place (1+ place) |
| 2884 | '(face (bold font-lock-function-name-face)) | 2891 | '(face (bold font-lock-warning-face)) |
| 2885 | out) | 2892 | out) |
| 2886 | out)) | 2893 | out)) |
| 2887 | (package--prettify-quick-help-key (cons desc 0)))) | 2894 | (package--prettify-quick-help-key (cons desc 0)))) |
diff --git a/test/automated/package-test.el b/test/automated/package-test.el index 5ab274747c9..524613dc6f6 100644 --- a/test/automated/package-test.el +++ b/test/automated/package-test.el | |||
| @@ -381,8 +381,9 @@ Must called from within a `tar-mode' buffer." | |||
| 381 | (describe-package '5x5) | 381 | (describe-package '5x5) |
| 382 | (goto-char (point-min)) | 382 | (goto-char (point-min)) |
| 383 | (should (search-forward "5x5 is a built-in package." nil t)) | 383 | (should (search-forward "5x5 is a built-in package." nil t)) |
| 384 | (should (search-forward "Status: Built-in." nil t)) | 384 | ;; Don't assume the descriptions are in any particular order. |
| 385 | (should (search-forward "Summary: simple little puzzle game" nil t)) | 385 | (save-excursion (should (search-forward "Status: Built-in." nil t))) |
| 386 | (save-excursion (should (search-forward "Summary: simple little puzzle game" nil t))) | ||
| 386 | (should (search-forward "The aim of 5x5" nil t))) | 387 | (should (search-forward "The aim of 5x5" nil t))) |
| 387 | 388 | ||
| 388 | ;; Installed | 389 | ;; Installed |
| @@ -394,14 +395,11 @@ Must called from within a `tar-mode' buffer." | |||
| 394 | (describe-package 'simple-single) | 395 | (describe-package 'simple-single) |
| 395 | (goto-char (point-min)) | 396 | (goto-char (point-min)) |
| 396 | (should (search-forward "simple-single is an installed package." nil t)) | 397 | (should (search-forward "simple-single is an installed package." nil t)) |
| 397 | (should (re-search-forward | 398 | (save-excursion (should (re-search-forward "Status: Installed in ['`‘]simple-single-1.3/['’] (unsigned)." nil t))) |
| 398 | "Status: Installed in ['`‘]~/simple-single-1.3/['’] (unsigned)." | 399 | (save-excursion (should (search-forward "Version: 1.3" nil t))) |
| 399 | nil t)) | 400 | (save-excursion (should (search-forward "Summary: A single-file package with no dependencies" nil t))) |
| 400 | (should (search-forward "Version: 1.3" nil t)) | 401 | (save-excursion (should (search-forward "Homepage: http://doodles.au" nil t))) |
| 401 | (should (search-forward "Summary: A single-file package with no dependencies" | 402 | (save-excursion (should (re-search-forward "Keywords: \\[?frobnicate\\]?" nil t))) |
| 402 | nil t)) | ||
| 403 | (should (search-forward "Homepage: http://doodles.au" nil t)) | ||
| 404 | (should (re-search-forward "Keywords: \\[?frobnicate\\]?" nil t)) | ||
| 405 | ;; No description, though. Because at this point we don't know | 403 | ;; No description, though. Because at this point we don't know |
| 406 | ;; what archive the package originated from, and we don't have | 404 | ;; what archive the package originated from, and we don't have |
| 407 | ;; its readme file saved. | 405 | ;; its readme file saved. |