From 3f9b121c39712e38f6349de97095cbb85014e3c7 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Tue, 13 Nov 2018 15:10:54 +0100 Subject: [PATCH] update package-lint. Signed-off-by: Andreas Gerler --- .../package-lint-pkg.el | 2 - .../package-lint-autoloads.el | 28 +++++++- .../package-lint-flymake.el | 66 +++++++++++++++++++ .../package-lint-pkg.el | 14 ++++ .../package-lint.el | 62 ++++++++++------- 5 files changed, 143 insertions(+), 29 deletions(-) delete mode 100644 elpa/package-lint-20171201.1903/package-lint-pkg.el rename elpa/{package-lint-20171201.1903 => package-lint-20181017.623}/package-lint-autoloads.el (59%) create mode 100644 elpa/package-lint-20181017.623/package-lint-flymake.el create mode 100644 elpa/package-lint-20181017.623/package-lint-pkg.el rename elpa/{package-lint-20171201.1903 => package-lint-20181017.623}/package-lint.el (95%) diff --git a/elpa/package-lint-20171201.1903/package-lint-pkg.el b/elpa/package-lint-20171201.1903/package-lint-pkg.el deleted file mode 100644 index af0cb96b..00000000 --- a/elpa/package-lint-20171201.1903/package-lint-pkg.el +++ /dev/null @@ -1,2 +0,0 @@ -;;; -*- no-byte-compile: t -*- -(define-package "package-lint" "20171201.1903" "A linting library for elisp package authors" '((cl-lib "0.5") (emacs "24")) :commit "9abfb14d9ad903ef73895a27b9964b5e6023d752" :url "https://github.com/purcell/package-lint" :keywords '("lisp")) diff --git a/elpa/package-lint-20171201.1903/package-lint-autoloads.el b/elpa/package-lint-20181017.623/package-lint-autoloads.el similarity index 59% rename from elpa/package-lint-20171201.1903/package-lint-autoloads.el rename to elpa/package-lint-20181017.623/package-lint-autoloads.el index eb7780b4..8a3ad307 100644 --- a/elpa/package-lint-20171201.1903/package-lint-autoloads.el +++ b/elpa/package-lint-20181017.623/package-lint-autoloads.el @@ -1,10 +1,12 @@ ;;; package-lint-autoloads.el --- automatically extracted autoloads ;; ;;; Code: -(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + -;;;### (autoloads nil "package-lint" "package-lint.el" (23128 33859 -;;;;;; 526835 285000)) +;;;### (autoloads nil "package-lint" "package-lint.el" (0 0 0 0)) ;;; Generated autoloads from package-lint.el (autoload 'package-lint-buffer "package-lint" "\ @@ -39,11 +41,31 @@ Return non-nil if the current buffer appears to be intended as a package. \(fn)" nil nil) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "package-lint" '("package-lint--"))) + +;;;*** + +;;;### (autoloads nil "package-lint-flymake" "package-lint-flymake.el" +;;;;;; (0 0 0 0)) +;;; Generated autoloads from package-lint-flymake.el + +(autoload 'package-lint-setup-flymake "package-lint-flymake" "\ +Setup package-lint integration with Flymake. + +\(fn)" nil nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "package-lint-flymake" '("package-lint-"))) + +;;;*** + +;;;### (autoloads nil nil ("package-lint-pkg.el") (0 0 0 0)) + ;;;*** ;; Local Variables: ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t +;; coding: utf-8 ;; End: ;;; package-lint-autoloads.el ends here diff --git a/elpa/package-lint-20181017.623/package-lint-flymake.el b/elpa/package-lint-20181017.623/package-lint-flymake.el new file mode 100644 index 00000000..e9550bbd --- /dev/null +++ b/elpa/package-lint-20181017.623/package-lint-flymake.el @@ -0,0 +1,66 @@ +;;; package-lint-flymake.el --- A package-lint Flymake backend -*- lexical-binding: t; -*- +;; +;; Copyright (C) 2018 J. Alexander Branham (alex DOT branham AT gmail DOT com) +;; +;; This file is not part of GNU Emacs. +;; +;; This is free software; you can redistribute it and/or modify it under +;; the terms of the GNU General Public License as published by the Free +;; Software Foundation; either version 3, or (at your option) any later +;; version. +;; +;; This is distributed in the hope that it will be useful, but WITHOUT +;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +;; for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +;; MA 02110-1301 USA. +;; +;;; Commentary: +;; +;; Flymake is the built-in Emacs package to support on-the-fly syntax +;; checking. This file adds support for flymake to `package-lint'. +;; Enable it by calling `package-lint-setup-flymake' from a +;; file-visiting buffer. To enable in all `emacs-lisp-mode' buffers: +;; +;; (add-hook 'emacs-lisp-mode-hook #'package-lint-setup-flymake) +;; +;;; Code: +(eval-when-compile + (require 'cl-lib)) +(require 'flymake) +(require 'package-lint) + +(defvar-local package-lint--flymake-proc nil) + +(defun package-lint-flymake (report-fn &rest _args) + "A Flymake backend for `package-lint'. +Use `package-lint-setup-flymake' to add this to +`flymake-diagnostic-functions'. Calls REPORT-FN directly." + (let ((collection (package-lint-buffer))) + (cl-loop for (line col type message) in + collection + for (beg . end) = (flymake-diag-region (current-buffer) line col) + collect + (flymake-make-diagnostic + (current-buffer) + beg end + (if (eq type 'warning) :warning :error) + message) + into diags + finally (funcall report-fn diags)))) + +;;;###autoload +(defun package-lint-setup-flymake () + "Setup package-lint integration with Flymake." + (if (< emacs-major-version 26) + (error "Package-lint-flymake requires Emacs 26 or later") + (add-hook 'flymake-diagnostic-functions #'package-lint-flymake nil t) + (flymake-mode))) + +(provide 'package-lint-flymake) + +;;; package-lint-flymake.el ends here diff --git a/elpa/package-lint-20181017.623/package-lint-pkg.el b/elpa/package-lint-20181017.623/package-lint-pkg.el new file mode 100644 index 00000000..d5ad3928 --- /dev/null +++ b/elpa/package-lint-20181017.623/package-lint-pkg.el @@ -0,0 +1,14 @@ +(define-package "package-lint" "20181017.623" "A linting library for elisp package authors" + '((cl-lib "0.5") + (emacs "24")) + :keywords + '("lisp") + :authors + '(("Steve Purcell" . "steve@sanityinc.com") + ("Fanael Linithien" . "fanael4@gmail.com")) + :maintainer + '("Steve Purcell" . "steve@sanityinc.com") + :url "https://github.com/purcell/package-lint") +;; Local Variables: +;; no-byte-compile: t +;; End: diff --git a/elpa/package-lint-20171201.1903/package-lint.el b/elpa/package-lint-20181017.623/package-lint.el similarity index 95% rename from elpa/package-lint-20171201.1903/package-lint.el rename to elpa/package-lint-20181017.623/package-lint.el index 710058c5..48d357a2 100644 --- a/elpa/package-lint-20171201.1903/package-lint.el +++ b/elpa/package-lint-20181017.623/package-lint.el @@ -5,7 +5,6 @@ ;; Author: Steve Purcell ;; Fanael Linithien ;; URL: https://github.com/purcell/package-lint -;; Package-Version: 20171201.1903 ;; Keywords: lisp ;; Version: 0 ;; Package-Requires: ((cl-lib "0.5") (emacs "24")) @@ -138,6 +137,7 @@ This is bound dynamically while the checks run.") define-alternative define-error display-monitor-attributes-list + eieio-object-class file-acl file-extended-attributes fill-single-char-nobreak-p @@ -147,6 +147,7 @@ This is bound dynamically while the checks run.") group-real-gid hash-table-keys hash-table-values + line-pixel-height macrop remove-function set-file-acl @@ -164,6 +165,7 @@ This is bound dynamically while the checks run.") window-bottom-divider-width window-header-line-height window-mode-line-height + window-pixel-height window-right-divider-width window-scroll-bar-width window-text-pixel-size @@ -232,7 +234,8 @@ This is bound dynamically while the checks run.") "org-babel-execute:" "org-babel-prep-session:" "org-babel-variable-assignments:" - "org-babel-default-header-args:")) + "org-babel-default-header-args:" + "pcomplete/")) "A regexp matching whitelisted non-standard symbol prefixes.") (defun package-lint--check-all () @@ -438,6 +441,20 @@ the form (PACKAGE-NAME PACKAGE-VERSION LINE-NO LINE-BEGINNING-OFFSET)." (format "Expected (package-name \"version-num\"), but found %S." entry))))) valid-deps)) +(defun package-lint--check-package-installable (archive-entry package-version line-no offset) + "Check that ARCHIVE-ENTRY is installable from a configured package archive. + +Check that package described by ARCHIVE-ENTRY can be installed at +required version PACKAGE-VERSION. If not, raise an error for +LINE-NO at OFFSET." + (let* ((package-name (car archive-entry)) + (best-version (package-lint--highest-installable-version-of package-name))) + (when (version-list-< best-version package-version) + (package-lint--error + line-no offset 'warning + (format "Version dependency for %s appears too high: try %s" package-name + (package-version-join best-version)))))) + (defun package-lint--check-packages-installable (valid-deps) "Check that all VALID-DEPS are available for installation." (pcase-dolist (`(,package-name ,package-version ,line-no ,offset) valid-deps) @@ -449,12 +466,7 @@ the form (PACKAGE-NAME PACKAGE-VERSION LINE-NO LINE-BEGINNING-OFFSET)." ;; Not 'emacs (let ((archive-entry (assq package-name package-archive-contents))) (if archive-entry - (let ((best-version (package-lint--lowest-installable-version-of package-name))) - (when (version-list-< best-version package-version) - (package-lint--error - line-no offset 'warning - (format "Version dependency for %s appears too high: try %s" package-name - (package-version-join best-version))))) + (package-lint--check-package-installable archive-entry package-version line-no offset) (package-lint--error line-no offset 'error (format "Package %S is not installable." package-name))))))) @@ -783,12 +795,12 @@ Lines consisting only of whitespace or empty comments are considered empty." (= 0 (forward-line)))) (eobp))))) -(defun package-lint--lowest-installable-version-of (package) - "Return the lowest version of PACKAGE available for installation." +(defun package-lint--highest-installable-version-of (package) + "Return the highest version of PACKAGE available for installation." (let ((descriptors (cdr (assq package package-archive-contents)))) (if (fboundp 'package-desc-version) (car (sort (mapcar 'package-desc-version descriptors) - #'version-list-<)) + (lambda (v1 v2) (not (version-list-< v1 v2))))) (aref descriptors 0)))) (defun package-lint--goto-header (header-name) @@ -879,7 +891,7 @@ Prefix is returned without any `-mode' suffix." (defun package-lint--check-objects-by-regexp (regexp function) "Check all objects with the literal printed form matching REGEXP. -The objects are parsed with `read'. The FUNCTION is passed the +The objects are parsed with `read'. The FUNCTION is passed the read object, with the point at the beginning of the match. S-expressions in comments or comments, partial s-expressions, or @@ -916,18 +928,20 @@ Current buffer is used if none is specified." (interactive) (let ((errs (package-lint-buffer)) (buf "*Package-Lint*")) - (with-current-buffer (get-buffer-create buf) - (let ((buffer-read-only nil)) - (erase-buffer) - (cond - ((null errs) (insert "No issues found.")) - ((null (cdr errs)) (insert "1 issue found:\n\n")) - (t (insert (format "%d issues found:\n\n" (length errs))))) - (pcase-dolist (`(,line ,col ,type ,message) errs) - (insert (format "%d:%d: %s: %s\n" line col type message)))) - (special-mode) - (view-mode 1)) - (display-buffer buf))) + (if (null errs) + (message "No issues found") + (with-current-buffer (get-buffer-create buf) + (let ((buffer-read-only nil)) + (erase-buffer) + (cond + ((null errs) (insert "No issues found.")) + ((null (cdr errs)) (insert "1 issue found:\n\n")) + (t (insert (format "%d issues found:\n\n" (length errs))))) + (pcase-dolist (`(,line ,col ,type ,message) errs) + (insert (format "%d:%d: %s: %s\n" line col type message)))) + (special-mode) + (view-mode 1)) + (display-buffer buf)))) ;;;###autoload (defun package-lint-batch-and-exit () -- 2.47.3