From 47ced4c1b40f22e1ae78f879aacd77cfdc414e0c Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Tue, 13 Nov 2018 12:30:54 +0100 Subject: [PATCH] update paradox. Signed-off-by: Andreas Gerler --- elpa/paradox-20150611.645/paradox-pkg.el | 12 - .../paradox-autoloads.el | 52 ++++- .../paradox-commit-list.el | 0 .../paradox-core.el | 46 ++-- .../paradox-execute.el | 27 ++- .../paradox-github.el | 124 +++++----- .../paradox-menu.el | 221 +++++++++++++----- elpa/paradox-20181027.2234/paradox-pkg.el | 16 ++ .../paradox.el | 39 ++-- 9 files changed, 353 insertions(+), 184 deletions(-) delete mode 100644 elpa/paradox-20150611.645/paradox-pkg.el rename elpa/{paradox-20150611.645 => paradox-20181027.2234}/paradox-autoloads.el (57%) rename elpa/{paradox-20150611.645 => paradox-20181027.2234}/paradox-commit-list.el (100%) rename elpa/{paradox-20150611.645 => paradox-20181027.2234}/paradox-core.el (81%) rename elpa/{paradox-20150611.645 => paradox-20181027.2234}/paradox-execute.el (95%) rename elpa/{paradox-20150611.645 => paradox-20181027.2234}/paradox-github.el (78%) rename elpa/{paradox-20150611.645 => paradox-20181027.2234}/paradox-menu.el (80%) create mode 100644 elpa/paradox-20181027.2234/paradox-pkg.el rename elpa/{paradox-20150611.645 => paradox-20181027.2234}/paradox.el (89%) diff --git a/elpa/paradox-20150611.645/paradox-pkg.el b/elpa/paradox-20150611.645/paradox-pkg.el deleted file mode 100644 index 01aaa479..00000000 --- a/elpa/paradox-20150611.645/paradox-pkg.el +++ /dev/null @@ -1,12 +0,0 @@ -(define-package "paradox" "20150611.645" "A modern Packages Menu. Colored, with package ratings, and customizable." - '((emacs "24.4") - (seq "1.7") - (cl-lib "0.5") - (json "1.3") - (let-alist "1.0.3") - (spinner "1.3")) - :url "http://github.com/Malabarba/paradox" :keywords - '("package" "packages")) -;; Local Variables: -;; no-byte-compile: t -;; End: diff --git a/elpa/paradox-20150611.645/paradox-autoloads.el b/elpa/paradox-20181027.2234/paradox-autoloads.el similarity index 57% rename from elpa/paradox-20150611.645/paradox-autoloads.el rename to elpa/paradox-20181027.2234/paradox-autoloads.el index 8b4119ca..5e08fa64 100644 --- a/elpa/paradox-20150611.645/paradox-autoloads.el +++ b/elpa/paradox-20181027.2234/paradox-autoloads.el @@ -1,9 +1,12 @@ ;;; paradox-autoloads.el --- automatically extracted autoloads ;; ;;; Code: -(add-to-list 'load-path (or (file-name-directory #$) (car load-path))) + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + -;;;### (autoloads nil "paradox" "paradox.el" (21908 14207 0 0)) +;;;### (autoloads nil "paradox" "paradox.el" (0 0 0 0)) ;;; Generated autoloads from paradox.el (autoload 'paradox-list-packages "paradox" "\ @@ -58,11 +61,49 @@ empty. Passing a non-nil REFRESH argument forces this update. \(fn FEATURE &optional FILENAME NOERROR PACKAGE REFRESH)" nil nil) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "paradox" '("paradox-"))) + +;;;*** + +;;;### (autoloads nil "paradox-commit-list" "paradox-commit-list.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from paradox-commit-list.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "paradox-commit-list" '("paradox-"))) + +;;;*** + +;;;### (autoloads nil "paradox-core" "paradox-core.el" (0 0 0 0)) +;;; Generated autoloads from paradox-core.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "paradox-core" '("paradox-"))) + +;;;*** + +;;;### (autoloads nil "paradox-execute" "paradox-execute.el" (0 0 +;;;;;; 0 0)) +;;; Generated autoloads from paradox-execute.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "paradox-execute" '("paradox-"))) + +;;;*** + +;;;### (autoloads nil "paradox-github" "paradox-github.el" (0 0 0 +;;;;;; 0)) +;;; Generated autoloads from paradox-github.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "paradox-github" '("paradox-"))) + +;;;*** + +;;;### (autoloads nil "paradox-menu" "paradox-menu.el" (0 0 0 0)) +;;; Generated autoloads from paradox-menu.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "paradox-menu" '("paradox-"))) + ;;;*** -;;;### (autoloads nil nil ("paradox-commit-list.el" "paradox-core.el" -;;;;;; "paradox-execute.el" "paradox-github.el" "paradox-menu.el" -;;;;;; "paradox-pkg.el") (21908 14207 607948 0)) +;;;### (autoloads nil nil ("paradox-pkg.el") (0 0 0 0)) ;;;*** @@ -70,5 +111,6 @@ empty. Passing a non-nil REFRESH argument forces this update. ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t +;; coding: utf-8 ;; End: ;;; paradox-autoloads.el ends here diff --git a/elpa/paradox-20150611.645/paradox-commit-list.el b/elpa/paradox-20181027.2234/paradox-commit-list.el similarity index 100% rename from elpa/paradox-20150611.645/paradox-commit-list.el rename to elpa/paradox-20181027.2234/paradox-commit-list.el diff --git a/elpa/paradox-20150611.645/paradox-core.el b/elpa/paradox-20181027.2234/paradox-core.el similarity index 81% rename from elpa/paradox-20150611.645/paradox-core.el rename to elpa/paradox-20181027.2234/paradox-core.el index 9be09370..94ef5b88 100644 --- a/elpa/paradox-20150611.645/paradox-core.el +++ b/elpa/paradox-20181027.2234/paradox-core.el @@ -62,50 +62,48 @@ ("incompat" . 0) ("external" . 0) ("installed" . 0) ("unsigned" . 0))) -(defvar paradox--truncate-string-to-width-backup) - (defmacro paradox--cas (string) "Same as (cdr (assoc-string ,STRING paradox--package-count))." `(cdr (assoc-string ,string paradox--package-count))) -(defun paradox--truncate-string-to-width (&rest args) - "Like `truncate-string-to-width', but uses \"…\" on package buffer. +(defun paradox--truncate-string-to-width-filter (args) + "Filter the args of `truncate-string-to-width' to use \"…\". All arguments STR, END-COLUMN, START-COLUMN, PADDING, and -ELLIPSIS are passed to `truncate-string-to-width'. - -\(fn STR END-COLUMN &optional START-COLUMN PADDING ELLIPSIS)" +ELLIPSIS are passed to `truncate-string-to-width'." (when (and (eq major-mode 'paradox-menu-mode) (eq t (nth 4 args))) (setf (nth 4 args) (if (char-displayable-p ?…) "…" "$"))) - (apply paradox--truncate-string-to-width-backup args)) + args) ;;; Overriding definitions +(defvar paradox--backups nil) + (defun paradox--core-enable () "Enable core features." - (paradox--override-definition 'truncate-string-to-width 'paradox--truncate-string-to-width)) - -(defvar paradox--backups nil) + (ignore-errors (setcdr (assq 'menu-bar package-menu-mode-map) nil)) + (advice-add #'truncate-string-to-width :filter-args + #'paradox--truncate-string-to-width-filter + '((name . :paradox-override))) + (add-to-list 'paradox--backups 'truncate-string-to-width)) (defun paradox-disable () "Disable paradox, and go back to regular package-menu." (interactive) - (dolist (it paradox--backups) - (message "Restoring %s to %s" (car it) (eval (cdr it))) - (fset (car it) (eval (cdr it)))) - (setq paradox--backups nil)) + (when paradox--backups + (message "Restoring %s" (mapconcat #'symbol-name paradox--backups ", ")) + (dolist (it paradox--backups) + (advice-remove it :paradox-override)) + (setq paradox--backups nil))) (defun paradox--override-definition (sym newdef) "Temporarily override SYM's function definition with NEWDEF. -The original definition is saved to paradox--SYM-backup." - (let ((backup-name (intern (format "paradox--%s-backup" sym))) - (def (symbol-function sym))) - (unless (assoc sym paradox--backups) - (message "Overriding %s with %s" sym newdef) - (eval (list 'defvar backup-name nil)) - (add-to-list 'paradox--backups (cons sym backup-name)) - (set backup-name def) - (fset sym newdef)))) +Record that in `paradox--backups', but do nothing if +`paradox--backups' reports that it is already overriden." + (unless (memq sym paradox--backups) + (message "Overriding %s with %s" sym newdef) + (advice-add sym :override newdef '((name . :paradox-override))) + (add-to-list 'paradox--backups sym))) ;;; Pre 25.1 support diff --git a/elpa/paradox-20150611.645/paradox-execute.el b/elpa/paradox-20181027.2234/paradox-execute.el similarity index 95% rename from elpa/paradox-20150611.645/paradox-execute.el rename to elpa/paradox-20181027.2234/paradox-execute.el index 715a4cca..a4cba8ae 100644 --- a/elpa/paradox-20150611.645/paradox-execute.el +++ b/elpa/paradox-20181027.2234/paradox-execute.el @@ -109,7 +109,10 @@ occurred during the execution: Argument ALIST describes the operation." (let-alist alist (when .async - (mapc #'package-activate-1 .activated)))) + (dolist (pkg .activated) + (if (fboundp 'package--list-loaded-files) + (package-activate-1 pkg 'reload) + (package-activate-1 pkg)))))) (defun paradox--print-package-list (list) "Print LIST at point." @@ -231,7 +234,7 @@ deleted, and activated packages, and errors." `(let (activated installed deleted errored) (advice-add #'package-activate-1 :after (lambda (pkg &rest _) - (ignore-errors (add-to-list 'activated pkg 'append))) + (ignore-errors (push pkg activated))) '((name . paradox--track-activated))) (condition-case err (progn @@ -241,18 +244,20 @@ deleted, and activated packages, and errors." (package-install pkg 'dont-select) (package-install pkg)) (push pkg installed)) - (dolist (pkg ,delete) - (condition-case err - (progn (package-delete pkg) - (push pkg deleted)) - (error (push err errored))))) + (let ((delete-list ,delete)) + (dolist (pkg (if (fboundp 'package--sort-by-dependence) + (package--sort-by-dependence delete-list) + delete-list)) + (condition-case err + (progn (package-delete pkg) + (push pkg deleted)) + (error (push err errored)))))) (error (push err errored))) (advice-remove #'package-activate-1 'paradox--track-activated) (list (cons 'installed (nreverse installed)) - (cons 'deleted (nreverse deleted)) - ;; Because we used 'append, this is in the right order. - (cons 'activated activated) - (cons 'error (nreverse errored))))) + (cons 'deleted (nreverse deleted)) + (cons 'activated (nreverse activated)) + (cons 'error (nreverse errored))))) (defvar paradox--current-filter) diff --git a/elpa/paradox-20150611.645/paradox-github.el b/elpa/paradox-20181027.2234/paradox-github.el similarity index 78% rename from elpa/paradox-20150611.645/paradox-github.el rename to elpa/paradox-20181027.2234/paradox-github.el index a8dd77cc..8c3a30bc 100644 --- a/elpa/paradox-20150611.645/paradox-github.el +++ b/elpa/paradox-20181027.2234/paradox-github.el @@ -45,12 +45,9 @@ Currently, that means (un)starring repos. To generate an access token: - 1. Visit the page https://github.com/settings/tokens/new and - login to github (if asked). - 2. Give the token any name you want (Paradox, for instance). - 3. The only permission we need is \"public_repo\", so unmark - all others. - 4. Click on \"Generate Token\", copy the generated token, and + 1. Visit the page https://github.com/settings/tokens/new?scopes=public_repo&description=Paradox + and login to github (if asked). + 2. Click on \"Generate Token\", copy the generated token, and save it to this variable by writing (setq paradox-github-token TOKEN) somewhere in your configuration and evaluating it (or just @@ -64,6 +61,10 @@ When you save this variable, DON'T WRITE IT ANYWHERE PUBLIC. This token grants (very) limited access to your account. END DISCLAIMER +One way to make this variable safer is to set it from your +authinfo.gpg file. See this issue for instructions on how to do that: +https://github.com/Malabarba/paradox/issues/147#issuecomment-409336111 + Paradox will ask you whether you want github integration the first time you start it. If you answer \"no\", it will remember your choice via `customize-save-variable'. You can do this @@ -117,7 +118,7 @@ This will allow you to star/unstar packages from the Package Menu. ")) (delete-other-windows)) (if (y-or-n-p "Follow the instructions on the `paradox-github-token' variable. May I take you to the token generation page? ") - (browse-url "https://github.com/settings/tokens/new")) + (browse-url "https://github.com/settings/tokens/new?scopes=public_repo&description=Paradox")) (message "Once you're finished, simply call `paradox-list-packages' again.") nil)))) @@ -148,7 +149,7 @@ If QUERY is non-nil, ask the user first. Throws error if repo is malformed." (when (or (not query) (y-or-n-p (format "Really %sstar %s? " - (if delete "un" "") repo))) + (if delete "un" "") repo))) (paradox--github-action-star repo delete) (message "%starred %s." (if delete "Uns" "S") repo) (if delete @@ -172,32 +173,32 @@ Much faster than `json-read'." (defun paradox--refresh-user-starred-list (&optional async) "Fetch the user's list of starred repos." - (paradox--github-action - "user/starred?per_page=100" - :async (when async 'refresh) - :callback (lambda (res) - (setq paradox--user-starred-repos - (make-hash-table :size (length res) - :test #'equal)) - (dolist (it res) - (puthash it t paradox--user-starred-repos))) - :reader #'paradox--full-name-reader)) + (paradox--github-action "user/starred?per_page=100" + :async (when async 'refresh) + :callback (lambda (res) + (setq paradox--user-starred-repos + (make-hash-table :size (length res) + :test #'equal)) + (dolist (it res) + (puthash it t paradox--user-starred-repos))) + :reader #'paradox--full-name-reader)) (defun paradox--github-action-star (repo &optional delete) "Call `paradox--github-action' with \"user/starred/REPO\" as the action. DELETE and NO-RESULT are passed on." (paradox--github-action (concat "user/starred/" repo) - :async t - :method (if (stringp delete) delete - (if delete "DELETE" "PUT")))) + :async t + :method (if (stringp delete) delete + (if delete "DELETE" "PUT")))) ;;; The Base (generic) function -(defun paradox--github-report (text) +(defun paradox--github-report (&rest text) "Write TEXT to the *Paradox Github* buffer." (with-current-buffer (get-buffer-create "*Paradox Report*") - (erase-buffer) - (insert text) + (let ((inhibit-read-only t)) + (erase-buffer) + (apply #'insert text)) (goto-char (point-min)))) (defun paradox--github-error (format &rest args) @@ -206,8 +207,8 @@ Also print contents of current buffer to *Paradox Github*." (declare (indent 1)) (paradox--github-report (buffer-string)) (apply #'error - (concat format " See *Paradox Github* buffer for the full result") - args)) + (concat format " See *Paradox Github* buffer for the full result") + args)) (defvar paradox--github-errors-to-ignore nil "List of numbers to ignore when parsing the HTML return code. @@ -229,22 +230,28 @@ Leave point at the return code on the first line." ;; I'll implement redirection if anyone ever reports this. ;; For now, I haven't found a place where it's used. ((or `301 `302 `303 `304 `305 `306 `307) - (paradox--github-error - "Received a redirect reply, please file a bug report (M-x `paradox-bug-report')")) - ((or `403 `404) ;; Not found. + (paradox--github-report "Redirect received:\n\n" (buffer-string)) + ;; (message "Received a redirect reply, please file a bug report (M-x `paradox-bug-report')") + nil) + ((or `404) ;; Not found. (paradox--github-report (buffer-string)) (message "This repo doesn't seem to exist, Github replied with: %s" - (substring (thing-at-point 'line) 0 -1)) + (substring (thing-at-point 'line) 0 -1)) nil) + ((or `403) ;; Forbidden + (paradox--github-error + "Github wouldn't let me do this - does your token have the right permissions? They're here: https://github.com/settings/tokens")) ((or `400 `422) ;; Bad request. (paradox--github-error - "Github didn't understand my request, please file a bug report (M-x `paradox-bug-report')")) + "Github didn't understand my request, please file a bug report (M-x `paradox-bug-report')")) (`401 (paradox--github-error - (if (stringp paradox-github-token) - "Github says you're not authenticated, try creating a new Github token" - "Github says you're not authenticated, you need to configure `paradox-github-token'"))) + (if (stringp paradox-github-token) + "Github says you're not authenticated, try creating a new Github token" + "Github says you're not authenticated, you need to configure `paradox-github-token'"))) (_ (paradox--github-error "Github returned: %S" - (substring (thing-at-point 'line) 0 -1))))) + (substring (thing-at-point 'line) 0 -1))))) + +(defvar paradox--github-next-page nil) (defmacro paradox--with-github-buffer (method action async unwind-form &rest body) @@ -267,9 +274,10 @@ value." (let ((next-page)) (when (search-forward-regexp "^Link: .*<\\([^>]+\\)>; rel=\"next\"" nil t) - (setq next-page (match-string-no-properties 1))) + (setq next-page (match-string-no-properties 1)) + (setq paradox--github-next-page next-page)) (ignore next-page) - (search-forward-regexp "^ ?$") + (search-forward-regexp "^\r?$") (skip-chars-forward "[:blank:]\n\r") (delete-region (point-min) (point)) ,@body)) @@ -279,7 +287,7 @@ value." ,unwind-form (paradox--github-report (buffer-string)) (message "async curl command %s\n method: %s\n action: %s" - event ,method ,action)))))) + event ,method ,action)))))) (if ,async (condition-case nil (set-process-sentinel @@ -294,19 +302,19 @@ value." ;; Make the request. (condition-case nil (apply #'call-process - "curl" nil t nil "-s" "-i" "-d" "" "-X" ,method ,action - (when (stringp paradox-github-token) - (list "-u" (concat paradox-github-token ":x-oauth-basic")))) + "curl" nil t nil "-s" "-i" "-d" "" "-X" ,method ,action + (when (stringp paradox-github-token) + (list "-u" (concat paradox-github-token ":x-oauth-basic")))) (error ,unwind-form)) ;; Do the processing. (funcall ,call-name)))))) (cl-defun paradox--github-action (action &key - (method "GET") - reader - max-pages - (callback #'identity) - async) + (method "GET") + reader + max-pages + (callback #'identity) + async) "Contact the github api performing ACTION with METHOD. Default METHOD is \"GET\". @@ -337,6 +345,7 @@ ASYNC determines to run the command asynchronously. In this case, the function's return value is undefined. In particular, if ASYNC is the symbol refresh, it means the package-menu should be refreshed after the operation is done." + (declare (indent 1)) ;; Make sure the token's configured. (unless (string-match "\\`https?://" action) (setq action (concat "https://api.github.com/" action))) @@ -345,26 +354,25 @@ refreshed after the operation is done." (when do-update (add-to-list 'package--downloads-in-progress do-update)) (paradox--with-github-buffer method action async - (paradox--update-downloads-in-progress - do-update) + (paradox--update-downloads-in-progress + do-update) (cond ((not reader) (funcall callback nil)) ((or (not next-page) (and max-pages (< max-pages 2))) (funcall callback - (unless (eobp) (funcall reader)))) + (unless (eobp) (funcall reader)))) (t (let ((result (unless (eobp) (funcall reader)))) - (paradox--github-action - next-page - :method method - :reader reader - :async async - :max-pages (when max-pages (1- max-pages)) - :callback (lambda (res) - (funcall callback - (append result res)))))))))) + (paradox--github-action next-page + :method method + :reader reader + :async async + :max-pages (when max-pages (1- max-pages)) + :callback (lambda (res) + (funcall callback + (append result res)))))))))) (provide 'paradox-github) ;;; paradox-github.el ends here diff --git a/elpa/paradox-20150611.645/paradox-menu.el b/elpa/paradox-20181027.2234/paradox-menu.el similarity index 80% rename from elpa/paradox-20150611.645/paradox-menu.el rename to elpa/paradox-20181027.2234/paradox-menu.el index 67ba0c96..aef469a3 100644 --- a/elpa/paradox-20150611.645/paradox-menu.el +++ b/elpa/paradox-20181027.2234/paradox-menu.el @@ -21,12 +21,11 @@ ;; GNU General Public License for more details. ;; -;;; Change Log: -;; ;;; Code: (require 'cl-lib) (require 'package) (require 'subr-x) +(require 'hydra) (require 'paradox-core) (require 'paradox-github) @@ -84,8 +83,9 @@ :package-version '(paradox . "1.2.3")) (defface paradox-mode-line-face - '((t :inherit mode-line-buffer-id :weight normal :foreground "Black")) - "Face used on the package's name." + '((t :inherit (font-lock-keyword-face mode-line-buffer-id) + :weight normal)) + "Face used on mode line statuses." :group 'paradox) (defface paradox-name-face '((t :inherit link)) @@ -214,30 +214,35 @@ Return (PKG-DESC [STAR NAME VERSION STATUS DOC])." (url (paradox--package-homepage pkg-desc)) (name (symbol-name (package-desc-name pkg-desc))) (name-length (length name)) - (button-length (length paradox-homepage-button-string))) + (counts (paradox--count-print (package-desc-name pkg-desc))) + (button-length (if paradox-use-homepage-buttons (length paradox-homepage-button-string) 0))) (paradox--incf status) + (let ((cell (assq :stars (package-desc-extras pkg-desc)))) + (if cell + (setcdr cell counts) + (push (cons :stars counts) (package-desc-extras pkg-desc)))) (list pkg-desc `[,(concat - (propertize name - 'font-lock-face 'paradox-name-face - 'button t - 'follow-link t - 'help-echo (format "Package: %s" name) - 'package-desc pkg-desc - 'action 'package-menu-describe-package) - (if (and paradox-use-homepage-buttons url - (< (+ name-length button-length) paradox-column-width-package)) - (concat - (make-string (- paradox-column-width-package name-length button-length) ?\s) - (propertize paradox-homepage-button-string - 'font-lock-face 'paradox-homepage-button-face - 'mouse-face 'custom-button-mouse - 'help-echo (format "Visit %s" url) - 'button t - 'follow-link t - 'keymap '(keymap (mouse-2 . push-button)) - 'action #'paradox-menu-visit-homepage)) - "")) + (truncate-string-to-width + (propertize name + 'font-lock-face 'paradox-name-face + 'button t + 'follow-link t + 'help-echo (format "Package: %s" name) + 'package-desc pkg-desc + 'action 'package-menu-describe-package) + (- paradox-column-width-package button-length) 0 nil t) + (when (and paradox-use-homepage-buttons url) + (make-string (max 0 (- paradox-column-width-package name-length button-length)) ?\s)) + (when (and paradox-use-homepage-buttons url) + (propertize paradox-homepage-button-string + 'font-lock-face 'paradox-homepage-button-face + 'mouse-face 'custom-button-mouse + 'help-echo (format "Visit %s" url) + 'button t + 'follow-link t + 'keymap '(keymap (mouse-2 . push-button)) + 'action #'paradox-menu-visit-homepage))) ,(propertize (package-version-join (package-desc-version pkg-desc)) 'font-lock-face face) @@ -245,7 +250,7 @@ Return (PKG-DESC [STAR NAME VERSION STATUS DOC])." ,@(if (cdr package-archives) (list (propertize (or (package-desc-archive pkg-desc) "") 'font-lock-face 'paradox-archive-face))) - ,@(paradox--count-print (package-desc-name pkg-desc)) + ,@counts ,(propertize (concat (propertize " " 'display paradox--desc-prefix) (package-desc-summary pkg-desc) @@ -282,6 +287,7 @@ Return (PKG-DESC [STAR NAME VERSION STATUS DOC])." (or homepage (and (setq extras (gethash name paradox--package-repo-list)) (format "https://github.com/%s" extras))))) + (defun paradox--get-or-return-package (pkg) "Take a marker or package name PKG and return a package name." (if (or (markerp pkg) (null pkg)) @@ -330,17 +336,17 @@ automatically decides whether to download asynchronously based on `package-menu-async'." (declare (indent 2) (debug t)) (require 'package) - (if (fboundp 'package--with-work-buffer-async) - `(package--with-work-buffer-async - ,location ,file - (when package-menu-async - #'paradox--handle-failed-download) + (if (fboundp 'package--with-response-buffer) + `(package--with-response-buffer + ,location :file ,file + :async package-menu-async + :error-form (paradox--handle-failed-download) ,@body (paradox--update-downloads-in-progress 'paradox--data)) `(package--with-work-buffer ,location ,file ,@body))) -(defun paradox--refresh-star-count () - "Download the star-count file and populate the respective variable." +(defun paradox--refresh-remote-data () + "Download metadata and populate the respective variables." (interactive) (when (boundp 'package--downloads-in-progress) (add-to-list 'package--downloads-in-progress 'paradox--data)) @@ -364,11 +370,11 @@ automatically decides whether to download asynchronously based on 'paradox-star-face)))) (defun paradox--star-predicate (A B) - "Non-nil t if star count of A is larget than B." + "Non-nil t if star count of A is larger than B." (> (string-to-number (elt (cadr A) paradox--column-index-star)) (string-to-number (elt (cadr B) paradox--column-index-star)))) (defun paradox--download-predicate (A B) - "Non-nil t if download count of A is larget than B." + "Non-nil t if download count of A is larger than B." (> (get-text-property 0 'value (elt (cadr A) paradox--column-index-download)) (get-text-property 0 'value (elt (cadr B) paradox--column-index-download)))) @@ -385,10 +391,11 @@ shown." (if keywords (mapconcat 'identity keywords ",") nil)) (let ((idx (paradox--column-index "Package"))) - (setcar (elt tabulated-list-format idx) - (if keywords - (concat "Package[" paradox--current-filter "]") - "Package"))) + (when (integerp idx) + (setcar (elt tabulated-list-format idx) + (if keywords + (concat "Package[" paradox--current-filter "]") + "Package")))) (tabulated-list-print remember-pos) (tabulated-list-init-header) (paradox--update-mode-line)) @@ -405,8 +412,9 @@ If `paradox-hide-wiki-packages' is nil, just return PKGS." (remq nil (mapcar (lambda (entry) - (unless (gethash (car entry) paradox--wiki-packages) - (car entry))) + (let ((name (or (car-safe entry) entry))) + (unless (gethash name paradox--wiki-packages) + name))) (if (or (not pkgs) (eq t pkgs)) package-archive-contents pkgs))))) @@ -503,7 +511,7 @@ Letters do not insert themselves; instead, they are commands. (setq tabulated-list-sort-key (cons "Status" nil)) (add-hook 'tabulated-list-revert-hook #'paradox-menu--refresh nil t) (add-hook 'tabulated-list-revert-hook #'paradox-refresh-upgradeable-packages nil t) - ;; (add-hook 'tabulated-list-revert-hook #'paradox--refresh-star-count nil t) + ;; (add-hook 'tabulated-list-revert-hook #'paradox--refresh-remote-data nil t) (add-hook 'tabulated-list-revert-hook #'paradox--update-mode-line 'append t) (tabulated-list-init-header) ;; We need package-menu-mode to be our parent, otherwise some @@ -513,6 +521,8 @@ Letters do not insert themselves; instead, they are commands. (put 'paradox-menu-mode 'derived-mode-parent 'package-menu-mode) (run-hooks 'package-menu-mode-hook)) +(put 'paradox-menu-mode 'derived-mode-parent 'package-menu-mode) + (defun paradox--define-sort (name &optional key) "Define sorting by column NAME and bind it to KEY. Defines a function called paradox-sort-by-NAME." @@ -589,21 +599,62 @@ Test match against name and summary." (setq paradox--current-filter (concat "Regexp:" regexp))) (set-keymap-parent paradox-menu-mode-map package-menu-mode-map) -(defvar paradox--filter-map) -(define-prefix-command 'paradox--filter-map) (define-key paradox-menu-mode-map "q" #'paradox-quit-and-close) (define-key paradox-menu-mode-map "p" #'paradox-previous-entry) (define-key paradox-menu-mode-map "n" #'paradox-next-entry) (define-key paradox-menu-mode-map "k" #'paradox-previous-describe) (define-key paradox-menu-mode-map "j" #'paradox-next-describe) -(define-key paradox-menu-mode-map "f" 'paradox--filter-map) (define-key paradox-menu-mode-map "s" #'paradox-menu-mark-star-unstar) (define-key paradox-menu-mode-map "h" #'paradox-menu-quick-help) (define-key paradox-menu-mode-map "v" #'paradox-menu-visit-homepage) +(define-key paradox-menu-mode-map "w" #'paradox-menu-copy-homepage-as-kill) (define-key paradox-menu-mode-map "l" #'paradox-menu-view-commit-list) (define-key paradox-menu-mode-map "x" #'paradox-menu-execute) (define-key paradox-menu-mode-map "\r" #'paradox-push-button) (define-key paradox-menu-mode-map "F" 'package-menu-filter) +(if (version< emacs-version "25") + (defhydra hydra-paradox-filter (:color blue :hint nil) + " +Filter by: +_u_pgrades _r_egexp _k_eyword _s_tarred _c_lear +" + ("f" package-menu-filter) + ("k" package-menu-filter) + ("r" paradox-filter-regexp) + ("u" paradox-filter-upgrades) + ("s" paradox-filter-stars) + ("c" paradox-filter-clear) + ("g" paradox-filter-clear) + ("q" nil "cancel" :color blue)) + (defhydra hydra-paradox-filter (:color blue :hint nil) + " +Filter by: +_u_pgrades _r_egexp _k_eyword _s_tarred _c_lear +Archive: g_n_u _o_ther +Status: _i_nstalled _a_vailable _d_ependency _b_uilt-in +" + ("f" package-menu-filter) + ("k" package-menu-filter) + ("n" (package-menu-filter "arc:gnu")) + ("o" (package-menu-filter + (remove "arc:gnu" + (mapcar (lambda (e) (concat "arc:" (car e))) + package-archives)))) + ("r" paradox-filter-regexp) + ("u" paradox-filter-upgrades) + ("s" paradox-filter-stars) + ("i" (package-menu-filter "status:installed")) + ("a" (package-menu-filter "status:available")) + ("b" (package-menu-filter "status:built-in")) + ("d" (package-menu-filter "status:dependency")) + ("c" paradox-filter-clear) + ("g" paradox-filter-clear) + ("q" nil "cancel" :color blue))) +(define-key paradox-menu-mode-map "f" #'hydra-paradox-filter/body) + +;;; for those who don't want a hydra +(defvar paradox--filter-map) +(define-prefix-command 'paradox--filter-map) (define-key paradox--filter-map "k" #'package-menu-filter) (define-key paradox--filter-map "f" #'package-menu-filter) (define-key paradox--filter-map "r" #'paradox-filter-regexp) @@ -611,6 +662,58 @@ Test match against name and summary." (define-key paradox--filter-map "s" #'paradox-filter-stars) (define-key paradox--filter-map "c" #'paradox-filter-clear) +(easy-menu-define paradox-menu-mode-menu paradox-menu-mode-map + "Menu for `paradox-menu-mode'." + `("Paradox" + ["Describe Package" package-menu-describe-package :help "Display information about this package"] + ["Help" paradox-menu-quick-help :help "Show short key binding help for package-menu-mode"] + + "--" + ["Refresh Package List" package-menu-refresh + :help "Redownload the ELPA archive" + :active (not package--downloads-in-progress)] + ["Execute Marked Actions" paradox-menu-execute :help "Perform all the marked actions"] + ["Mark All Available Upgrades" package-menu-mark-upgrades + :help "Mark packages that have a newer version for upgrading" + :active (not package--downloads-in-progress)] + + ("Other Mark Actions" + ["Mark All Obsolete for Deletion" package-menu-mark-obsolete-for-deletion :help "Mark all obsolete packages for deletion"] + ["Mark for Install" package-menu-mark-install :help "Mark a package for installation and move to the next line"] + ["Mark for Deletion" package-menu-mark-delete :help "Mark a package for deletion and move to the next line"] + ["Unmark" package-menu-mark-unmark :help "Clear any marks on a package and move to the next line"]) + + "--" + ("Github" :visible (stringp paradox-github-token) + ["Star or unstar this package" paradox-menu-mark-star-unstar] + ["Star all installed packages" paradox-star-all-installed-packages] + ["Star packages when installing" (customize-save-variable 'paradox-automatically-star (not paradox-automatically-star)) + :help "Automatically star packages that you install (and unstar packages you delete)" + :style toggle :selected paradox-automatically-star]) + ["Configure Github Inegration" (paradox--check-github-token) :visible (not paradox-github-token)] + ["View Changelog" paradox-menu-view-commit-list :help "Show a package's commit list on Github"] + ["Visit Homepage" paradox-menu-visit-homepage :help "Visit a package's Homepage on a browser"] + + "--" + ("Filter Package List" + ["Clear filter" paradox-filter-clear :help "Go back to unfiltered list"] + ["By Keyword" package-menu-filter :help "Filter by package keyword"] + ["By Upgrades" paradox-filter-upgrades :help "List only upgradeable packages"] + ["By Regexp" paradox-filter-regexp :help "Filter packages matching a regexp"] + ["By Starred" paradox-filter-stars :help "List only packages starred by the user"]) + ("Sort Package List" + ["By Package Name" paradox-sort-by-package] + ["By Status (default)" paradox-sort-by-status] + ["By Number of Stars" paradox-sort-by-★]) + ["Hide by Regexp" package-menu-hide-package :help "Permanently hide all packages matching a regexp"] + ["Display Older Versions" package-menu-toggle-hiding + :style toggle :selected (not package-menu--hide-packages) + :help "Display package even if a newer version is already installed"] + + "--" + ["Quit" quit-window :help "Quit package selection"] + ["Customize" (customize-group 'package)])) + ;;; Menu Mode Commands (defun paradox-previous-entry (&optional n) @@ -654,7 +757,7 @@ With prefix N, move to the N-th previous package instead." (defvar paradox--key-descriptors '(("next," "previous," "install," "delete," ("execute," . 1) "refresh," "help") - ("star," "visit homepage") + ("star," "visit homepage," "unmark," ("mark Upgrades," . 5) "~delete obsolete") ("list commits") ("filter by" "+" "upgrades" "regexp" "keyword" "starred" "clear") ("Sort by" "+" "Package name" "Status" "*(star)"))) @@ -687,6 +790,19 @@ PKG is a symbol. Interactively it is the package under point." (propertize (symbol-name pkg) 'face 'font-lock-keyword-face))))) +(defun paradox-menu-copy-homepage-as-kill (pkg) + "Save the homepage of package named PKG as kill. +PKG is a symbol. Interactively it is the package under point." + (interactive '(nil)) + (let ((url (paradox--package-homepage + (paradox--get-or-return-package pkg)))) + (if (stringp url) + (progn (kill-new url) + (message "copied \"%s\"" url)) + (message "Package %s has no homepage." + (propertize (symbol-name pkg) + 'face 'font-lock-keyword-face))))) + (defun paradox-menu-mark-star-unstar () "Star or unstar a package and move to the next line." (interactive) @@ -763,15 +879,7 @@ nil) on the Packages buffer." (mapc #'paradox--set-local-value paradox-local-variables) (let ((total-lines (int-to-string (length tabulated-list-entries)))) (paradox--update-mode-line-front-space total-lines) - (paradox--update-mode-line-buffer-identification total-lines)) - (set-face-foreground - 'paradox-mode-line-face - (let ((fg (or (face-foreground 'mode-line-buffer-id nil t) - (face-foreground 'default nil t)))) - (when fg - (if (> (color-distance "white" fg) - (color-distance "black" fg)) - "black" "white"))))) + (paradox--update-mode-line-buffer-identification total-lines))) (defun paradox--update-mode-line-buffer-identification (_total-lines) "Update `mode-line-buffer-identification'. @@ -790,8 +898,7 @@ TOTAL-LINES is currently unused." (paradox--cas "dependency") (paradox--cas "unsigned"))) (paradox--current-filter - "" ,(paradox--build-buffer-id " Total:" (length package-archive-contents))) - (spinner-current " Executing Transaction")))) + "" ,(paradox--build-buffer-id " Total:" (length package-archive-contents)))))) (defvar sml/col-number) (defvar sml/numbers-separator) diff --git a/elpa/paradox-20181027.2234/paradox-pkg.el b/elpa/paradox-20181027.2234/paradox-pkg.el new file mode 100644 index 00000000..fc718fb9 --- /dev/null +++ b/elpa/paradox-20181027.2234/paradox-pkg.el @@ -0,0 +1,16 @@ +(define-package "paradox" "20181027.2234" "A modern Packages Menu. Colored, with package ratings, and customizable." + '((emacs "24.4") + (seq "1.7") + (let-alist "1.0.3") + (spinner "1.7.3") + (hydra "0.13.2")) + :keywords + '("package" "packages") + :authors + '(("Artur Malabarba" . "emacs@endlessparentheses.com")) + :maintainer + '("Artur Malabarba" . "emacs@endlessparentheses.com") + :url "https://github.com/Malabarba/paradox") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/paradox-20150611.645/paradox.el b/elpa/paradox-20181027.2234/paradox.el similarity index 89% rename from elpa/paradox-20150611.645/paradox.el rename to elpa/paradox-20181027.2234/paradox.el index 264acfd0..2acb862e 100644 --- a/elpa/paradox-20150611.645/paradox.el +++ b/elpa/paradox-20181027.2234/paradox.el @@ -3,10 +3,10 @@ ;; Copyright (C) 2014-2015 Artur Malabarba ;; Author: Artur Malabarba -;; URL: http://github.com/Malabarba/paradox -;; Version: 2.3.2 +;; URL: https://github.com/Malabarba/paradox +;; Version: 2.5.1 ;; Keywords: package packages -;; Package-Requires: ((emacs "24.4") (seq "1.7") (cl-lib "0.5") (json "1.3") (let-alist "1.0.3") (spinner "1.3")) +;; Package-Requires: ((emacs "24.4") (seq "1.7") (let-alist "1.0.3") (spinner "1.7.3") (hydra "0.13.2")) ;; Prefix: paradox ;; Separator: - @@ -107,7 +107,7 @@ (require 'paradox-execute) (require 'paradox-menu) -(defconst paradox-version "2.3.2" "Version of the paradox.el package.") +(defconst paradox-version "2.5.1" "Version of the paradox.el package.") (defun paradox-bug-report () "Opens github issues page in a web browser. Please send any bugs you find. Please include your Emacs and paradox versions." @@ -148,18 +148,18 @@ for packages. (interactive "P") (when (paradox--check-github-token) (paradox-enable) - (unless no-fetch - (if (fboundp 'package--update-downloads-in-progress) - (when (boundp 'package--downloads-in-progress) - (add-to-list 'package--downloads-in-progress 'paradox--data)) - (paradox--refresh-star-count))) - (package-list-packages no-fetch) - (unless no-fetch - (when (stringp paradox-github-token) - (paradox--refresh-user-starred-list - (bound-and-true-p package-menu-async))) - (when (fboundp 'package--update-downloads-in-progress) - (paradox--refresh-star-count))))) + (let ((is-25 (fboundp 'package--with-response-buffer))) + (unless no-fetch + (if is-25 + (add-to-list 'package--downloads-in-progress 'paradox--data) + (paradox--refresh-remote-data))) + (package-list-packages no-fetch) + (unless no-fetch + (when (stringp paradox-github-token) + (paradox--refresh-user-starred-list + (bound-and-true-p package-menu-async))) + (when is-25 + (paradox--refresh-remote-data)))))) ;;;###autoload (defun paradox-upgrade-packages (&optional no-fetch) @@ -176,13 +176,18 @@ prevents re-download of information about new versions. It does not prevent downloading the actual packages (obviously)." (interactive "P") (save-window-excursion - (paradox-list-packages no-fetch) + (let ((package-menu-async nil)) + (paradox-list-packages no-fetch)) (package-menu-mark-upgrades) (paradox-menu-execute 'noquery))) (defun paradox-enable () "Enable paradox, overriding the default package-menu." (interactive) + (when (and (fboundp 'package--update-downloads-in-progress) + (not (fboundp 'package--with-response-buffer))) + (message "[Paradox] Your Emacs snapshot is outdated, please install a more recent one.") + (setq package-menu-async nil)) (paradox--override-definition 'package-menu--print-info 'paradox--print-info) (when (fboundp 'package-menu--print-info-simple) (paradox--override-definition 'package-menu--print-info-simple 'paradox--print-info)) -- 2.47.3