- Agregado el eliminar la barra de desplazamientoç
- Eliminado winsize - Agregado flycheck
This commit is contained in:
		
							
								
								
									
										22
									
								
								elpa/epl-20180205.2049/epl-autoloads.el
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								elpa/epl-20180205.2049/epl-autoloads.el
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					;;; epl-autoloads.el --- automatically extracted autoloads
 | 
				
			||||||
 | 
					;;
 | 
				
			||||||
 | 
					;;; Code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(add-to-list 'load-path (directory-file-name
 | 
				
			||||||
 | 
					                         (or (file-name-directory #$) (car load-path))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;### (autoloads nil "epl" "epl.el" (0 0 0 0))
 | 
				
			||||||
 | 
					;;; Generated autoloads from epl.el
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "epl" '("epl-")))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;***
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Local Variables:
 | 
				
			||||||
 | 
					;; version-control: never
 | 
				
			||||||
 | 
					;; no-byte-compile: t
 | 
				
			||||||
 | 
					;; no-update-autoloads: t
 | 
				
			||||||
 | 
					;; coding: utf-8
 | 
				
			||||||
 | 
					;; End:
 | 
				
			||||||
 | 
					;;; epl-autoloads.el ends here
 | 
				
			||||||
							
								
								
									
										2
									
								
								elpa/epl-20180205.2049/epl-pkg.el
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								elpa/epl-20180205.2049/epl-pkg.el
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					;;; -*- no-byte-compile: t -*-
 | 
				
			||||||
 | 
					(define-package "epl" "20180205.2049" "Emacs Package Library" '((cl-lib "0.3")) :commit "78ab7a85c08222cd15582a298a364774e3282ce6" :keywords '("convenience") :authors '(("Sebastian Wiesner" . "swiesner@lunaryorn.com")) :maintainer '("Johan Andersson" . "johan.rejeep@gmail.com") :url "http://github.com/cask/epl")
 | 
				
			||||||
							
								
								
									
										712
									
								
								elpa/epl-20180205.2049/epl.el
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										712
									
								
								elpa/epl-20180205.2049/epl.el
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,712 @@
 | 
				
			|||||||
 | 
					;;; epl.el --- Emacs Package Library -*- lexical-binding: t; -*-
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Copyright (C) 2013-2015 Sebastian Wiesner
 | 
				
			||||||
 | 
					;; Copyright (C) 1985-1986, 1992, 1994-1995, 1999-2015 Free Software
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Author: Sebastian Wiesner <swiesner@lunaryorn.com>
 | 
				
			||||||
 | 
					;; Maintainer: Johan Andersson <johan.rejeep@gmail.com>
 | 
				
			||||||
 | 
					;;     Sebastian Wiesner <swiesner@lunaryorn.com>
 | 
				
			||||||
 | 
					;; Version: 0.10-cvs
 | 
				
			||||||
 | 
					;; Package-Version: 20180205.2049
 | 
				
			||||||
 | 
					;; Package-Commit: 78ab7a85c08222cd15582a298a364774e3282ce6
 | 
				
			||||||
 | 
					;; Package-Requires: ((cl-lib "0.3"))
 | 
				
			||||||
 | 
					;; Keywords: convenience
 | 
				
			||||||
 | 
					;; URL: http://github.com/cask/epl
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; This file is NOT part of GNU Emacs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; This program 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 of the License, or
 | 
				
			||||||
 | 
					;; (at your option) any later version.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Commentary:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; A package management library for Emacs, based on package.el.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; The purpose of this library is to wrap all the quirks and hassle of
 | 
				
			||||||
 | 
					;; package.el into a sane API.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; The following functions comprise the public interface of this library:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Package directory selection
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-package-dir' gets the directory of packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-default-package-dir' gets the default package directory.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-change-package-dir' changes the directory of packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Package system management
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-initialize' initializes the package system and activates all
 | 
				
			||||||
 | 
					;; packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-reset' resets the package system.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-refresh' refreshes all package archives.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-add-archive' adds a new package archive.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Package objects
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Struct `epl-requirement' describes a requirement of a package with `name' and
 | 
				
			||||||
 | 
					;; `version' slots.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-requirement-version-string' gets a requirement version as string.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Struct `epl-package' describes an installed or installable package with a
 | 
				
			||||||
 | 
					;; `name' and some internal `description'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-package-version' gets the version of a package.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-package-version-string' gets the version of a package as string.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-package-summary' gets the summary of a package.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-package-requirements' gets the requirements of a package.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-package-directory' gets the installation directory of a package.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-package-from-buffer' creates a package object for the package contained
 | 
				
			||||||
 | 
					;; in the current buffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-package-from-file' creates a package object for a package file, either
 | 
				
			||||||
 | 
					;; plain lisp or tarball.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-package-from-descriptor-file' creates a package object for a package
 | 
				
			||||||
 | 
					;; description (i.e. *-pkg.el) file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Package database access
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-package-installed-p' determines whether a package is installed, either
 | 
				
			||||||
 | 
					;; built-in or explicitly installed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-package-outdated-p' determines whether a package is outdated, that is,
 | 
				
			||||||
 | 
					;; whether a package with a higher version number is available.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-built-in-packages', `epl-installed-packages', `epl-outdated-packages'
 | 
				
			||||||
 | 
					;; and `epl-available-packages' get all packages built-in, installed, outdated,
 | 
				
			||||||
 | 
					;; or available for installation respectively.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-find-built-in-package', `epl-find-installed-packages' and
 | 
				
			||||||
 | 
					;; `epl-find-available-packages' find built-in, installed and available packages
 | 
				
			||||||
 | 
					;; by name.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-find-upgrades' finds all upgradable packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-built-in-p' return true if package is built-in to Emacs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Package operations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-install-file' installs a package file.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-package-install' installs a package.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-package-delete' deletes a package.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `epl-upgrade' upgrades packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(require 'cl-lib)
 | 
				
			||||||
 | 
					(require 'package)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(unless (fboundp #'define-error)
 | 
				
			||||||
 | 
					  ;; `define-error' for 24.3 and earlier, copied from subr.el
 | 
				
			||||||
 | 
					  (defun define-error (name message &optional parent)
 | 
				
			||||||
 | 
					    "Define NAME as a new error signal.
 | 
				
			||||||
 | 
					MESSAGE is a string that will be output to the echo area if such an error
 | 
				
			||||||
 | 
					is signaled without being caught by a `condition-case'.
 | 
				
			||||||
 | 
					PARENT is either a signal or a list of signals from which it inherits.
 | 
				
			||||||
 | 
					Defaults to `error'."
 | 
				
			||||||
 | 
					    (unless parent (setq parent 'error))
 | 
				
			||||||
 | 
					    (let ((conditions
 | 
				
			||||||
 | 
					           (if (consp parent)
 | 
				
			||||||
 | 
					               (apply #'append
 | 
				
			||||||
 | 
					                      (mapcar (lambda (parent)
 | 
				
			||||||
 | 
					                                (cons parent
 | 
				
			||||||
 | 
					                                      (or (get parent 'error-conditions)
 | 
				
			||||||
 | 
					                                          (error "Unknown signal `%s'" parent))))
 | 
				
			||||||
 | 
					                              parent))
 | 
				
			||||||
 | 
					             (cons parent (get parent 'error-conditions)))))
 | 
				
			||||||
 | 
					      (put name 'error-conditions
 | 
				
			||||||
 | 
					           (delete-dups (copy-sequence (cons name conditions))))
 | 
				
			||||||
 | 
					      (when message (put name 'error-message message)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defsubst epl--package-desc-p (package)
 | 
				
			||||||
 | 
					  "Whether PACKAGE is a `package-desc' object.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Like `package-desc-p', but return nil, if `package-desc-p' is not
 | 
				
			||||||
 | 
					defined as function."
 | 
				
			||||||
 | 
					  (and (fboundp 'package-desc-p) (package-desc-p package)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; EPL errors
 | 
				
			||||||
 | 
					(define-error 'epl-error "EPL error")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(define-error 'epl-invalid-package "Invalid EPL package" 'epl-error)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(define-error 'epl-invalid-package-file "Invalid EPL package file"
 | 
				
			||||||
 | 
					  'epl-invalid-package)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Package directory
 | 
				
			||||||
 | 
					(defun epl-package-dir ()
 | 
				
			||||||
 | 
					  "Get the directory of packages."
 | 
				
			||||||
 | 
					  package-user-dir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-default-package-dir ()
 | 
				
			||||||
 | 
					  "Get the default directory of packages."
 | 
				
			||||||
 | 
					  (eval (car (get 'package-user-dir 'standard-value))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-change-package-dir (directory)
 | 
				
			||||||
 | 
					  "Change the directory of packages to DIRECTORY."
 | 
				
			||||||
 | 
					  (setq package-user-dir directory)
 | 
				
			||||||
 | 
					  (epl-initialize))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Package system management
 | 
				
			||||||
 | 
					(defvar epl--load-path-before-initialize nil
 | 
				
			||||||
 | 
					  "Remember the load path for `epl-reset'.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-initialize (&optional no-activate)
 | 
				
			||||||
 | 
					  "Load Emacs Lisp packages and activate them.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					With NO-ACTIVATE non-nil, do not activate packages."
 | 
				
			||||||
 | 
					  (setq epl--load-path-before-initialize load-path)
 | 
				
			||||||
 | 
					  (package-initialize no-activate))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defalias 'epl-refresh 'package-refresh-contents)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-add-archive (name url)
 | 
				
			||||||
 | 
					  "Add a package archive with NAME and URL."
 | 
				
			||||||
 | 
					  (add-to-list 'package-archives (cons name url)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-reset ()
 | 
				
			||||||
 | 
					  "Reset the package system.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Clear the list of installed and available packages, the list of
 | 
				
			||||||
 | 
					package archives and reset the package directory."
 | 
				
			||||||
 | 
					  (setq package-alist nil
 | 
				
			||||||
 | 
					        package-archives nil
 | 
				
			||||||
 | 
					        package-archive-contents nil
 | 
				
			||||||
 | 
					        load-path epl--load-path-before-initialize)
 | 
				
			||||||
 | 
					  (when (boundp 'package-obsolete-alist) ; Legacy package.el
 | 
				
			||||||
 | 
					    (setq package-obsolete-alist nil))
 | 
				
			||||||
 | 
					  (epl-change-package-dir (epl-default-package-dir)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Package structures
 | 
				
			||||||
 | 
					(cl-defstruct (epl-requirement
 | 
				
			||||||
 | 
					               (:constructor epl-requirement-create))
 | 
				
			||||||
 | 
					  "Structure describing a requirement.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Slots:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`name' The name of the required package, as symbol.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`version' The version of the required package, as version list."
 | 
				
			||||||
 | 
					  name
 | 
				
			||||||
 | 
					  version)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-requirement-version-string (requirement)
 | 
				
			||||||
 | 
					  "The version of a REQUIREMENT, as string."
 | 
				
			||||||
 | 
					  (package-version-join (epl-requirement-version requirement)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(cl-defstruct (epl-package (:constructor epl-package-create))
 | 
				
			||||||
 | 
					  "Structure representing a package.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Slots:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`name' The package name, as symbol.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`description' The package description.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The format package description varies between package.el
 | 
				
			||||||
 | 
					variants.  For `package-desc' variants, it is simply the
 | 
				
			||||||
 | 
					corresponding `package-desc' object.  For legacy variants, it is
 | 
				
			||||||
 | 
					a vector `[VERSION REQS DOCSTRING]'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Do not access `description' directly, but instead use the
 | 
				
			||||||
 | 
					`epl-package' accessors."
 | 
				
			||||||
 | 
					  name
 | 
				
			||||||
 | 
					  description)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defmacro epl-package-as-description (var &rest body)
 | 
				
			||||||
 | 
					  "Cast VAR to a package description in BODY.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					VAR is a symbol, bound to an `epl-package' object.  This macro
 | 
				
			||||||
 | 
					casts this object to the `description' object, and binds the
 | 
				
			||||||
 | 
					description to VAR in BODY."
 | 
				
			||||||
 | 
					  (declare (indent 1))
 | 
				
			||||||
 | 
					  (unless (symbolp var)
 | 
				
			||||||
 | 
					    (signal 'wrong-type-argument (list #'symbolp var)))
 | 
				
			||||||
 | 
					  `(if (epl-package-p ,var)
 | 
				
			||||||
 | 
					       (let ((,var (epl-package-description ,var)))
 | 
				
			||||||
 | 
					         ,@body)
 | 
				
			||||||
 | 
					     (signal 'wrong-type-argument (list #'epl-package-p ,var))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defsubst epl-package--package-desc-p (package)
 | 
				
			||||||
 | 
					  "Whether the description of PACKAGE is a `package-desc'."
 | 
				
			||||||
 | 
					  (epl--package-desc-p (epl-package-description package)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package-version (package)
 | 
				
			||||||
 | 
					  "Get the version of PACKAGE, as version list."
 | 
				
			||||||
 | 
					  (epl-package-as-description package
 | 
				
			||||||
 | 
					    (cond
 | 
				
			||||||
 | 
					     ((fboundp 'package-desc-version) (package-desc-version package))
 | 
				
			||||||
 | 
					     ;; Legacy
 | 
				
			||||||
 | 
					     ((fboundp 'package-desc-vers)
 | 
				
			||||||
 | 
					      (let ((version (package-desc-vers package)))
 | 
				
			||||||
 | 
					        (if (listp version) version (version-to-list version))))
 | 
				
			||||||
 | 
					     (:else (error "Cannot get version from %S" package)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package-version-string (package)
 | 
				
			||||||
 | 
					  "Get the version from a PACKAGE, as string."
 | 
				
			||||||
 | 
					  (package-version-join (epl-package-version package)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package-summary (package)
 | 
				
			||||||
 | 
					  "Get the summary of PACKAGE, as string."
 | 
				
			||||||
 | 
					  (epl-package-as-description package
 | 
				
			||||||
 | 
					    (cond
 | 
				
			||||||
 | 
					     ((fboundp 'package-desc-summary) (package-desc-summary package))
 | 
				
			||||||
 | 
					     ((fboundp 'package-desc-doc) (package-desc-doc package)) ; Legacy
 | 
				
			||||||
 | 
					     (:else (error "Cannot get summary from %S" package)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defsubst epl-requirement--from-req (req)
 | 
				
			||||||
 | 
					  "Create a `epl-requirement' from a `package-desc' REQ."
 | 
				
			||||||
 | 
					  (let  ((version (cadr req)))
 | 
				
			||||||
 | 
					    (epl-requirement-create :name (car req)
 | 
				
			||||||
 | 
					                            :version (if (listp version) version
 | 
				
			||||||
 | 
					                                       (version-to-list version)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package-requirements (package)
 | 
				
			||||||
 | 
					  "Get the requirements of PACKAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The requirements are a list of `epl-requirement' objects."
 | 
				
			||||||
 | 
					  (epl-package-as-description package
 | 
				
			||||||
 | 
					    (mapcar #'epl-requirement--from-req (package-desc-reqs package))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package-directory (package)
 | 
				
			||||||
 | 
					  "Get the directory PACKAGE is installed to.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the absolute path of the installation directory of
 | 
				
			||||||
 | 
					PACKAGE, or nil, if PACKAGE is not installed."
 | 
				
			||||||
 | 
					  (cond
 | 
				
			||||||
 | 
					   ((fboundp 'package-desc-dir)
 | 
				
			||||||
 | 
					    (package-desc-dir (epl-package-description package)))
 | 
				
			||||||
 | 
					   ((fboundp 'package--dir)
 | 
				
			||||||
 | 
					    (package--dir (symbol-name (epl-package-name package))
 | 
				
			||||||
 | 
					                  (epl-package-version-string package)))
 | 
				
			||||||
 | 
					   (:else (error "Cannot get package directory from %S" package))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package-->= (pkg1 pkg2)
 | 
				
			||||||
 | 
					  "Determine whether PKG1 is before PKG2 by version."
 | 
				
			||||||
 | 
					  (not (version-list-< (epl-package-version pkg1)
 | 
				
			||||||
 | 
					                       (epl-package-version pkg2))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package--from-package-desc (package-desc)
 | 
				
			||||||
 | 
					  "Create an `epl-package' from a PACKAGE-DESC.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PACKAGE-DESC is a `package-desc' object, from recent package.el
 | 
				
			||||||
 | 
					variants."
 | 
				
			||||||
 | 
					  (if (and (fboundp 'package-desc-name)
 | 
				
			||||||
 | 
					           (epl--package-desc-p package-desc))
 | 
				
			||||||
 | 
					      (epl-package-create :name (package-desc-name package-desc)
 | 
				
			||||||
 | 
					                          :description package-desc)
 | 
				
			||||||
 | 
					    (signal 'wrong-type-argument (list 'epl--package-desc-p package-desc))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package--parse-info (info)
 | 
				
			||||||
 | 
					  "Parse a package.el INFO."
 | 
				
			||||||
 | 
					  (if (epl--package-desc-p info)
 | 
				
			||||||
 | 
					      (epl-package--from-package-desc info)
 | 
				
			||||||
 | 
					    ;; For legacy package.el, info is a vector [NAME REQUIRES DESCRIPTION
 | 
				
			||||||
 | 
					    ;; VERSION COMMENTARY].  We need to re-shape this vector into the
 | 
				
			||||||
 | 
					    ;; `package-alist' format [VERSION REQUIRES DESCRIPTION] to attach it to the
 | 
				
			||||||
 | 
					    ;; new `epl-package'.
 | 
				
			||||||
 | 
					    (let ((name (intern (aref info 0)))
 | 
				
			||||||
 | 
					          (info (vector (aref info 3) (aref info 1) (aref info 2))))
 | 
				
			||||||
 | 
					      (epl-package-create :name name :description info))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package-from-buffer (&optional buffer)
 | 
				
			||||||
 | 
					  "Create an `epl-package' object from BUFFER.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BUFFER defaults to the current buffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Signal `epl-invalid-package' if the buffer does not contain a
 | 
				
			||||||
 | 
					valid package file."
 | 
				
			||||||
 | 
					  (let ((info (with-current-buffer (or buffer (current-buffer))
 | 
				
			||||||
 | 
					                (condition-case err
 | 
				
			||||||
 | 
					                    (package-buffer-info)
 | 
				
			||||||
 | 
					                  (error (signal 'epl-invalid-package (cdr err)))))))
 | 
				
			||||||
 | 
					    (epl-package--parse-info info)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package-from-lisp-file (file-name)
 | 
				
			||||||
 | 
					  "Parse the package headers the file at FILE-NAME.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return an `epl-package' object with the header metadata."
 | 
				
			||||||
 | 
					  (with-temp-buffer
 | 
				
			||||||
 | 
					    (insert-file-contents file-name)
 | 
				
			||||||
 | 
					    (condition-case err
 | 
				
			||||||
 | 
					        (epl-package-from-buffer (current-buffer))
 | 
				
			||||||
 | 
					      ;; Attach file names to invalid package errors
 | 
				
			||||||
 | 
					      (epl-invalid-package
 | 
				
			||||||
 | 
					       (signal 'epl-invalid-package-file (cons file-name (cdr err))))
 | 
				
			||||||
 | 
					      ;; Forward other errors
 | 
				
			||||||
 | 
					      (error (signal (car err) (cdr err))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package-from-tar-file (file-name)
 | 
				
			||||||
 | 
					  "Parse the package tarball at FILE-NAME.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return a `epl-package' object with the meta data of the tarball
 | 
				
			||||||
 | 
					package in FILE-NAME."
 | 
				
			||||||
 | 
					  (condition-case nil
 | 
				
			||||||
 | 
					      ;; In legacy package.el, `package-tar-file-info' takes the name of the tar
 | 
				
			||||||
 | 
					      ;; file to parse as argument.  In modern package.el, it has no arguments
 | 
				
			||||||
 | 
					      ;; and works on the current buffer.  Hence, we just try to call the legacy
 | 
				
			||||||
 | 
					      ;; version, and if that fails because of a mismatch between formal and
 | 
				
			||||||
 | 
					      ;; actual arguments, we use the modern approach.  To avoid spurious
 | 
				
			||||||
 | 
					      ;; signature warnings by the byte compiler, we suppress warnings when
 | 
				
			||||||
 | 
					      ;; calling the function.
 | 
				
			||||||
 | 
					      (epl-package--parse-info (with-no-warnings
 | 
				
			||||||
 | 
					                                 (package-tar-file-info file-name)))
 | 
				
			||||||
 | 
					    (wrong-number-of-arguments
 | 
				
			||||||
 | 
					     (with-temp-buffer
 | 
				
			||||||
 | 
					       (insert-file-contents-literally file-name)
 | 
				
			||||||
 | 
					       ;; Switch to `tar-mode' to enable extraction of the file.  Modern
 | 
				
			||||||
 | 
					       ;; `package-tar-file-info' relies on `tar-mode', and signals an error if
 | 
				
			||||||
 | 
					       ;; called in a buffer with a different mode.
 | 
				
			||||||
 | 
					       (tar-mode)
 | 
				
			||||||
 | 
					       (epl-package--parse-info (with-no-warnings
 | 
				
			||||||
 | 
					                                  (package-tar-file-info)))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package-from-file (file-name)
 | 
				
			||||||
 | 
					  "Parse the package at FILE-NAME.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return an `epl-package' object with the meta data of the package
 | 
				
			||||||
 | 
					at FILE-NAME."
 | 
				
			||||||
 | 
					  (if (string-match-p (rx ".tar" string-end) file-name)
 | 
				
			||||||
 | 
					      (epl-package-from-tar-file file-name)
 | 
				
			||||||
 | 
					    (epl-package-from-lisp-file file-name)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package--parse-descriptor-requirement (requirement)
 | 
				
			||||||
 | 
					  "Parse a REQUIREMENT in a package descriptor."
 | 
				
			||||||
 | 
					  ;; This function is only called on legacy package.el.  On package-desc
 | 
				
			||||||
 | 
					  ;; package.el, we just let package.el do the work.
 | 
				
			||||||
 | 
					  (cl-destructuring-bind (name version-string) requirement
 | 
				
			||||||
 | 
					    (list name (version-to-list version-string))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package-from-descriptor-file (descriptor-file)
 | 
				
			||||||
 | 
					  "Load a `epl-package' from a package DESCRIPTOR-FILE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					A package descriptor is a file defining a new package.  Its name
 | 
				
			||||||
 | 
					typically ends with -pkg.el."
 | 
				
			||||||
 | 
					  (with-temp-buffer
 | 
				
			||||||
 | 
					    (insert-file-contents descriptor-file)
 | 
				
			||||||
 | 
					    (goto-char (point-min))
 | 
				
			||||||
 | 
					    (let ((sexp (read (current-buffer))))
 | 
				
			||||||
 | 
					      (unless (eq (car sexp) 'define-package)
 | 
				
			||||||
 | 
					        (error "%S is no valid package descriptor" descriptor-file))
 | 
				
			||||||
 | 
					      (if (and (fboundp 'package-desc-from-define)
 | 
				
			||||||
 | 
					               (fboundp 'package-desc-name))
 | 
				
			||||||
 | 
					          ;; In Emacs snapshot, we can conveniently call a function to parse the
 | 
				
			||||||
 | 
					          ;; descriptor
 | 
				
			||||||
 | 
					          (let ((desc (apply #'package-desc-from-define (cdr sexp))))
 | 
				
			||||||
 | 
					            (epl-package-create :name (package-desc-name desc)
 | 
				
			||||||
 | 
					                                :description desc))
 | 
				
			||||||
 | 
					        ;; In legacy package.el, we must manually deconstruct the descriptor,
 | 
				
			||||||
 | 
					        ;; because the load function has eval's the descriptor and has a lot of
 | 
				
			||||||
 | 
					        ;; global side-effects.
 | 
				
			||||||
 | 
					        (cl-destructuring-bind
 | 
				
			||||||
 | 
					            (name version-string summary requirements) (cdr sexp)
 | 
				
			||||||
 | 
					          (epl-package-create
 | 
				
			||||||
 | 
					           :name (intern name)
 | 
				
			||||||
 | 
					           :description
 | 
				
			||||||
 | 
					           (vector (version-to-list version-string)
 | 
				
			||||||
 | 
					                   (mapcar #'epl-package--parse-descriptor-requirement
 | 
				
			||||||
 | 
					                           ;; Strip the leading `quote' from the package list
 | 
				
			||||||
 | 
					                           (cadr requirements))
 | 
				
			||||||
 | 
					                   summary)))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Package database access
 | 
				
			||||||
 | 
					(defun epl-package-installed-p (package &optional min-version)
 | 
				
			||||||
 | 
					  "Determine whether a PACKAGE, of MIN-VERSION or newer, is installed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PACKAGE is either a package name as symbol, or a package object.
 | 
				
			||||||
 | 
					When a explicit MIN-VERSION is provided it overwrites the version of the PACKAGE object."
 | 
				
			||||||
 | 
					  (let ((name (if (epl-package-p package)
 | 
				
			||||||
 | 
					                  (epl-package-name package)
 | 
				
			||||||
 | 
					                package))
 | 
				
			||||||
 | 
					        (min-version (or min-version (and (epl-package-p package)
 | 
				
			||||||
 | 
					                                          (epl-package-version package)))))
 | 
				
			||||||
 | 
					    (package-installed-p name min-version)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl--parse-built-in-entry (entry)
 | 
				
			||||||
 | 
					  "Parse an ENTRY from the list of built-in packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the corresponding `epl-package' object."
 | 
				
			||||||
 | 
					  (if (fboundp 'package--from-builtin)
 | 
				
			||||||
 | 
					      ;; In package-desc package.el, convert the built-in package to a
 | 
				
			||||||
 | 
					      ;; `package-desc' and convert that to an `epl-package'
 | 
				
			||||||
 | 
					      (epl-package--from-package-desc (package--from-builtin entry))
 | 
				
			||||||
 | 
					    (epl-package-create :name (car entry) :description (cdr entry))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-built-in-packages ()
 | 
				
			||||||
 | 
					  "Get all built-in packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return a list of `epl-package' objects."
 | 
				
			||||||
 | 
					  ;; This looks mighty strange, but it's the only way to force package.el to
 | 
				
			||||||
 | 
					  ;; build the list of built-in packages.  Without this, `package--builtins'
 | 
				
			||||||
 | 
					  ;; might be empty.
 | 
				
			||||||
 | 
					  (package-built-in-p 'foo)
 | 
				
			||||||
 | 
					  (mapcar #'epl--parse-built-in-entry package--builtins))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-find-built-in-package (name)
 | 
				
			||||||
 | 
					  "Find a built-in package with NAME.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME is a package name, as symbol.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the built-in package as `epl-package' object, or nil if
 | 
				
			||||||
 | 
					there is no built-in package with NAME."
 | 
				
			||||||
 | 
					  (when (package-built-in-p name)
 | 
				
			||||||
 | 
					    ;; We must call `package-built-in-p' *before* inspecting
 | 
				
			||||||
 | 
					    ;; `package--builtins', because otherwise `package--builtins' might be
 | 
				
			||||||
 | 
					    ;; empty.
 | 
				
			||||||
 | 
					    (epl--parse-built-in-entry (assq name package--builtins))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package-outdated-p (package)
 | 
				
			||||||
 | 
					  "Determine whether a PACKAGE is outdated.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					A package is outdated, if there is an available package with a
 | 
				
			||||||
 | 
					higher version.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PACKAGE is either a package name as symbol, or a package object.
 | 
				
			||||||
 | 
					In the former case, test the installed or built-in package with
 | 
				
			||||||
 | 
					the highest version number, in the later case, test the package
 | 
				
			||||||
 | 
					object itself.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return t, if the package is outdated, or nil otherwise."
 | 
				
			||||||
 | 
					  (let* ((package (if (epl-package-p package)
 | 
				
			||||||
 | 
					                      package
 | 
				
			||||||
 | 
					                    (or (car (epl-find-installed-packages package))
 | 
				
			||||||
 | 
					                        (epl-find-built-in-package package))))
 | 
				
			||||||
 | 
					         (available (car (epl-find-available-packages
 | 
				
			||||||
 | 
					                          (epl-package-name package)))))
 | 
				
			||||||
 | 
					    (and package available (version-list-< (epl-package-version package)
 | 
				
			||||||
 | 
					                                           (epl-package-version available)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl--parse-package-list-entry (entry)
 | 
				
			||||||
 | 
					  "Parse a list of packages from ENTRY.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ENTRY is a single entry in a package list, e.g. `package-alist',
 | 
				
			||||||
 | 
					`package-archive-contents', etc.  Typically it is a cons cell,
 | 
				
			||||||
 | 
					but the exact format varies between package.el versions.  This
 | 
				
			||||||
 | 
					function tries to parse all known variants.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return a list of `epl-package' objects parsed from ENTRY."
 | 
				
			||||||
 | 
					  (let ((descriptions (cdr entry)))
 | 
				
			||||||
 | 
					    (cond
 | 
				
			||||||
 | 
					     ((listp descriptions)
 | 
				
			||||||
 | 
					      (sort (mapcar #'epl-package--from-package-desc descriptions)
 | 
				
			||||||
 | 
					            #'epl-package-->=))
 | 
				
			||||||
 | 
					     ;; Legacy package.el has just a single package in an entry, which is a
 | 
				
			||||||
 | 
					     ;; standard description vector
 | 
				
			||||||
 | 
					     ((vectorp descriptions)
 | 
				
			||||||
 | 
					      (list (epl-package-create :name (car entry)
 | 
				
			||||||
 | 
					                                :description descriptions)))
 | 
				
			||||||
 | 
					     (:else (error "Cannot parse entry %S" entry)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-installed-packages ()
 | 
				
			||||||
 | 
					  "Get all installed packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return a list of package objects."
 | 
				
			||||||
 | 
					  (apply #'append (mapcar #'epl--parse-package-list-entry package-alist)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defsubst epl--filter-outdated-packages (packages)
 | 
				
			||||||
 | 
					  "Filter outdated packages from PACKAGES."
 | 
				
			||||||
 | 
					  (let (res)
 | 
				
			||||||
 | 
					    (dolist (package packages)
 | 
				
			||||||
 | 
					      (when (epl-package-outdated-p package)
 | 
				
			||||||
 | 
					        (push package res)))
 | 
				
			||||||
 | 
					    (nreverse res)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-outdated-packages ()
 | 
				
			||||||
 | 
					  "Get all outdated packages, as in `epl-package-outdated-p'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return a list of package objects."
 | 
				
			||||||
 | 
					  (epl--filter-outdated-packages (epl-installed-packages)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defsubst epl--find-package-in-list (name list)
 | 
				
			||||||
 | 
					  "Find a package by NAME in a package LIST.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return a list of corresponding `epl-package' objects."
 | 
				
			||||||
 | 
					  (let ((entry (assq name list)))
 | 
				
			||||||
 | 
					    (when entry
 | 
				
			||||||
 | 
					      (epl--parse-package-list-entry entry))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-find-installed-package (name)
 | 
				
			||||||
 | 
					  "Find the latest installed package by NAME.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME is a package name, as symbol.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the installed package with the highest version number as
 | 
				
			||||||
 | 
					`epl-package' object, or nil, if no package with NAME is
 | 
				
			||||||
 | 
					installed."
 | 
				
			||||||
 | 
					  (car (epl-find-installed-packages name)))
 | 
				
			||||||
 | 
					(make-obsolete 'epl-find-installed-package 'epl-find-installed-packages "0.7")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-find-installed-packages (name)
 | 
				
			||||||
 | 
					  "Find all installed packages by NAME.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME is a package name, as symbol.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return a list of all installed packages with NAME, sorted by
 | 
				
			||||||
 | 
					version number in descending order.  Return nil, if there are no
 | 
				
			||||||
 | 
					packages with NAME."
 | 
				
			||||||
 | 
					  (epl--find-package-in-list name package-alist))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-available-packages ()
 | 
				
			||||||
 | 
					  "Get all packages available for installation.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return a list of package objects."
 | 
				
			||||||
 | 
					  (apply #'append (mapcar #'epl--parse-package-list-entry
 | 
				
			||||||
 | 
					                          package-archive-contents)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-find-available-packages (name)
 | 
				
			||||||
 | 
					  "Find available packages for NAME.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME is a package name, as symbol.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return a list of available packages for NAME, sorted by version
 | 
				
			||||||
 | 
					number in descending order.  Return nil, if there are no packages
 | 
				
			||||||
 | 
					for NAME."
 | 
				
			||||||
 | 
					  (epl--find-package-in-list name package-archive-contents))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(cl-defstruct (epl-upgrade
 | 
				
			||||||
 | 
					               (:constructor epl-upgrade-create))
 | 
				
			||||||
 | 
					  "Structure describing an upgradable package.
 | 
				
			||||||
 | 
					Slots:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`installed' The installed package
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`available' The package available for installation."
 | 
				
			||||||
 | 
					  installed
 | 
				
			||||||
 | 
					  available)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-find-upgrades (&optional packages)
 | 
				
			||||||
 | 
					  "Find all upgradable PACKAGES.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PACKAGES is a list of package objects to upgrade, defaulting to
 | 
				
			||||||
 | 
					all installed packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return a list of `epl-upgrade' objects describing all upgradable
 | 
				
			||||||
 | 
					packages."
 | 
				
			||||||
 | 
					  (let ((packages (or packages (epl-installed-packages)))
 | 
				
			||||||
 | 
					        upgrades)
 | 
				
			||||||
 | 
					    (dolist (pkg packages)
 | 
				
			||||||
 | 
					      (let* ((version (epl-package-version pkg))
 | 
				
			||||||
 | 
					             (name (epl-package-name pkg))
 | 
				
			||||||
 | 
					             ;; Find the latest available package for NAME
 | 
				
			||||||
 | 
					             (available-pkg (car (epl-find-available-packages name)))
 | 
				
			||||||
 | 
					             (available-version (when available-pkg
 | 
				
			||||||
 | 
					                                  (epl-package-version available-pkg))))
 | 
				
			||||||
 | 
					        (when (and available-version (version-list-< version available-version))
 | 
				
			||||||
 | 
					          (push (epl-upgrade-create :installed pkg
 | 
				
			||||||
 | 
					                                    :available available-pkg)
 | 
				
			||||||
 | 
					                upgrades))))
 | 
				
			||||||
 | 
					    (nreverse upgrades)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defalias 'epl-built-in-p 'package-built-in-p)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Package operations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-install-file (file)
 | 
				
			||||||
 | 
					    "Install a package from FILE, like `package-install-file'."
 | 
				
			||||||
 | 
					    (interactive (advice-eval-interactive-spec
 | 
				
			||||||
 | 
					                  (cadr (interactive-form #'package-install-file))))
 | 
				
			||||||
 | 
					    (apply #'package-install-file (list file))
 | 
				
			||||||
 | 
					    (let ((package (epl-package-from-file file)))
 | 
				
			||||||
 | 
					      (unless (epl-package--package-desc-p package)
 | 
				
			||||||
 | 
					        (epl--kill-autoload-buffer package))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl--kill-autoload-buffer (package)
 | 
				
			||||||
 | 
					  "Kill the buffer associated with autoloads for PACKAGE."
 | 
				
			||||||
 | 
					  (let* ((auto-name (format "%s-autoloads.el" (epl-package-name package)))
 | 
				
			||||||
 | 
					         (generated-autoload-file (expand-file-name auto-name (epl-package-directory package)))
 | 
				
			||||||
 | 
					         (buf (find-buffer-visiting generated-autoload-file)))
 | 
				
			||||||
 | 
					    (when buf (kill-buffer buf))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package-install (package &optional force)
 | 
				
			||||||
 | 
					  "Install a PACKAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PACKAGE is a `epl-package' object.  If FORCE is given and
 | 
				
			||||||
 | 
					non-nil, install PACKAGE, even if it is already installed."
 | 
				
			||||||
 | 
					  (when (or force (not (epl-package-installed-p package)))
 | 
				
			||||||
 | 
					    (if (epl-package--package-desc-p package)
 | 
				
			||||||
 | 
					        (package-install (epl-package-description package))
 | 
				
			||||||
 | 
					      ;; The legacy API installs by name.  We have no control over versioning,
 | 
				
			||||||
 | 
					      ;; etc.
 | 
				
			||||||
 | 
					      (package-install (epl-package-name package))
 | 
				
			||||||
 | 
					      (epl--kill-autoload-buffer package))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-package-delete (package)
 | 
				
			||||||
 | 
					  "Delete a PACKAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PACKAGE is a `epl-package' object to delete."
 | 
				
			||||||
 | 
					  ;; package-delete allows for packages being trashed instead of fully deleted.
 | 
				
			||||||
 | 
					  ;; Let's prevent his silly behavior
 | 
				
			||||||
 | 
					  (let ((delete-by-moving-to-trash nil))
 | 
				
			||||||
 | 
					    ;; The byte compiler will warn us that we are calling `package-delete' with
 | 
				
			||||||
 | 
					    ;; the wrong number of arguments, since it can't infer that we guarantee to
 | 
				
			||||||
 | 
					    ;; always call the correct version.  Thus we suppress all warnings when
 | 
				
			||||||
 | 
					    ;; calling `package-delete'.  I wish there was a more granular way to
 | 
				
			||||||
 | 
					    ;; disable just that specific warning, but it is what it is.
 | 
				
			||||||
 | 
					    (if (epl-package--package-desc-p package)
 | 
				
			||||||
 | 
					        (with-no-warnings
 | 
				
			||||||
 | 
					          (package-delete (epl-package-description package)))
 | 
				
			||||||
 | 
					      ;; The legacy API deletes by name (as string!) and version instead by
 | 
				
			||||||
 | 
					      ;; descriptor.  Hence `package-delete' takes two arguments.  For some
 | 
				
			||||||
 | 
					      ;; insane reason, the arguments are strings here!
 | 
				
			||||||
 | 
					      (let ((name (symbol-name (epl-package-name package)))
 | 
				
			||||||
 | 
					            (version (epl-package-version-string package)))
 | 
				
			||||||
 | 
					        (with-no-warnings
 | 
				
			||||||
 | 
					          (package-delete name version))
 | 
				
			||||||
 | 
					        ;; Legacy package.el does not remove the deleted package
 | 
				
			||||||
 | 
					        ;; from the `package-alist', so we do it manually here.
 | 
				
			||||||
 | 
					        (let ((pkg (assq (epl-package-name package) package-alist)))
 | 
				
			||||||
 | 
					          (when pkg
 | 
				
			||||||
 | 
					            (setq package-alist (delq pkg package-alist))))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun epl-upgrade (&optional packages preserve-obsolete)
 | 
				
			||||||
 | 
					  "Upgrade PACKAGES.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					PACKAGES is a list of package objects to upgrade, defaulting to
 | 
				
			||||||
 | 
					all installed packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The old versions of the updated packages are deleted, unless
 | 
				
			||||||
 | 
					PRESERVE-OBSOLETE is non-nil.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return a list of all performed upgrades, as a list of
 | 
				
			||||||
 | 
					`epl-upgrade' objects."
 | 
				
			||||||
 | 
					  (let ((upgrades (epl-find-upgrades packages)))
 | 
				
			||||||
 | 
					    (dolist (upgrade upgrades)
 | 
				
			||||||
 | 
					      (epl-package-install (epl-upgrade-available upgrade) 'force)
 | 
				
			||||||
 | 
					      (unless preserve-obsolete
 | 
				
			||||||
 | 
					        (epl-package-delete (epl-upgrade-installed upgrade))))
 | 
				
			||||||
 | 
					    upgrades))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(provide 'epl)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; epl.el ends here
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								elpa/epl-20180205.2049/epl.elc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								elpa/epl-20180205.2049/epl.elc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										306
									
								
								elpa/flycheck-20200610.1809/flycheck-autoloads.el
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										306
									
								
								elpa/flycheck-20200610.1809/flycheck-autoloads.el
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,306 @@
 | 
				
			|||||||
 | 
					;;; flycheck-autoloads.el --- automatically extracted autoloads
 | 
				
			||||||
 | 
					;;
 | 
				
			||||||
 | 
					;;; Code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(add-to-list 'load-path (directory-file-name
 | 
				
			||||||
 | 
					                         (or (file-name-directory #$) (car load-path))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;### (autoloads nil "flycheck" "flycheck.el" (0 0 0 0))
 | 
				
			||||||
 | 
					;;; Generated autoloads from flycheck.el
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(autoload 'flycheck-manual "flycheck" "\
 | 
				
			||||||
 | 
					Open the Flycheck manual.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\(fn)" t nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(autoload 'flycheck-mode "flycheck" "\
 | 
				
			||||||
 | 
					Flycheck is a minor mode for on-the-fly syntax checking.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In `flycheck-mode' the buffer is automatically syntax-checked
 | 
				
			||||||
 | 
					using the first suitable syntax checker from `flycheck-checkers'.
 | 
				
			||||||
 | 
					Use `flycheck-select-checker' to select a checker for the current
 | 
				
			||||||
 | 
					buffer manually.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If you run into issues, use `\\[flycheck-verify-setup]' to get help.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Flycheck supports many languages out of the box, and many
 | 
				
			||||||
 | 
					additional ones are available on MELPA.  Adding new ones is very
 | 
				
			||||||
 | 
					easy.  Complete documentation is available online at URL
 | 
				
			||||||
 | 
					`https://www.flycheck.org/en/latest/'.  Please report issues and
 | 
				
			||||||
 | 
					request features at URL `https://github.com/flycheck/flycheck'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Flycheck displays its status in the mode line.  In the default
 | 
				
			||||||
 | 
					configuration, it looks like this:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`FlyC'     This buffer has not been checked yet.
 | 
				
			||||||
 | 
					`FlyC-'    Flycheck doesn't have a checker for this buffer.
 | 
				
			||||||
 | 
					`FlyC*'    Flycheck is running.  Expect results soon!
 | 
				
			||||||
 | 
					`FlyC:3|2' This buffer contains three warnings and two errors.
 | 
				
			||||||
 | 
					           Use `\\[flycheck-list-errors]' to see the list.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					You may also see the following icons:
 | 
				
			||||||
 | 
					`FlyC!'    The checker crashed.
 | 
				
			||||||
 | 
					`FlyC.'    The last syntax check was manually interrupted.
 | 
				
			||||||
 | 
					`FlyC?'    The checker did something unexpected, like exiting with 1
 | 
				
			||||||
 | 
					           but returning no errors.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The following keybindings are available in `flycheck-mode':
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\\{flycheck-mode-map}
 | 
				
			||||||
 | 
					\(you can change the prefix by customizing
 | 
				
			||||||
 | 
					`flycheck-keymap-prefix')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If called interactively, enable Flycheck mode if ARG is positive,
 | 
				
			||||||
 | 
					and disable it if ARG is zero or negative.  If called from Lisp,
 | 
				
			||||||
 | 
					also enable the mode if ARG is omitted or nil, and toggle it if
 | 
				
			||||||
 | 
					ARG is ‘toggle’; disable the mode otherwise.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\(fn &optional ARG)" t nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defvar global-flycheck-mode nil "\
 | 
				
			||||||
 | 
					Non-nil if Global Flycheck mode is enabled.
 | 
				
			||||||
 | 
					See the `global-flycheck-mode' command
 | 
				
			||||||
 | 
					for a description of this minor mode.
 | 
				
			||||||
 | 
					Setting this variable directly does not take effect;
 | 
				
			||||||
 | 
					either customize it (see the info node `Easy Customization')
 | 
				
			||||||
 | 
					or call the function `global-flycheck-mode'.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(custom-autoload 'global-flycheck-mode "flycheck" nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(autoload 'global-flycheck-mode "flycheck" "\
 | 
				
			||||||
 | 
					Toggle Flycheck mode in all buffers.
 | 
				
			||||||
 | 
					With prefix ARG, enable Global Flycheck mode if ARG is positive;
 | 
				
			||||||
 | 
					otherwise, disable it.  If called from Lisp, enable the mode if
 | 
				
			||||||
 | 
					ARG is omitted or nil.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Flycheck mode is enabled in all buffers where
 | 
				
			||||||
 | 
					`flycheck-mode-on-safe' would do it.
 | 
				
			||||||
 | 
					See `flycheck-mode' for more information on Flycheck mode.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\(fn &optional ARG)" t nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(autoload 'flycheck-define-error-level "flycheck" "\
 | 
				
			||||||
 | 
					Define a new error LEVEL with PROPERTIES.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The following PROPERTIES constitute an error level:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`:severity SEVERITY'
 | 
				
			||||||
 | 
					     A number denoting the severity of this level.  The higher
 | 
				
			||||||
 | 
					     the number, the more severe is this level compared to other
 | 
				
			||||||
 | 
					     levels.  Defaults to 0; info is -10, warning is 10, and
 | 
				
			||||||
 | 
					     error is 100.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     The severity is used by `flycheck-error-level-<' to
 | 
				
			||||||
 | 
					     determine the ordering of errors according to their levels.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`:compilation-level LEVEL'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     A number indicating the broad class of messages that errors
 | 
				
			||||||
 | 
					     at this level belong to: one of 0 (info), 1 (warning), or
 | 
				
			||||||
 | 
					     2 or nil (error).  Defaults to nil.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     This is used by `flycheck-checker-pattern-to-error-regexp'
 | 
				
			||||||
 | 
					     to map error levels into `compilation-mode''s hierarchy and
 | 
				
			||||||
 | 
					     to get proper highlighting of errors in `compilation-mode'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`:overlay-category CATEGORY'
 | 
				
			||||||
 | 
					     A symbol denoting the overlay category to use for error
 | 
				
			||||||
 | 
					     highlight overlays for this level.  See Info
 | 
				
			||||||
 | 
					     node `(elisp)Overlay Properties' for more information about
 | 
				
			||||||
 | 
					     overlay categories.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     A category for an error level overlay should at least define
 | 
				
			||||||
 | 
					     the `face' property, for error highlighting.  Another useful
 | 
				
			||||||
 | 
					     property for error level categories is `priority', to
 | 
				
			||||||
 | 
					     influence the stacking of multiple error level overlays.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`:fringe-bitmap BITMAPS'
 | 
				
			||||||
 | 
					     A fringe bitmap symbol denoting the bitmap to use for fringe
 | 
				
			||||||
 | 
					     indicators for this level, or a cons of two bitmaps (one for
 | 
				
			||||||
 | 
					     narrow fringes and one for wide fringes).  See Info node
 | 
				
			||||||
 | 
					     `(elisp)Fringe Bitmaps' for more information about fringe
 | 
				
			||||||
 | 
					     bitmaps, including a list of built-in fringe bitmaps.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`:fringe-face FACE'
 | 
				
			||||||
 | 
					     A face symbol denoting the face to use for fringe indicators
 | 
				
			||||||
 | 
					     for this level.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`:margin-spec SPEC'
 | 
				
			||||||
 | 
					     A display specification indicating what to display in the
 | 
				
			||||||
 | 
					     margin when `flycheck-indication-mode' is `left-margin' or
 | 
				
			||||||
 | 
					     `right-margin'.  See Info node `(elisp)Displaying in the
 | 
				
			||||||
 | 
					     Margins'.  If omitted, Flycheck generates an image spec from
 | 
				
			||||||
 | 
					     the fringe bitmap.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`:error-list-face FACE'
 | 
				
			||||||
 | 
					     A face symbol denoting the face to use for messages of this
 | 
				
			||||||
 | 
					     level in the error list.  See `flycheck-list-errors'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\(fn LEVEL &rest PROPERTIES)" nil nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(function-put 'flycheck-define-error-level 'lisp-indent-function '1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(autoload 'flycheck-define-command-checker "flycheck" "\
 | 
				
			||||||
 | 
					Define SYMBOL as syntax checker to run a command.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Define SYMBOL as generic syntax checker via
 | 
				
			||||||
 | 
					`flycheck-define-generic-checker', which uses an external command
 | 
				
			||||||
 | 
					to check the buffer.  SYMBOL and DOCSTRING are the same as for
 | 
				
			||||||
 | 
					`flycheck-define-generic-checker'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					In addition to the properties understood by
 | 
				
			||||||
 | 
					`flycheck-define-generic-checker', the following PROPERTIES
 | 
				
			||||||
 | 
					constitute a command syntax checker.  Unless otherwise noted, all
 | 
				
			||||||
 | 
					properties are mandatory.  Note that the default `:error-filter'
 | 
				
			||||||
 | 
					of command checkers is `flycheck-sanitize-errors'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`:command COMMAND'
 | 
				
			||||||
 | 
					     The command to run for syntax checking.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     COMMAND is a list of the form `(EXECUTABLE [ARG ...])'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     EXECUTABLE is a string with the executable of this syntax
 | 
				
			||||||
 | 
					     checker.  It can be overridden with the variable
 | 
				
			||||||
 | 
					     `flycheck-SYMBOL-executable'.  Note that this variable is
 | 
				
			||||||
 | 
					     NOT implicitly defined by this function.  Use
 | 
				
			||||||
 | 
					     `flycheck-def-executable-var' to define this variable.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     Each ARG is an argument to the executable, either as string,
 | 
				
			||||||
 | 
					     or as special symbol or form for
 | 
				
			||||||
 | 
					     `flycheck-substitute-argument', which see.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`:error-patterns PATTERNS'
 | 
				
			||||||
 | 
					     A list of patterns to parse the output of the `:command'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     Each ITEM in PATTERNS is a list `(LEVEL SEXP ...)', where
 | 
				
			||||||
 | 
					     LEVEL is a Flycheck error level (see
 | 
				
			||||||
 | 
					     `flycheck-define-error-level'), followed by one or more RX
 | 
				
			||||||
 | 
					     `SEXP's which parse an error of that level and extract line,
 | 
				
			||||||
 | 
					     column, file name and the message.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     See `rx' for general information about RX, and
 | 
				
			||||||
 | 
					     `flycheck-rx-to-string' for some special RX forms provided
 | 
				
			||||||
 | 
					     by Flycheck.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     All patterns are applied in the order of declaration to the
 | 
				
			||||||
 | 
					     whole output of the syntax checker.  Output already matched
 | 
				
			||||||
 | 
					     by a pattern will not be matched by subsequent patterns.  In
 | 
				
			||||||
 | 
					     other words, the first pattern wins.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     This property is optional.  If omitted, however, an
 | 
				
			||||||
 | 
					     `:error-parser' is mandatory.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`:error-parser FUNCTION'
 | 
				
			||||||
 | 
					     A function to parse errors with.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     The function shall accept three arguments OUTPUT CHECKER
 | 
				
			||||||
 | 
					     BUFFER.  OUTPUT is the syntax checker output as string,
 | 
				
			||||||
 | 
					     CHECKER the syntax checker that was used, and BUFFER a
 | 
				
			||||||
 | 
					     buffer object representing the checked buffer.  The function
 | 
				
			||||||
 | 
					     must return a list of `flycheck-error' objects parsed from
 | 
				
			||||||
 | 
					     OUTPUT.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     This property is optional.  If omitted, it defaults to
 | 
				
			||||||
 | 
					     `flycheck-parse-with-patterns'.  In this case,
 | 
				
			||||||
 | 
					     `:error-patterns' is mandatory.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					`:standard-input t'
 | 
				
			||||||
 | 
					     Whether to send the buffer contents on standard input.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     If this property is given and has a non-nil value, send the
 | 
				
			||||||
 | 
					     contents of the buffer on standard input.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					     Defaults to nil.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Note that you may not give `:start', `:interrupt', and
 | 
				
			||||||
 | 
					`:print-doc' for a command checker.  You can give a custom
 | 
				
			||||||
 | 
					`:verify' function, though, whose results will be appended to the
 | 
				
			||||||
 | 
					default `:verify' function of command checkers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\(fn SYMBOL DOCSTRING &rest PROPERTIES)" nil nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(function-put 'flycheck-define-command-checker 'lisp-indent-function '1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(function-put 'flycheck-define-command-checker 'doc-string-elt '2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(autoload 'flycheck-def-config-file-var "flycheck" "\
 | 
				
			||||||
 | 
					Define SYMBOL as config file variable for CHECKER, with default FILE-NAME.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SYMBOL is declared as customizable variable using `defcustom', to
 | 
				
			||||||
 | 
					provide configuration files for the given syntax CHECKER.
 | 
				
			||||||
 | 
					CUSTOM-ARGS are forwarded to `defcustom'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FILE-NAME is the initial value of the new variable.  If omitted,
 | 
				
			||||||
 | 
					the default value is nil.  It can be either a string or a list of
 | 
				
			||||||
 | 
					strings.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Use this together with the `config-file' form in the `:command'
 | 
				
			||||||
 | 
					argument to `flycheck-define-checker'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\(fn SYMBOL CHECKER &optional FILE-NAME &rest CUSTOM-ARGS)" nil t)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(function-put 'flycheck-def-config-file-var 'lisp-indent-function '3)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(autoload 'flycheck-def-option-var "flycheck" "\
 | 
				
			||||||
 | 
					Define SYMBOL as option variable with INIT-VALUE for CHECKER.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SYMBOL is declared as customizable variable using `defcustom', to
 | 
				
			||||||
 | 
					provide an option for the given syntax CHECKERS (a checker or a
 | 
				
			||||||
 | 
					list of checkers).  INIT-VALUE is the initial value of the
 | 
				
			||||||
 | 
					variable, and DOCSTRING is its docstring.  CUSTOM-ARGS are
 | 
				
			||||||
 | 
					forwarded to `defcustom'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Use this together with the `option', `option-list' and
 | 
				
			||||||
 | 
					`option-flag' forms in the `:command' argument to
 | 
				
			||||||
 | 
					`flycheck-define-checker'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\(fn SYMBOL INIT-VALUE CHECKERS DOCSTRING &rest CUSTOM-ARGS)" nil t)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(function-put 'flycheck-def-option-var 'lisp-indent-function '3)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(function-put 'flycheck-def-option-var 'doc-string-elt '4)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(autoload 'flycheck-define-checker "flycheck" "\
 | 
				
			||||||
 | 
					Define SYMBOL as command syntax checker with DOCSTRING and PROPERTIES.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Like `flycheck-define-command-checker', but PROPERTIES must not
 | 
				
			||||||
 | 
					be quoted.  Also, implicitly define the executable variable for
 | 
				
			||||||
 | 
					SYMBOL with `flycheck-def-executable-var'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\(fn SYMBOL DOCSTRING &rest PROPERTIES)" nil t)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(function-put 'flycheck-define-checker 'lisp-indent-function '1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(function-put 'flycheck-define-checker 'doc-string-elt '2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "flycheck" '("flycheck-" "list-flycheck-errors" "help-flycheck-checker-d")))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;***
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;### (autoloads nil "flycheck-buttercup" "flycheck-buttercup.el"
 | 
				
			||||||
 | 
					;;;;;;  (0 0 0 0))
 | 
				
			||||||
 | 
					;;; Generated autoloads from flycheck-buttercup.el
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "flycheck-buttercup" '("flycheck-buttercup-format-error-list")))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;***
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;### (autoloads nil "flycheck-ert" "flycheck-ert.el" (0 0 0 0))
 | 
				
			||||||
 | 
					;;; Generated autoloads from flycheck-ert.el
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "flycheck-ert" '("flycheck-er")))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;***
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;### (autoloads nil nil ("flycheck-pkg.el") (0 0 0 0))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;***
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Local Variables:
 | 
				
			||||||
 | 
					;; version-control: never
 | 
				
			||||||
 | 
					;; no-byte-compile: t
 | 
				
			||||||
 | 
					;; no-update-autoloads: t
 | 
				
			||||||
 | 
					;; coding: utf-8
 | 
				
			||||||
 | 
					;; End:
 | 
				
			||||||
 | 
					;;; flycheck-autoloads.el ends here
 | 
				
			||||||
							
								
								
									
										157
									
								
								elpa/flycheck-20200610.1809/flycheck-buttercup.el
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										157
									
								
								elpa/flycheck-20200610.1809/flycheck-buttercup.el
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,157 @@
 | 
				
			|||||||
 | 
					;;; flycheck-buttercup.el --- Flycheck: Extensions to Buttercup -*- lexical-binding: t; -*-
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Copyright (C) 2017 Flycheck contributors
 | 
				
			||||||
 | 
					;; Copyright (C) 2016 Sebastian Wiesner and Flycheck contributors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Author: Sebastian Wiesner <swiesner@lunaryorn.com>
 | 
				
			||||||
 | 
					;; Maintainer: Clément Pit-Claudel <clement.pitclaudel@live.com>
 | 
				
			||||||
 | 
					;;             fmdkdd <fmdkdd@gmail.com>
 | 
				
			||||||
 | 
					;; Keywords: lisp, tools
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; This file is not part of GNU Emacs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; This program 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 of the License, or
 | 
				
			||||||
 | 
					;; (at your option) any later version.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Commentary:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Extensions to Buttercup to write BDD tests for Flycheck.
 | 
				
			||||||
 | 
					;;
 | 
				
			||||||
 | 
					;; Buttercup is a BDD testing framework for Emacs, see URL
 | 
				
			||||||
 | 
					;; `https://github.com/jorgenschaefer/emacs-buttercup/'.  Flycheck uses
 | 
				
			||||||
 | 
					;; Buttercup extensively for new tests.
 | 
				
			||||||
 | 
					;;
 | 
				
			||||||
 | 
					;; This library provides extensions to Buttercup to write Specs for Flycheck.
 | 
				
			||||||
 | 
					;;
 | 
				
			||||||
 | 
					;; * Custom matchers
 | 
				
			||||||
 | 
					;;
 | 
				
			||||||
 | 
					;; (expect 'foo :to-be-local) - Is `foo' a local variable in the current buffer?
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(require 'buttercup)
 | 
				
			||||||
 | 
					(require 'flycheck)
 | 
				
			||||||
 | 
					(require 'seq)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Buttercup helpers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun flycheck-buttercup-format-error-list (errors)
 | 
				
			||||||
 | 
					  "Format ERRORS into a human-readable string."
 | 
				
			||||||
 | 
					  (mapconcat (lambda (e) (flycheck-error-format e 'with-file-name))
 | 
				
			||||||
 | 
					             errors "\n"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Data matchers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(buttercup-define-matcher :to-be-empty-string (s)
 | 
				
			||||||
 | 
					  (let ((s (funcall s)))
 | 
				
			||||||
 | 
					    (if (equal s "")
 | 
				
			||||||
 | 
					        (cons t (format "Expected %S not be an empty string" s))
 | 
				
			||||||
 | 
					      (cons nil (format "Expected %S to be an empty string" s)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(buttercup-define-matcher :to-match-with-group (re s index match)
 | 
				
			||||||
 | 
					  (let* ((re (funcall re))
 | 
				
			||||||
 | 
					         (s (funcall s))
 | 
				
			||||||
 | 
					         (index (funcall index))
 | 
				
			||||||
 | 
					         (match (funcall match))
 | 
				
			||||||
 | 
					         (matches? (string-match re s))
 | 
				
			||||||
 | 
					         (result (and matches? (match-string index s))))
 | 
				
			||||||
 | 
					    (if (and matches? (equal result match))
 | 
				
			||||||
 | 
					        (cons t (format "Expected %S not to match %S with %S in group %s"
 | 
				
			||||||
 | 
					                        re s match index))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      (cons nil (format "Expected %S to match %S with %S in group %s, %s"
 | 
				
			||||||
 | 
					                        re s match index
 | 
				
			||||||
 | 
					                        (if matches?
 | 
				
			||||||
 | 
					                            (format "but got %S" result)
 | 
				
			||||||
 | 
					                          "but did not match"))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Emacs feature matchers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(buttercup-define-matcher :to-be-live (buffer)
 | 
				
			||||||
 | 
					  (let ((buffer (get-buffer (funcall buffer))))
 | 
				
			||||||
 | 
					    (if (buffer-live-p buffer)
 | 
				
			||||||
 | 
					        (cons t (format "Expected %S not to be a live buffer, but it is"
 | 
				
			||||||
 | 
					                        buffer))
 | 
				
			||||||
 | 
					      (cons nil (format "Expected %S to be a live buffer, but it is not"
 | 
				
			||||||
 | 
					                        buffer)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(buttercup-define-matcher :to-be-visible (buffer)
 | 
				
			||||||
 | 
					  (let ((buffer (get-buffer (funcall buffer))))
 | 
				
			||||||
 | 
					    (cond
 | 
				
			||||||
 | 
					     ((and buffer (get-buffer-window buffer))
 | 
				
			||||||
 | 
					      (cons t (format "Expected %S not to be a visible buffer, but it is"
 | 
				
			||||||
 | 
					                      buffer)))
 | 
				
			||||||
 | 
					     ((not (bufferp buffer))
 | 
				
			||||||
 | 
					      (cons nil
 | 
				
			||||||
 | 
					            (format "Expected %S to be a visible buffer, but it is not a buffer"
 | 
				
			||||||
 | 
					                    buffer)))
 | 
				
			||||||
 | 
					     (t (cons
 | 
				
			||||||
 | 
					         nil
 | 
				
			||||||
 | 
					         (format "Expected %S to be a visible buffer, but it is not visible"
 | 
				
			||||||
 | 
					                 buffer))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(buttercup-define-matcher :to-be-local (symbol)
 | 
				
			||||||
 | 
					  (let ((symbol (funcall symbol)))
 | 
				
			||||||
 | 
					    (if (local-variable-p symbol)
 | 
				
			||||||
 | 
					        (cons t (format "Expected %S not to be a local variable, but it is"
 | 
				
			||||||
 | 
					                        symbol))
 | 
				
			||||||
 | 
					      (cons nil (format "Expected %S to be a local variable, but it is not"
 | 
				
			||||||
 | 
					                        symbol)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(buttercup-define-matcher :to-contain-match (buffer re)
 | 
				
			||||||
 | 
					  (let ((buffer (funcall buffer))
 | 
				
			||||||
 | 
					        (re (funcall re)))
 | 
				
			||||||
 | 
					    (if (not (get-buffer buffer))
 | 
				
			||||||
 | 
					        (cons nil (format "Expected %S to contain a match of %s, \
 | 
				
			||||||
 | 
					but is not a buffer" buffer re))
 | 
				
			||||||
 | 
					      (with-current-buffer buffer
 | 
				
			||||||
 | 
					        (save-excursion
 | 
				
			||||||
 | 
					          (goto-char (point-min))
 | 
				
			||||||
 | 
					          (if (re-search-forward re nil 'noerror)
 | 
				
			||||||
 | 
					              (cons t (format "Expected %S to contain a match \
 | 
				
			||||||
 | 
					for %s, but it did not" buffer re))
 | 
				
			||||||
 | 
					            (cons nil (format "Expected %S not to contain a match for \
 | 
				
			||||||
 | 
					%s but it did not." buffer re))))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Flycheck matchers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(buttercup-define-matcher :to-be-equal-flycheck-errors (a b)
 | 
				
			||||||
 | 
					  (let* ((a (funcall a))
 | 
				
			||||||
 | 
					         (b (funcall b))
 | 
				
			||||||
 | 
					         (a-formatted (flycheck-buttercup-format-error-list a))
 | 
				
			||||||
 | 
					         (b-formatted (flycheck-buttercup-format-error-list b)))
 | 
				
			||||||
 | 
					    (if (equal a b)
 | 
				
			||||||
 | 
					        (cons t (format "Expected
 | 
				
			||||||
 | 
					%s
 | 
				
			||||||
 | 
					not to be equal to
 | 
				
			||||||
 | 
					%s" a-formatted b-formatted))
 | 
				
			||||||
 | 
					      (cons nil (format "Expected
 | 
				
			||||||
 | 
					%s
 | 
				
			||||||
 | 
					to be equal to
 | 
				
			||||||
 | 
					%s" a-formatted b-formatted)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(provide 'flycheck-buttercup)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Disable byte compilation for this library, to prevent package.el choking on a
 | 
				
			||||||
 | 
					;; missing `buttercup' library.  See
 | 
				
			||||||
 | 
					;; https://github.com/flycheck/flycheck/issues/860
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Local Variables:
 | 
				
			||||||
 | 
					;; no-byte-compile: t
 | 
				
			||||||
 | 
					;; End:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; flycheck-buttercup.el ends here
 | 
				
			||||||
							
								
								
									
										507
									
								
								elpa/flycheck-20200610.1809/flycheck-ert.el
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										507
									
								
								elpa/flycheck-20200610.1809/flycheck-ert.el
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,507 @@
 | 
				
			|||||||
 | 
					;;; flycheck-ert.el --- Flycheck: ERT extensions  -*- lexical-binding: t; -*-
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Copyright (C) 2017-2018 Flycheck contributors
 | 
				
			||||||
 | 
					;; Copyright (C) 2013-2016 Sebastian Wiesner and Flycheck contributors
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Author: Sebastian Wiesner <swiesner@lunaryorn.com>
 | 
				
			||||||
 | 
					;; Maintainer: Clément Pit-Claudel <clement.pitclaudel@live.com>
 | 
				
			||||||
 | 
					;;             fmdkdd <fmdkdd@gmail.com>
 | 
				
			||||||
 | 
					;; URL: https://github.com/flycheck/flycheck
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; This file is not part of GNU Emacs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; This program 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 of the License, or
 | 
				
			||||||
 | 
					;; (at your option) any later version.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Commentary:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Unit testing library for Flycheck, the modern on-the-fly syntax checking
 | 
				
			||||||
 | 
					;; extension for GNU Emacs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Provide various utility functions and unit test helpers to test Flycheck and
 | 
				
			||||||
 | 
					;; Flycheck extensions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(require 'flycheck)
 | 
				
			||||||
 | 
					(require 'ert)
 | 
				
			||||||
 | 
					(require 'macroexp)                     ; For macro utilities
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Compatibility
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(eval-and-compile
 | 
				
			||||||
 | 
					  ;; Provide `ert-skip' and friends for Emacs 24.3
 | 
				
			||||||
 | 
					  (defconst flycheck-ert-ert-can-skip (fboundp 'ert-skip)
 | 
				
			||||||
 | 
					    "Whether ERT supports test skipping.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  (unless (fboundp 'define-error)
 | 
				
			||||||
 | 
					    ;; from Emacs `subr.el'
 | 
				
			||||||
 | 
					    (defun define-error (name message &optional parent)
 | 
				
			||||||
 | 
					      "Define NAME as a new error signal.
 | 
				
			||||||
 | 
					MESSAGE is a string that will be output to the echo area if such an error
 | 
				
			||||||
 | 
					is signaled without being caught by a `condition-case'.
 | 
				
			||||||
 | 
					PARENT is either a signal or a list of signals from which it inherits.
 | 
				
			||||||
 | 
					Defaults to `error'."
 | 
				
			||||||
 | 
					      (unless parent (setq parent 'error))
 | 
				
			||||||
 | 
					      (let ((conditions
 | 
				
			||||||
 | 
					             (if (consp parent)
 | 
				
			||||||
 | 
					                 (apply #'append
 | 
				
			||||||
 | 
					                        (mapcar
 | 
				
			||||||
 | 
					                         (lambda (parent)
 | 
				
			||||||
 | 
					                           (cons parent
 | 
				
			||||||
 | 
					                                 (or (get parent 'error-conditions)
 | 
				
			||||||
 | 
					                                     (error "Unknown signal `%s'" parent))))
 | 
				
			||||||
 | 
					                         parent))
 | 
				
			||||||
 | 
					               (cons parent (get parent 'error-conditions)))))
 | 
				
			||||||
 | 
					        (put name 'error-conditions
 | 
				
			||||||
 | 
					             (delete-dups (copy-sequence (cons name conditions))))
 | 
				
			||||||
 | 
					        (when message (put name 'error-message message)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  (unless flycheck-ert-ert-can-skip
 | 
				
			||||||
 | 
					    ;; Fake skipping
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    (define-error 'flycheck-ert-skipped "Test skipped")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    (defun ert-skip (data)
 | 
				
			||||||
 | 
					      (signal 'flycheck-ert-skipped data))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    (defmacro skip-unless (form)
 | 
				
			||||||
 | 
					      `(unless (ignore-errors ,form)
 | 
				
			||||||
 | 
					         (signal 'flycheck-ert-skipped ',form)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    (defun ert-test-skipped-p (result)
 | 
				
			||||||
 | 
					      (and (ert-test-failed-p result)
 | 
				
			||||||
 | 
					           (eq (car (ert-test-failed-condition result))
 | 
				
			||||||
 | 
					               'flycheck-ert-skipped)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Internal variables
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defvar flycheck-ert--resource-directory nil
 | 
				
			||||||
 | 
					  "The directory to get resources from in this test suite.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Resource management macros
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defmacro flycheck-ert-with-temp-buffer (&rest body)
 | 
				
			||||||
 | 
					  "Eval BODY within a temporary buffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Like `with-temp-buffer', but resets the modification state of the
 | 
				
			||||||
 | 
					temporary buffer to make sure that it is properly killed even if
 | 
				
			||||||
 | 
					it has a backing file and is modified."
 | 
				
			||||||
 | 
					  (declare (indent 0) (debug t))
 | 
				
			||||||
 | 
					  `(with-temp-buffer
 | 
				
			||||||
 | 
					     (unwind-protect
 | 
				
			||||||
 | 
					         ,(macroexp-progn body)
 | 
				
			||||||
 | 
					       ;; Reset modification state of the buffer, and unlink it from its backing
 | 
				
			||||||
 | 
					       ;; file, if any, because Emacs refuses to kill modified buffers with
 | 
				
			||||||
 | 
					       ;; backing files, even if they are temporary.
 | 
				
			||||||
 | 
					       (set-buffer-modified-p nil)
 | 
				
			||||||
 | 
					       (set-visited-file-name nil 'no-query))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defmacro flycheck-ert-with-file-buffer (file-name &rest body)
 | 
				
			||||||
 | 
					  "Create a buffer from FILE-NAME and eval BODY.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BODY is evaluated with `current-buffer' being a buffer with the
 | 
				
			||||||
 | 
					contents FILE-NAME."
 | 
				
			||||||
 | 
					  (declare (indent 1) (debug t))
 | 
				
			||||||
 | 
					  `(let ((file-name ,file-name))
 | 
				
			||||||
 | 
					     (unless (file-exists-p file-name)
 | 
				
			||||||
 | 
					       (error "%s does not exist" file-name))
 | 
				
			||||||
 | 
					     (flycheck-ert-with-temp-buffer
 | 
				
			||||||
 | 
					       (insert-file-contents file-name 'visit)
 | 
				
			||||||
 | 
					       (set-visited-file-name file-name 'no-query)
 | 
				
			||||||
 | 
					       (cd (file-name-directory file-name))
 | 
				
			||||||
 | 
					       ;; Mark the buffer as not modified, because we just loaded the file up to
 | 
				
			||||||
 | 
					       ;; now.
 | 
				
			||||||
 | 
					       (set-buffer-modified-p nil)
 | 
				
			||||||
 | 
					       ,@body)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defmacro flycheck-ert-with-help-buffer (&rest body)
 | 
				
			||||||
 | 
					  "Execute BODY and kill the help buffer afterwards.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Use this macro to test functions that create a Help buffer."
 | 
				
			||||||
 | 
					  (declare (indent 0))
 | 
				
			||||||
 | 
					  `(unwind-protect
 | 
				
			||||||
 | 
					       ,(macroexp-progn body)
 | 
				
			||||||
 | 
					     (when (buffer-live-p (get-buffer (help-buffer)))
 | 
				
			||||||
 | 
					       (kill-buffer (help-buffer)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defmacro flycheck-ert-with-global-mode (&rest body)
 | 
				
			||||||
 | 
					  "Execute BODY with Global Flycheck Mode enabled.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					After BODY, restore the old state of Global Flycheck Mode."
 | 
				
			||||||
 | 
					  (declare (indent 0))
 | 
				
			||||||
 | 
					  `(let ((old-state global-flycheck-mode))
 | 
				
			||||||
 | 
					     (unwind-protect
 | 
				
			||||||
 | 
					         (progn
 | 
				
			||||||
 | 
					           (global-flycheck-mode 1)
 | 
				
			||||||
 | 
					           ,@body)
 | 
				
			||||||
 | 
					       (global-flycheck-mode (if old-state 1 -1)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defmacro flycheck-ert-with-env (env &rest body)
 | 
				
			||||||
 | 
					  "Add ENV to `process-environment' in BODY.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Execute BODY with a `process-environment' which contains all
 | 
				
			||||||
 | 
					variables from ENV added.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ENV is an alist, where each cons cell `(VAR . VALUE)' is a
 | 
				
			||||||
 | 
					environment variable VAR to be added to `process-environment'
 | 
				
			||||||
 | 
					with VALUE."
 | 
				
			||||||
 | 
					  (declare (indent 1))
 | 
				
			||||||
 | 
					  `(let ((process-environment (copy-sequence process-environment)))
 | 
				
			||||||
 | 
					     (pcase-dolist (`(,var . ,value) ,env)
 | 
				
			||||||
 | 
					       (setenv var value))
 | 
				
			||||||
 | 
					     ,@body))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Test resources
 | 
				
			||||||
 | 
					(defun flycheck-ert-resource-filename (resource-file)
 | 
				
			||||||
 | 
					  "Determine the absolute file name of a RESOURCE-FILE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Relative file names are expanded against
 | 
				
			||||||
 | 
					`flycheck-ert--resource-directory'."
 | 
				
			||||||
 | 
					  (expand-file-name resource-file flycheck-ert--resource-directory))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defmacro flycheck-ert-with-resource-buffer (resource-file &rest body)
 | 
				
			||||||
 | 
					  "Create a temp buffer from a RESOURCE-FILE and execute BODY.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The absolute file name of RESOURCE-FILE is determined with
 | 
				
			||||||
 | 
					`flycheck-ert-resource-filename'."
 | 
				
			||||||
 | 
					  (declare (indent 1))
 | 
				
			||||||
 | 
					  `(flycheck-ert-with-file-buffer
 | 
				
			||||||
 | 
					       (flycheck-ert-resource-filename ,resource-file)
 | 
				
			||||||
 | 
					     ,@body))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Test suite initialization
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun flycheck-ert-initialize (resource-dir)
 | 
				
			||||||
 | 
					  "Initialize a test suite with RESOURCE-DIR.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RESOURCE-DIR is the directory, `flycheck-ert-resource-filename'
 | 
				
			||||||
 | 
					should use to lookup resource files."
 | 
				
			||||||
 | 
					  (when flycheck-ert--resource-directory
 | 
				
			||||||
 | 
					    (error "Test suite already initialized"))
 | 
				
			||||||
 | 
					  (let ((tests (ert-select-tests t t)))
 | 
				
			||||||
 | 
					    ;; Select all tests
 | 
				
			||||||
 | 
					    (unless tests
 | 
				
			||||||
 | 
					      (error "No tests defined.  \
 | 
				
			||||||
 | 
					Call `flycheck-ert-initialize' after defining all tests!"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    (setq flycheck-ert--resource-directory resource-dir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ;; Emacs 24.3 don't support skipped tests, so we add poor man's test
 | 
				
			||||||
 | 
					    ;; skipping: We mark skipped tests as expected failures by adjusting the
 | 
				
			||||||
 | 
					    ;; expected result of all test cases. Not particularly pretty, but works :)
 | 
				
			||||||
 | 
					    (unless flycheck-ert-ert-can-skip
 | 
				
			||||||
 | 
					      (dolist (test tests)
 | 
				
			||||||
 | 
					        (let ((result (ert-test-expected-result-type test)))
 | 
				
			||||||
 | 
					          (setf (ert-test-expected-result-type test)
 | 
				
			||||||
 | 
					                `(or ,result (satisfies ert-test-skipped-p))))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Test case definitions
 | 
				
			||||||
 | 
					(defmacro flycheck-ert-def-checker-test (checker language name
 | 
				
			||||||
 | 
					                                                 &rest keys-and-body)
 | 
				
			||||||
 | 
					  "Define a test case for a syntax CHECKER for LANGUAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					CHECKER is a symbol or a list of symbols denoting syntax checkers
 | 
				
			||||||
 | 
					being tested by the test.  The test case is skipped, if any of
 | 
				
			||||||
 | 
					these checkers cannot be used.  LANGUAGE is a symbol or a list of
 | 
				
			||||||
 | 
					symbols denoting the programming languages supported by the
 | 
				
			||||||
 | 
					syntax checkers.  This is currently only used for tagging the
 | 
				
			||||||
 | 
					test appropriately.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NAME is a symbol denoting the local name of the test.  The test
 | 
				
			||||||
 | 
					itself is ultimately named
 | 
				
			||||||
 | 
					`flycheck-define-checker/CHECKER/NAME'.  If CHECKER is a list,
 | 
				
			||||||
 | 
					the first checker in the list is used for naming the test.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Optionally, the keyword arguments `:tags' and `:expected-result'
 | 
				
			||||||
 | 
					may be given.  They have the same meaning as in `ert-deftest.',
 | 
				
			||||||
 | 
					and are added to the tags and result expectations set up by this
 | 
				
			||||||
 | 
					macro.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The remaining forms KEYS-AND-BODY denote the body of the test
 | 
				
			||||||
 | 
					case, including assertions and setup code."
 | 
				
			||||||
 | 
					  (declare (indent 3))
 | 
				
			||||||
 | 
					  (unless checker
 | 
				
			||||||
 | 
					    (error "No syntax checkers specified"))
 | 
				
			||||||
 | 
					  (unless language
 | 
				
			||||||
 | 
					    (error "No languages specified"))
 | 
				
			||||||
 | 
					  (let* ((checkers (if (symbolp checker) (list checker) checker))
 | 
				
			||||||
 | 
					         (checker (car checkers))
 | 
				
			||||||
 | 
					         (languages (if (symbolp language) (list language) language))
 | 
				
			||||||
 | 
					         (language-tags (mapcar (lambda (l) (intern (format "language-%s" l)))
 | 
				
			||||||
 | 
					                                languages))
 | 
				
			||||||
 | 
					         (checker-tags (mapcar (lambda (c) (intern (format "checker-%s" c)))
 | 
				
			||||||
 | 
					                               checkers))
 | 
				
			||||||
 | 
					         (local-name (or name 'default))
 | 
				
			||||||
 | 
					         (full-name (intern (format "flycheck-define-checker/%s/%s"
 | 
				
			||||||
 | 
					                                    checker local-name)))
 | 
				
			||||||
 | 
					         (keys-and-body (ert--parse-keys-and-body keys-and-body))
 | 
				
			||||||
 | 
					         (body (cadr keys-and-body))
 | 
				
			||||||
 | 
					         (keys (car keys-and-body))
 | 
				
			||||||
 | 
					         (default-tags '(syntax-checker external-tool)))
 | 
				
			||||||
 | 
					    `(ert-deftest ,full-name ()
 | 
				
			||||||
 | 
					       :expected-result ,(or (plist-get keys :expected-result) :passed)
 | 
				
			||||||
 | 
					       :tags (append ',(append default-tags language-tags checker-tags)
 | 
				
			||||||
 | 
					                     ,(plist-get keys :tags))
 | 
				
			||||||
 | 
					       ,@(mapcar (lambda (c)
 | 
				
			||||||
 | 
					                   `(skip-unless
 | 
				
			||||||
 | 
					                     ;; Ignore non-command checkers
 | 
				
			||||||
 | 
					                     (or (not (flycheck-checker-get ',c 'command))
 | 
				
			||||||
 | 
					                         (executable-find (flycheck-checker-executable ',c)))))
 | 
				
			||||||
 | 
					                 checkers)
 | 
				
			||||||
 | 
					       ,@body)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Test case results
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun flycheck-ert-syntax-check-timed-out-p (result)
 | 
				
			||||||
 | 
					  "Whether RESULT denotes a timed-out test.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RESULT is an ERT test result object."
 | 
				
			||||||
 | 
					  (and (ert-test-failed-p result)
 | 
				
			||||||
 | 
					       (eq (car (ert-test-failed-condition result))
 | 
				
			||||||
 | 
					           'flycheck-ert-syntax-check-timed-out)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Syntax checking in tests
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defvar-local flycheck-ert-syntax-checker-finished nil
 | 
				
			||||||
 | 
					  "Non-nil if the current checker has finished.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(add-hook 'flycheck-after-syntax-check-hook
 | 
				
			||||||
 | 
					          (lambda () (setq flycheck-ert-syntax-checker-finished t)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defconst flycheck-ert-checker-wait-time 10
 | 
				
			||||||
 | 
					  "Time to wait until a checker is finished in seconds.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					After this time has elapsed, the checker is considered to have
 | 
				
			||||||
 | 
					failed, and the test aborted with failure.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(define-error 'flycheck-ert-syntax-check-timed-out "Syntax check timed out.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun flycheck-ert-wait-for-syntax-checker ()
 | 
				
			||||||
 | 
					  "Wait until the syntax check in the current buffer is finished."
 | 
				
			||||||
 | 
					  (let ((starttime (float-time)))
 | 
				
			||||||
 | 
					    (while (and (not flycheck-ert-syntax-checker-finished)
 | 
				
			||||||
 | 
					                (< (- (float-time) starttime) flycheck-ert-checker-wait-time))
 | 
				
			||||||
 | 
					      (accept-process-output nil 0.02))
 | 
				
			||||||
 | 
					    (unless (< (- (float-time) starttime) flycheck-ert-checker-wait-time)
 | 
				
			||||||
 | 
					      (flycheck-stop)
 | 
				
			||||||
 | 
					      (signal 'flycheck-ert-syntax-check-timed-out nil)))
 | 
				
			||||||
 | 
					  (setq flycheck-ert-syntax-checker-finished nil))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun flycheck-ert-buffer-sync ()
 | 
				
			||||||
 | 
					  "Like `flycheck-buffer', but synchronously."
 | 
				
			||||||
 | 
					  (setq flycheck-ert-syntax-checker-finished nil)
 | 
				
			||||||
 | 
					  (should (not (flycheck-running-p)))
 | 
				
			||||||
 | 
					  (flycheck-mode) ;; This will only start a deferred check,
 | 
				
			||||||
 | 
					  (should (flycheck-get-checker-for-buffer))
 | 
				
			||||||
 | 
					  (flycheck-buffer) ;; …so we need an explicit manual check
 | 
				
			||||||
 | 
					  ;; After starting the check, the checker should either be running now, or
 | 
				
			||||||
 | 
					  ;; already be finished (if it was fast).
 | 
				
			||||||
 | 
					  (should (or flycheck-current-syntax-check
 | 
				
			||||||
 | 
					              flycheck-ert-syntax-checker-finished))
 | 
				
			||||||
 | 
					  ;; Also there should be no deferred check pending anymore
 | 
				
			||||||
 | 
					  (should-not (flycheck-deferred-check-p))
 | 
				
			||||||
 | 
					  (flycheck-ert-wait-for-syntax-checker))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun flycheck-ert-ensure-clear ()
 | 
				
			||||||
 | 
					  "Clear the current buffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Raise an assertion error if the buffer is not clear afterwards."
 | 
				
			||||||
 | 
					  (flycheck-clear)
 | 
				
			||||||
 | 
					  (should (not flycheck-current-errors))
 | 
				
			||||||
 | 
					  (should (not (-any? (lambda (ov) (overlay-get ov 'flycheck-overlay))
 | 
				
			||||||
 | 
					                      (overlays-in (point-min) (point-max))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Test assertions
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun flycheck-error-without-group (err)
 | 
				
			||||||
 | 
					  "Return a copy ERR with the `group' property set to nil."
 | 
				
			||||||
 | 
					  (let ((copy (copy-flycheck-error err)))
 | 
				
			||||||
 | 
					    (setf (flycheck-error-group copy) nil)
 | 
				
			||||||
 | 
					    copy))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun flycheck-ert-should-overlay (error)
 | 
				
			||||||
 | 
					  "Test that ERROR has a proper overlay in the current buffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ERROR is a Flycheck error object."
 | 
				
			||||||
 | 
					  (let* ((overlay (-first (lambda (ov)
 | 
				
			||||||
 | 
					                            (equal (flycheck-error-without-group
 | 
				
			||||||
 | 
					                                    (overlay-get ov 'flycheck-error))
 | 
				
			||||||
 | 
					                                   (flycheck-error-without-group error)))
 | 
				
			||||||
 | 
					                          (flycheck-overlays-in 0 (+ 1 (buffer-size)))))
 | 
				
			||||||
 | 
					         (region
 | 
				
			||||||
 | 
					          ;; Overlays of errors from other files are on the first line
 | 
				
			||||||
 | 
					          (if (flycheck-relevant-error-other-file-p error)
 | 
				
			||||||
 | 
					              (cons (point-min)
 | 
				
			||||||
 | 
					                    (save-excursion (goto-char (point-min)) (point-at-eol)))
 | 
				
			||||||
 | 
					            (flycheck-error-region-for-mode error 'symbols)))
 | 
				
			||||||
 | 
					         (level (flycheck-error-level error))
 | 
				
			||||||
 | 
					         (category (flycheck-error-level-overlay-category level))
 | 
				
			||||||
 | 
					         (face (get category 'face))
 | 
				
			||||||
 | 
					         (fringe-bitmap (flycheck-error-level-fringe-bitmap level))
 | 
				
			||||||
 | 
					         (fringe-face (flycheck-error-level-fringe-face level))
 | 
				
			||||||
 | 
					         (fringe-icon (list 'left-fringe fringe-bitmap fringe-face)))
 | 
				
			||||||
 | 
					    (should overlay)
 | 
				
			||||||
 | 
					    (should (overlay-get overlay 'flycheck-overlay))
 | 
				
			||||||
 | 
					    (should (= (overlay-start overlay) (car region)))
 | 
				
			||||||
 | 
					    (should (= (overlay-end overlay) (cdr region)))
 | 
				
			||||||
 | 
					    (should (eq (overlay-get overlay 'face) face))
 | 
				
			||||||
 | 
					    (should (equal (get-char-property 0 'display
 | 
				
			||||||
 | 
					                                      (overlay-get overlay 'before-string))
 | 
				
			||||||
 | 
					                   fringe-icon))
 | 
				
			||||||
 | 
					    (should (eq (overlay-get overlay 'category) category))
 | 
				
			||||||
 | 
					    (should (equal (flycheck-error-without-group (overlay-get overlay
 | 
				
			||||||
 | 
					                                                              'flycheck-error))
 | 
				
			||||||
 | 
					                   (flycheck-error-without-group error)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun flycheck-ert-sort-errors (errors)
 | 
				
			||||||
 | 
					  "Sort ERRORS by `flycheck-error-<'."
 | 
				
			||||||
 | 
					  (seq-sort #'flycheck-error-< errors))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun flycheck-ert-should-errors (&rest errors)
 | 
				
			||||||
 | 
					  "Test that the current buffers has ERRORS.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					ERRORS is a list of errors expected to be present in the current
 | 
				
			||||||
 | 
					buffer.  Each error is given as a list of arguments to
 | 
				
			||||||
 | 
					`flycheck-error-new-at'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If ERRORS are omitted, test that there are no errors at all in
 | 
				
			||||||
 | 
					the current buffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					With ERRORS, test that each error in ERRORS is present in the
 | 
				
			||||||
 | 
					current buffer, and that the number of errors in the current
 | 
				
			||||||
 | 
					buffer is equal to the number of given ERRORS.  In other words,
 | 
				
			||||||
 | 
					check that the buffer has all ERRORS, and no other errors."
 | 
				
			||||||
 | 
					  (let ((expected (flycheck-ert-sort-errors
 | 
				
			||||||
 | 
					                   (mapcar (apply-partially #'apply #'flycheck-error-new-at)
 | 
				
			||||||
 | 
					                           errors)))
 | 
				
			||||||
 | 
					        (current (flycheck-ert-sort-errors flycheck-current-errors)))
 | 
				
			||||||
 | 
					    (should (equal (mapcar #'flycheck-error-without-group expected)
 | 
				
			||||||
 | 
					                   (mapcar #'flycheck-error-without-group current)))
 | 
				
			||||||
 | 
					    ;; Check that related errors are the same
 | 
				
			||||||
 | 
					    (cl-mapcar
 | 
				
			||||||
 | 
					     (lambda (err1 err2)
 | 
				
			||||||
 | 
					       (should (equal (flycheck-ert-sort-errors
 | 
				
			||||||
 | 
					                       (mapcar #'flycheck-error-without-group
 | 
				
			||||||
 | 
					                               (flycheck-related-errors err1 expected)))
 | 
				
			||||||
 | 
					                      (flycheck-ert-sort-errors
 | 
				
			||||||
 | 
					                       (mapcar #'flycheck-error-without-group
 | 
				
			||||||
 | 
					                               (flycheck-related-errors err2))))))
 | 
				
			||||||
 | 
					     expected current)
 | 
				
			||||||
 | 
					    (mapc #'flycheck-ert-should-overlay expected))
 | 
				
			||||||
 | 
					  (should (= (length errors)
 | 
				
			||||||
 | 
					             (length (flycheck-overlays-in (point-min) (point-max))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(define-error 'flycheck-ert-suspicious-checker "Suspicious state from checker")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun flycheck-ert-should-syntax-check-in-buffer (&rest errors)
 | 
				
			||||||
 | 
					  "Test a syntax check in BUFFER, expecting ERRORS.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This is like `flycheck-ert-should-syntax-check', but with a
 | 
				
			||||||
 | 
					buffer in the right mode instead of a file."
 | 
				
			||||||
 | 
					  ;; Load safe file-local variables because some tests depend on them
 | 
				
			||||||
 | 
					  (let ((enable-local-variables :safe)
 | 
				
			||||||
 | 
					        ;; Disable all hooks at this place, to prevent 3rd party packages
 | 
				
			||||||
 | 
					        ;; from interfering
 | 
				
			||||||
 | 
					        (hack-local-variables-hook))
 | 
				
			||||||
 | 
					    (hack-local-variables))
 | 
				
			||||||
 | 
					  ;; Configure config file locating for unit tests
 | 
				
			||||||
 | 
					  (let ((process-hook-called 0)
 | 
				
			||||||
 | 
					        (suspicious nil))
 | 
				
			||||||
 | 
					    (add-hook 'flycheck-process-error-functions
 | 
				
			||||||
 | 
					              (lambda (_err)
 | 
				
			||||||
 | 
					                (setq process-hook-called (1+ process-hook-called))
 | 
				
			||||||
 | 
					                nil)
 | 
				
			||||||
 | 
					              nil :local)
 | 
				
			||||||
 | 
					    (add-hook 'flycheck-status-changed-functions
 | 
				
			||||||
 | 
					              (lambda (status)
 | 
				
			||||||
 | 
					                (when (eq status 'suspicious)
 | 
				
			||||||
 | 
					                  (setq suspicious t)))
 | 
				
			||||||
 | 
					              nil :local)
 | 
				
			||||||
 | 
					    (flycheck-ert-buffer-sync)
 | 
				
			||||||
 | 
					    (when suspicious
 | 
				
			||||||
 | 
					      (signal 'flycheck-ert-suspicious-checker nil))
 | 
				
			||||||
 | 
					    (apply #'flycheck-ert-should-errors errors)
 | 
				
			||||||
 | 
					    (should (= process-hook-called (length errors))))
 | 
				
			||||||
 | 
					  (flycheck-ert-ensure-clear))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun flycheck-ert-should-syntax-check (resource-file modes &rest errors)
 | 
				
			||||||
 | 
					  "Test a syntax check in RESOURCE-FILE with MODES.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					RESOURCE-FILE is the file to check.  MODES is a single major mode
 | 
				
			||||||
 | 
					symbol or a list thereof, specifying the major modes to syntax
 | 
				
			||||||
 | 
					check with.  If more than one major mode is specified, the test
 | 
				
			||||||
 | 
					is run for each mode separately, so if you give three major
 | 
				
			||||||
 | 
					modes, the entire test will run three times.  ERRORS is the list
 | 
				
			||||||
 | 
					of expected errors, as in `flycheck-ert-should-errors'.  If
 | 
				
			||||||
 | 
					omitted, the syntax check must not emit any errors.  The errors
 | 
				
			||||||
 | 
					are cleared after each test.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The syntax checker is selected via standard syntax checker
 | 
				
			||||||
 | 
					selection.  To test a specific checker, you need to set
 | 
				
			||||||
 | 
					`flycheck-checker' or `flycheck-disabled-checkers' accordingly
 | 
				
			||||||
 | 
					before using this predicate, depending on whether you want to use
 | 
				
			||||||
 | 
					manual or automatic checker selection.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					During the syntax check, configuration files of syntax checkers
 | 
				
			||||||
 | 
					are also searched in the `config-files' sub-directory of the
 | 
				
			||||||
 | 
					resource directory."
 | 
				
			||||||
 | 
					  (when (symbolp modes)
 | 
				
			||||||
 | 
					    (setq modes (list modes)))
 | 
				
			||||||
 | 
					  (dolist (mode modes)
 | 
				
			||||||
 | 
					    (unless (fboundp mode)
 | 
				
			||||||
 | 
					      (ert-skip (format "%S missing" mode)))
 | 
				
			||||||
 | 
					    (flycheck-ert-with-resource-buffer resource-file
 | 
				
			||||||
 | 
					      (funcall mode)
 | 
				
			||||||
 | 
					      (apply #'flycheck-ert-should-syntax-check-in-buffer errors))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun flycheck-ert-at-nth-error (n)
 | 
				
			||||||
 | 
					  "Determine whether point is at the N'th Flycheck error.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return non-nil if the point is at the N'th Flycheck error in the
 | 
				
			||||||
 | 
					current buffer.  Otherwise return nil."
 | 
				
			||||||
 | 
					  (let* ((error (nth (1- n) flycheck-current-errors))
 | 
				
			||||||
 | 
					         (mode flycheck-highlighting-mode)
 | 
				
			||||||
 | 
					         (region (flycheck-error-region-for-mode error mode)))
 | 
				
			||||||
 | 
					    (and (member error (flycheck-overlay-errors-at (point)))
 | 
				
			||||||
 | 
					         (= (point) (car region)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun flycheck-ert-explain--at-nth-error (n)
 | 
				
			||||||
 | 
					  "Explain a failed at-nth-error predicate at N."
 | 
				
			||||||
 | 
					  (let ((errors (flycheck-overlay-errors-at (point))))
 | 
				
			||||||
 | 
					    (if (null errors)
 | 
				
			||||||
 | 
					        (format "Expected to be at error %s, but no error at point %s"
 | 
				
			||||||
 | 
					                n (point))
 | 
				
			||||||
 | 
					      (let ((pos (cl-position (car errors) flycheck-current-errors)))
 | 
				
			||||||
 | 
					        (format "Expected to be at point %s and error %s, \
 | 
				
			||||||
 | 
					but point %s is at error %s"
 | 
				
			||||||
 | 
					                (car (flycheck-error-region-for-mode
 | 
				
			||||||
 | 
					                      (nth (1- n) flycheck-current-errors)
 | 
				
			||||||
 | 
					                      flycheck-highlighting-mode))
 | 
				
			||||||
 | 
					                n (point) (1+ pos))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(put 'flycheck-ert-at-nth-error 'ert-explainer
 | 
				
			||||||
 | 
					     'flycheck-ert-explain--at-nth-error)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(provide 'flycheck-ert)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; flycheck-ert.el ends here
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								elpa/flycheck-20200610.1809/flycheck-ert.elc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								elpa/flycheck-20200610.1809/flycheck-ert.elc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										16
									
								
								elpa/flycheck-20200610.1809/flycheck-pkg.el
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								elpa/flycheck-20200610.1809/flycheck-pkg.el
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,16 @@
 | 
				
			|||||||
 | 
					(define-package "flycheck" "20200610.1809" "On-the-fly syntax checking"
 | 
				
			||||||
 | 
					  '((dash "2.12.1")
 | 
				
			||||||
 | 
					    (pkg-info "0.4")
 | 
				
			||||||
 | 
					    (let-alist "1.0.4")
 | 
				
			||||||
 | 
					    (seq "1.11")
 | 
				
			||||||
 | 
					    (emacs "24.3"))
 | 
				
			||||||
 | 
					  :commit "c02cd773dded0215f9417ec04dfe8dabda63ef43" :keywords
 | 
				
			||||||
 | 
					  '("convenience" "languages" "tools")
 | 
				
			||||||
 | 
					  :authors
 | 
				
			||||||
 | 
					  '(("Sebastian Wiesner" . "swiesner@lunaryorn.com"))
 | 
				
			||||||
 | 
					  :maintainer
 | 
				
			||||||
 | 
					  '("Clément Pit-Claudel" . "clement.pitclaudel@live.com")
 | 
				
			||||||
 | 
					  :url "http://www.flycheck.org")
 | 
				
			||||||
 | 
					;; Local Variables:
 | 
				
			||||||
 | 
					;; no-byte-compile: t
 | 
				
			||||||
 | 
					;; End:
 | 
				
			||||||
							
								
								
									
										12332
									
								
								elpa/flycheck-20200610.1809/flycheck.el
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12332
									
								
								elpa/flycheck-20200610.1809/flycheck.el
									
									
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								elpa/flycheck-20200610.1809/flycheck.elc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								elpa/flycheck-20200610.1809/flycheck.elc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										127
									
								
								elpa/pkg-info-20150517.1143/pkg-info-autoloads.el
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										127
									
								
								elpa/pkg-info-20150517.1143/pkg-info-autoloads.el
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,127 @@
 | 
				
			|||||||
 | 
					;;; pkg-info-autoloads.el --- automatically extracted autoloads
 | 
				
			||||||
 | 
					;;
 | 
				
			||||||
 | 
					;;; Code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(add-to-list 'load-path (directory-file-name
 | 
				
			||||||
 | 
					                         (or (file-name-directory #$) (car load-path))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;### (autoloads nil "pkg-info" "pkg-info.el" (0 0 0 0))
 | 
				
			||||||
 | 
					;;; Generated autoloads from pkg-info.el
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(autoload 'pkg-info-library-original-version "pkg-info" "\
 | 
				
			||||||
 | 
					Get the original version in the header of LIBRARY.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The original version is stored in the X-Original-Version header.
 | 
				
			||||||
 | 
					This header is added by the MELPA package archive to preserve
 | 
				
			||||||
 | 
					upstream version numbers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					LIBRARY is either a symbol denoting a named feature, or a library
 | 
				
			||||||
 | 
					name as string.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If SHOW is non-nil, show the version in the minibuffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the version from the header of LIBRARY as list.  Signal an
 | 
				
			||||||
 | 
					error if the LIBRARY was not found or had no X-Original-Version
 | 
				
			||||||
 | 
					header.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					See Info node `(elisp)Library Headers' for more information
 | 
				
			||||||
 | 
					about library headers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\(fn LIBRARY &optional SHOW)" t nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(autoload 'pkg-info-library-version "pkg-info" "\
 | 
				
			||||||
 | 
					Get the version in the header of LIBRARY.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					LIBRARY is either a symbol denoting a named feature, or a library
 | 
				
			||||||
 | 
					name as string.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If SHOW is non-nil, show the version in the minibuffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the version from the header of LIBRARY as list.  Signal an
 | 
				
			||||||
 | 
					error if the LIBRARY was not found or had no proper header.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					See Info node `(elisp)Library Headers' for more information
 | 
				
			||||||
 | 
					about library headers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\(fn LIBRARY &optional SHOW)" t nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(autoload 'pkg-info-defining-library-original-version "pkg-info" "\
 | 
				
			||||||
 | 
					Get the original version of the library defining FUNCTION.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The original version is stored in the X-Original-Version header.
 | 
				
			||||||
 | 
					This header is added by the MELPA package archive to preserve
 | 
				
			||||||
 | 
					upstream version numbers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If SHOW is non-nil, show the version in mini-buffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This function is mainly intended to find the version of a major
 | 
				
			||||||
 | 
					or minor mode, i.e.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   (pkg-info-defining-library-version 'flycheck-mode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the version of the library defining FUNCTION.  Signal an
 | 
				
			||||||
 | 
					error if FUNCTION is not a valid function, if its defining
 | 
				
			||||||
 | 
					library was not found, or if the library had no proper version
 | 
				
			||||||
 | 
					header.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\(fn FUNCTION &optional SHOW)" t nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(autoload 'pkg-info-defining-library-version "pkg-info" "\
 | 
				
			||||||
 | 
					Get the version of the library defining FUNCTION.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If SHOW is non-nil, show the version in mini-buffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This function is mainly intended to find the version of a major
 | 
				
			||||||
 | 
					or minor mode, i.e.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   (pkg-info-defining-library-version 'flycheck-mode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the version of the library defining FUNCTION.  Signal an
 | 
				
			||||||
 | 
					error if FUNCTION is not a valid function, if its defining
 | 
				
			||||||
 | 
					library was not found, or if the library had no proper version
 | 
				
			||||||
 | 
					header.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\(fn FUNCTION &optional SHOW)" t nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(autoload 'pkg-info-package-version "pkg-info" "\
 | 
				
			||||||
 | 
					Get the version of an installed PACKAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If SHOW is non-nil, show the version in the minibuffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the version as list, or nil if PACKAGE is not installed.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\(fn PACKAGE &optional SHOW)" t nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(autoload 'pkg-info-version-info "pkg-info" "\
 | 
				
			||||||
 | 
					Obtain complete version info for LIBRARY and PACKAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					LIBRARY is a symbol denoting a named feature, or a library name
 | 
				
			||||||
 | 
					as string.  PACKAGE is a symbol denoting an ELPA package.  If
 | 
				
			||||||
 | 
					omitted or nil, default to LIBRARY.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If SHOW is non-nil, show the version in the minibuffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					When called interactively, prompt for LIBRARY.  When called
 | 
				
			||||||
 | 
					interactively with prefix argument, prompt for PACKAGE as well.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return a string with complete version information for LIBRARY.
 | 
				
			||||||
 | 
					This version information contains the version from the headers of
 | 
				
			||||||
 | 
					LIBRARY, and the version of the installed PACKAGE, the LIBRARY is
 | 
				
			||||||
 | 
					part of.  If PACKAGE is not installed, or if the PACKAGE version
 | 
				
			||||||
 | 
					is the same as the LIBRARY version, do not include a package
 | 
				
			||||||
 | 
					version.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					\(fn LIBRARY &optional PACKAGE SHOW)" t nil)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "pkg-info" '("pkg-info-")))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;***
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Local Variables:
 | 
				
			||||||
 | 
					;; version-control: never
 | 
				
			||||||
 | 
					;; no-byte-compile: t
 | 
				
			||||||
 | 
					;; no-update-autoloads: t
 | 
				
			||||||
 | 
					;; coding: utf-8
 | 
				
			||||||
 | 
					;; End:
 | 
				
			||||||
 | 
					;;; pkg-info-autoloads.el ends here
 | 
				
			||||||
							
								
								
									
										2
									
								
								elpa/pkg-info-20150517.1143/pkg-info-pkg.el
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								elpa/pkg-info-20150517.1143/pkg-info-pkg.el
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
				
			|||||||
 | 
					;;; -*- no-byte-compile: t -*-
 | 
				
			||||||
 | 
					(define-package "pkg-info" "20150517.1143" "Information about packages" '((epl "0.8")) :commit "76ba7415480687d05a4353b27fea2ae02b8d9d61" :keywords '("convenience") :authors '(("Sebastian Wiesner" . "swiesner@lunaryorn.com")) :maintainer '("Sebastian Wiesner" . "swiesner@lunaryorn.com") :url "https://github.com/lunaryorn/pkg-info.el")
 | 
				
			||||||
							
								
								
									
										332
									
								
								elpa/pkg-info-20150517.1143/pkg-info.el
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										332
									
								
								elpa/pkg-info-20150517.1143/pkg-info.el
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,332 @@
 | 
				
			|||||||
 | 
					;;; pkg-info.el --- Information about packages       -*- lexical-binding: t; -*-
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Copyright (C) 2013-2015  Sebastian Wiesner <swiesner@lunaryorn.com>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Author: Sebastian Wiesner <swiesner@lunaryorn.com>
 | 
				
			||||||
 | 
					;; URL: https://github.com/lunaryorn/pkg-info.el
 | 
				
			||||||
 | 
					;; Package-Version: 20150517.1143
 | 
				
			||||||
 | 
					;; Package-Commit: 76ba7415480687d05a4353b27fea2ae02b8d9d61
 | 
				
			||||||
 | 
					;; Keywords: convenience
 | 
				
			||||||
 | 
					;; Version: 0.7-cvs
 | 
				
			||||||
 | 
					;; Package-Requires: ((epl "0.8"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; This file is not part of GNU Emacs.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; This program 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 of the License, or
 | 
				
			||||||
 | 
					;; (at your option) any later version.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Commentary:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; This library extracts information from installed packages.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;; Functions:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; `pkg-info-library-version' extracts the version from the header of a library.
 | 
				
			||||||
 | 
					;;
 | 
				
			||||||
 | 
					;; `pkg-info-defining-library-version' extracts the version from the header of a
 | 
				
			||||||
 | 
					;;  library defining a function.
 | 
				
			||||||
 | 
					;;
 | 
				
			||||||
 | 
					;; `pkg-info-package-version' gets the version of an installed package.
 | 
				
			||||||
 | 
					;;
 | 
				
			||||||
 | 
					;; `pkg-info-format-version' formats a version list as human readable string.
 | 
				
			||||||
 | 
					;;
 | 
				
			||||||
 | 
					;; `pkg-info-version-info' returns complete version information for a specific
 | 
				
			||||||
 | 
					;; package.
 | 
				
			||||||
 | 
					;;
 | 
				
			||||||
 | 
					;; `pkg-info-get-melpa-recipe' gets the MELPA recipe for a package.
 | 
				
			||||||
 | 
					;;
 | 
				
			||||||
 | 
					;; `pkg-info-get-melpa-fetcher' gets the fetcher used to build a package on
 | 
				
			||||||
 | 
					;; MELPA.
 | 
				
			||||||
 | 
					;;
 | 
				
			||||||
 | 
					;; `pkg-info-wiki-package-p' determines whether a package was build from
 | 
				
			||||||
 | 
					;; EmacsWiki on MELPA.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Code:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(require 'epl)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(require 'lisp-mnt)
 | 
				
			||||||
 | 
					(require 'find-func)
 | 
				
			||||||
 | 
					(require 'json)                         ; `json-read'
 | 
				
			||||||
 | 
					(require 'url-http)                     ; `url-http-parse-response'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defvar url-http-end-of-headers)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; Version information
 | 
				
			||||||
 | 
					(defun pkg-info-format-version (version)
 | 
				
			||||||
 | 
					  "Format VERSION as human-readable string.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return a human-readable string representing VERSION."
 | 
				
			||||||
 | 
					  ;; XXX: Find a better, more flexible way of formatting?
 | 
				
			||||||
 | 
					  (package-version-join version))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defsubst pkg-info--show-version-and-return (version show)
 | 
				
			||||||
 | 
					  "Show and return VERSION.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					When SHOW is non-nil, show VERSION in minibuffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return VERSION."
 | 
				
			||||||
 | 
					  (when show
 | 
				
			||||||
 | 
					    (message (if (listp version) (pkg-info-format-version version) version)))
 | 
				
			||||||
 | 
					  version)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun pkg-info--read-library ()
 | 
				
			||||||
 | 
					  "Read a library from minibuffer."
 | 
				
			||||||
 | 
					  (completing-read "Load library: "
 | 
				
			||||||
 | 
					                   (apply-partially 'locate-file-completion-table
 | 
				
			||||||
 | 
					                                    load-path
 | 
				
			||||||
 | 
					                                    (get-load-suffixes))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun pkg-info--read-function ()
 | 
				
			||||||
 | 
					  "Read a function name from minibuffer."
 | 
				
			||||||
 | 
					  (let ((input (completing-read "Function: " obarray #'boundp :require-match)))
 | 
				
			||||||
 | 
					    (if (string= input "") nil (intern input))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun pkg-info--read-package ()
 | 
				
			||||||
 | 
					  "Read a package name from minibuffer."
 | 
				
			||||||
 | 
					  (let* ((installed (epl-installed-packages))
 | 
				
			||||||
 | 
					         (names (sort (mapcar (lambda (pkg)
 | 
				
			||||||
 | 
					                                (symbol-name (epl-package-name pkg)))
 | 
				
			||||||
 | 
					                              installed)
 | 
				
			||||||
 | 
					                      #'string<))
 | 
				
			||||||
 | 
					         (default (car names)))
 | 
				
			||||||
 | 
					    (completing-read "Installed package: " names nil 'require-match
 | 
				
			||||||
 | 
					                     nil nil default)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun pkg-info-library-source (library)
 | 
				
			||||||
 | 
					  "Get the source file of LIBRARY.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					LIBRARY is either a symbol denoting a named feature, or a library
 | 
				
			||||||
 | 
					name as string.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the source file of LIBRARY as string."
 | 
				
			||||||
 | 
					  (find-library-name (if (symbolp library) (symbol-name library) library)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun pkg-info-defining-library (function)
 | 
				
			||||||
 | 
					  "Get the source file of the library defining FUNCTION.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					FUNCTION is a function symbol.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the file name of the library as string.  Signal an error
 | 
				
			||||||
 | 
					if the library does not exist, or if the definition of FUNCTION
 | 
				
			||||||
 | 
					was not found."
 | 
				
			||||||
 | 
					  (unless (functionp function)
 | 
				
			||||||
 | 
					    (signal 'wrong-type-argument (list 'functionp function)))
 | 
				
			||||||
 | 
					  (let ((library (symbol-file function 'defun)))
 | 
				
			||||||
 | 
					    (unless library
 | 
				
			||||||
 | 
					      (error "Can't find definition of %s" function))
 | 
				
			||||||
 | 
					    library))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun pkg-info-x-original-version (file)
 | 
				
			||||||
 | 
					  "Read the X-Original-Version header from FILE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the value as version list, or return nil if FILE lacks
 | 
				
			||||||
 | 
					this header.  Signal an error, if the value of the header is not
 | 
				
			||||||
 | 
					a valid version."
 | 
				
			||||||
 | 
					  (let ((version-str (with-temp-buffer
 | 
				
			||||||
 | 
					                       (insert-file-contents file)
 | 
				
			||||||
 | 
					                       (lm-header "X-Original-Version"))))
 | 
				
			||||||
 | 
					    (when version-str
 | 
				
			||||||
 | 
					      (version-to-list version-str))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;###autoload
 | 
				
			||||||
 | 
					(defun pkg-info-library-original-version (library &optional show)
 | 
				
			||||||
 | 
					  "Get the original version in the header of LIBRARY.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The original version is stored in the X-Original-Version header.
 | 
				
			||||||
 | 
					This header is added by the MELPA package archive to preserve
 | 
				
			||||||
 | 
					upstream version numbers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					LIBRARY is either a symbol denoting a named feature, or a library
 | 
				
			||||||
 | 
					name as string.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If SHOW is non-nil, show the version in the minibuffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the version from the header of LIBRARY as list.  Signal an
 | 
				
			||||||
 | 
					error if the LIBRARY was not found or had no X-Original-Version
 | 
				
			||||||
 | 
					header.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					See Info node `(elisp)Library Headers' for more information
 | 
				
			||||||
 | 
					about library headers."
 | 
				
			||||||
 | 
					  (interactive (list (pkg-info--read-library) t))
 | 
				
			||||||
 | 
					  (let ((version (pkg-info-x-original-version
 | 
				
			||||||
 | 
					                  (pkg-info-library-source library))))
 | 
				
			||||||
 | 
					    (if version
 | 
				
			||||||
 | 
					        (pkg-info--show-version-and-return version show)
 | 
				
			||||||
 | 
					      (error "Library %s has no original version" library))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;###autoload
 | 
				
			||||||
 | 
					(defun pkg-info-library-version (library &optional show)
 | 
				
			||||||
 | 
					  "Get the version in the header of LIBRARY.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					LIBRARY is either a symbol denoting a named feature, or a library
 | 
				
			||||||
 | 
					name as string.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If SHOW is non-nil, show the version in the minibuffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the version from the header of LIBRARY as list.  Signal an
 | 
				
			||||||
 | 
					error if the LIBRARY was not found or had no proper header.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					See Info node `(elisp)Library Headers' for more information
 | 
				
			||||||
 | 
					about library headers."
 | 
				
			||||||
 | 
					  (interactive (list (pkg-info--read-library) t))
 | 
				
			||||||
 | 
					  (let* ((source (pkg-info-library-source library))
 | 
				
			||||||
 | 
					         (version (epl-package-version (epl-package-from-file source))))
 | 
				
			||||||
 | 
					    (pkg-info--show-version-and-return version show)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;###autoload
 | 
				
			||||||
 | 
					(defun pkg-info-defining-library-original-version (function &optional show)
 | 
				
			||||||
 | 
					  "Get the original version of the library defining FUNCTION.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					The original version is stored in the X-Original-Version header.
 | 
				
			||||||
 | 
					This header is added by the MELPA package archive to preserve
 | 
				
			||||||
 | 
					upstream version numbers.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If SHOW is non-nil, show the version in mini-buffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This function is mainly intended to find the version of a major
 | 
				
			||||||
 | 
					or minor mode, i.e.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   (pkg-info-defining-library-version 'flycheck-mode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the version of the library defining FUNCTION.  Signal an
 | 
				
			||||||
 | 
					error if FUNCTION is not a valid function, if its defining
 | 
				
			||||||
 | 
					library was not found, or if the library had no proper version
 | 
				
			||||||
 | 
					header."
 | 
				
			||||||
 | 
					  (interactive (list (pkg-info--read-function) t))
 | 
				
			||||||
 | 
					  (pkg-info-library-original-version (pkg-info-defining-library function) show))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;###autoload
 | 
				
			||||||
 | 
					(defun pkg-info-defining-library-version (function &optional show)
 | 
				
			||||||
 | 
					  "Get the version of the library defining FUNCTION.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If SHOW is non-nil, show the version in mini-buffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This function is mainly intended to find the version of a major
 | 
				
			||||||
 | 
					or minor mode, i.e.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					   (pkg-info-defining-library-version 'flycheck-mode)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the version of the library defining FUNCTION.  Signal an
 | 
				
			||||||
 | 
					error if FUNCTION is not a valid function, if its defining
 | 
				
			||||||
 | 
					library was not found, or if the library had no proper version
 | 
				
			||||||
 | 
					header."
 | 
				
			||||||
 | 
					  (interactive (list (pkg-info--read-function) t))
 | 
				
			||||||
 | 
					  (pkg-info-library-version (pkg-info-defining-library function) show))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;###autoload
 | 
				
			||||||
 | 
					(defun pkg-info-package-version (package &optional show)
 | 
				
			||||||
 | 
					  "Get the version of an installed PACKAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If SHOW is non-nil, show the version in the minibuffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return the version as list, or nil if PACKAGE is not installed."
 | 
				
			||||||
 | 
					  (interactive (list (pkg-info--read-package) t))
 | 
				
			||||||
 | 
					  (let* ((name (if (stringp package) (intern package) package))
 | 
				
			||||||
 | 
					         (package (car (epl-find-installed-packages name))))
 | 
				
			||||||
 | 
					    (unless package
 | 
				
			||||||
 | 
					      (error "Can't find installed package %s" name))
 | 
				
			||||||
 | 
					    (pkg-info--show-version-and-return (epl-package-version package) show)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;;###autoload
 | 
				
			||||||
 | 
					(defun pkg-info-version-info (library &optional package show)
 | 
				
			||||||
 | 
					  "Obtain complete version info for LIBRARY and PACKAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					LIBRARY is a symbol denoting a named feature, or a library name
 | 
				
			||||||
 | 
					as string.  PACKAGE is a symbol denoting an ELPA package.  If
 | 
				
			||||||
 | 
					omitted or nil, default to LIBRARY.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					If SHOW is non-nil, show the version in the minibuffer.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					When called interactively, prompt for LIBRARY.  When called
 | 
				
			||||||
 | 
					interactively with prefix argument, prompt for PACKAGE as well.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return a string with complete version information for LIBRARY.
 | 
				
			||||||
 | 
					This version information contains the version from the headers of
 | 
				
			||||||
 | 
					LIBRARY, and the version of the installed PACKAGE, the LIBRARY is
 | 
				
			||||||
 | 
					part of.  If PACKAGE is not installed, or if the PACKAGE version
 | 
				
			||||||
 | 
					is the same as the LIBRARY version, do not include a package
 | 
				
			||||||
 | 
					version."
 | 
				
			||||||
 | 
					  (interactive (list (pkg-info--read-library)
 | 
				
			||||||
 | 
					                     (when current-prefix-arg
 | 
				
			||||||
 | 
					                       (pkg-info--read-package))
 | 
				
			||||||
 | 
					                     t))
 | 
				
			||||||
 | 
					  (let* ((package (or package (if (stringp library) (intern library) library)))
 | 
				
			||||||
 | 
					         (orig-version (condition-case nil
 | 
				
			||||||
 | 
					                           (pkg-info-library-original-version library)
 | 
				
			||||||
 | 
					                         (error nil)))
 | 
				
			||||||
 | 
					         ;; If we have X-Original-Version, we assume that MELPA replaced the
 | 
				
			||||||
 | 
					         ;; library version with its generated version, so we use the
 | 
				
			||||||
 | 
					         ;; X-Original-Version header instead, and ignore the library version
 | 
				
			||||||
 | 
					         ;; header
 | 
				
			||||||
 | 
					         (lib-version (or orig-version (pkg-info-library-version library)))
 | 
				
			||||||
 | 
					         (pkg-version (condition-case nil
 | 
				
			||||||
 | 
					                          (pkg-info-package-version package)
 | 
				
			||||||
 | 
					                        (error nil)))
 | 
				
			||||||
 | 
					         (version (if (and pkg-version
 | 
				
			||||||
 | 
					                           (not (version-list-= lib-version pkg-version)))
 | 
				
			||||||
 | 
					                      (format "%s (package: %s)"
 | 
				
			||||||
 | 
					                              (pkg-info-format-version lib-version)
 | 
				
			||||||
 | 
					                              (pkg-info-format-version pkg-version))
 | 
				
			||||||
 | 
					                    (pkg-info-format-version lib-version))))
 | 
				
			||||||
 | 
					    (pkg-info--show-version-and-return version show)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defconst pkg-info-melpa-recipe-url "http://melpa.org/recipes.json"
 | 
				
			||||||
 | 
					  "The URL from which to fetch MELPA recipes.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defvar pkg-info-melpa-recipes nil
 | 
				
			||||||
 | 
					  "An alist of MELPA recipes.")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun pkg-info-retrieve-melpa-recipes ()
 | 
				
			||||||
 | 
					  "Retrieve MELPA recipes from MELPA archive."
 | 
				
			||||||
 | 
					  (let ((buffer (url-retrieve-synchronously pkg-info-melpa-recipe-url)))
 | 
				
			||||||
 | 
					    (with-current-buffer buffer
 | 
				
			||||||
 | 
					      (unwind-protect
 | 
				
			||||||
 | 
					          (let ((response-code (url-http-parse-response)))
 | 
				
			||||||
 | 
					            (unless (equal response-code 200)
 | 
				
			||||||
 | 
					              (error "Failed to retrieve MELPA recipes from %s (code %s)"
 | 
				
			||||||
 | 
					                     pkg-info-melpa-recipe-url response-code))
 | 
				
			||||||
 | 
					            (goto-char url-http-end-of-headers)
 | 
				
			||||||
 | 
					            (json-read))
 | 
				
			||||||
 | 
					        (when (and buffer (buffer-live-p buffer))
 | 
				
			||||||
 | 
					          (kill-buffer buffer))))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun pkg-info-get-melpa-recipes ()
 | 
				
			||||||
 | 
					  "Get MELPA recipes."
 | 
				
			||||||
 | 
					  (setq pkg-info-melpa-recipes
 | 
				
			||||||
 | 
					        (or pkg-info-melpa-recipes
 | 
				
			||||||
 | 
					            (pkg-info-retrieve-melpa-recipes))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun pkg-info-get-melpa-recipe (package)
 | 
				
			||||||
 | 
					  "Get the MELPA recipe for PACKAGE.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Return nil if PACKAGE is not on MELPA."
 | 
				
			||||||
 | 
					  (cdr (assq package (pkg-info-get-melpa-recipes))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun pkg-info-get-melpa-fetcher (package)
 | 
				
			||||||
 | 
					  "Get the MELPA fetcher for PACKAGE."
 | 
				
			||||||
 | 
					  (cdr (assq 'fetcher (pkg-info-get-melpa-recipe package))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(defun pkg-info-wiki-package-p (package)
 | 
				
			||||||
 | 
					  "Determine whether PACKAGE is build from the EmacsWiki."
 | 
				
			||||||
 | 
					  (equal (pkg-info-get-melpa-fetcher package) "wiki"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					(provide 'pkg-info)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;; Local Variables:
 | 
				
			||||||
 | 
					;; indent-tabs-mode: nil
 | 
				
			||||||
 | 
					;; coding: utf-8
 | 
				
			||||||
 | 
					;; End:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					;;; pkg-info.el ends here
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								elpa/pkg-info-20150517.1143/pkg-info.elc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								elpa/pkg-info-20150517.1143/pkg-info.elc
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -1,47 +0,0 @@
 | 
				
			|||||||
;;; windsize-autoloads.el --- automatically extracted autoloads
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
;;; Code:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(add-to-list 'load-path (directory-file-name
 | 
					 | 
				
			||||||
                         (or (file-name-directory #$) (car load-path))))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;;;### (autoloads nil "windsize" "windsize.el" (0 0 0 0))
 | 
					 | 
				
			||||||
;;; Generated autoloads from windsize.el
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(autoload 'windsize-left "windsize" "\
 | 
					 | 
				
			||||||
Resize the current window by moving one of its edges to the left.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
\(fn &optional ARG)" t nil)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(autoload 'windsize-right "windsize" "\
 | 
					 | 
				
			||||||
Resize the current window by moving one of its edges to the right.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
\(fn &optional ARG)" t nil)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(autoload 'windsize-up "windsize" "\
 | 
					 | 
				
			||||||
Resize the current window by moving one of its edges up.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
\(fn &optional ARG)" t nil)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(autoload 'windsize-down "windsize" "\
 | 
					 | 
				
			||||||
Resize the current window by moving one of its edges down.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
\(fn &optional ARG)" t nil)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(autoload 'windsize-default-keybindings "windsize" "\
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
\(fn)" t nil)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "windsize" '("windsize-")))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;;;***
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;; Local Variables:
 | 
					 | 
				
			||||||
;; version-control: never
 | 
					 | 
				
			||||||
;; no-byte-compile: t
 | 
					 | 
				
			||||||
;; no-update-autoloads: t
 | 
					 | 
				
			||||||
;; coding: utf-8
 | 
					 | 
				
			||||||
;; End:
 | 
					 | 
				
			||||||
;;; windsize-autoloads.el ends here
 | 
					 | 
				
			||||||
@@ -1,2 +0,0 @@
 | 
				
			|||||||
;;; -*- no-byte-compile: t -*-
 | 
					 | 
				
			||||||
(define-package "windsize" "20181029.2257" "Simple, intuitive window resizing" 'nil :commit "62c2846bbe95b0a73e996c75e4a644d05f57aaaa" :keywords '("window" "resizing" "convenience") :authors '(("Chris Perkins" . "chrisperkins99@gmail.com")) :maintainer '("Chris Perkins" . "chrisperkins99@gmail.com") :url "http://github.com/grammati/windsize")
 | 
					 | 
				
			||||||
@@ -1,145 +0,0 @@
 | 
				
			|||||||
;;; windsize.el --- Simple, intuitive window resizing
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;; Copyright (C) 2011 Chris Perkins
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
;; Author: Chris Perkins <chrisperkins99@gmail.com>
 | 
					 | 
				
			||||||
;; Created: 01 July, 2011
 | 
					 | 
				
			||||||
;; URL: http://github.com/grammati/windsize
 | 
					 | 
				
			||||||
;; Package-Version: 20181029.2257
 | 
					 | 
				
			||||||
;; Package-Commit: 62c2846bbe95b0a73e996c75e4a644d05f57aaaa
 | 
					 | 
				
			||||||
;; Version: 0.1
 | 
					 | 
				
			||||||
;; Keywords: window, resizing, convenience
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;; This file is not part of GNU Emacs.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;;; Commentary:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;; Use the arrow keys (C-S-<dir> by default) to move one of the
 | 
					 | 
				
			||||||
;; borders of the active window in that direction. Always prefers to
 | 
					 | 
				
			||||||
;; move the right or bottom border when possible, and falls back to
 | 
					 | 
				
			||||||
;; moving the left or top border otherwise.
 | 
					 | 
				
			||||||
;; 
 | 
					 | 
				
			||||||
;; Rather than me trying to explain that in detail, it's best to just
 | 
					 | 
				
			||||||
;; split your emacs frame in to several windows and try it - trust me,
 | 
					 | 
				
			||||||
;; it's intuitive once you give it a go.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;;; Usage
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;; (require 'windsize)
 | 
					 | 
				
			||||||
;; (windsize-default-keybindings) ; C-S-<left/right/up/down>
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
;; Or bind windsize-left, windsize-right, windsize-up, and
 | 
					 | 
				
			||||||
;; windsize-down to the keys you prefer.
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
;; By default, resizes by 8 columns and by 4 rows. Customize by
 | 
					 | 
				
			||||||
;; setting windsize-cols and/or windsize-rows.
 | 
					 | 
				
			||||||
;; Note that these variables are not buffer-local, since resizing
 | 
					 | 
				
			||||||
;; windows usually affects at least 2 buffers.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;;; License:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;; This program 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
 | 
					 | 
				
			||||||
;; of the License, or (at your option) any later version.
 | 
					 | 
				
			||||||
;;
 | 
					 | 
				
			||||||
;; This program 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.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;;; Code:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(require 'windmove)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(defcustom windsize-cols 8
 | 
					 | 
				
			||||||
  "How much to resize horizontally."
 | 
					 | 
				
			||||||
  :type 'integer
 | 
					 | 
				
			||||||
  :group 'windsize)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(defcustom windsize-rows 4
 | 
					 | 
				
			||||||
  "How much to resize vertically."
 | 
					 | 
				
			||||||
  :type 'integer
 | 
					 | 
				
			||||||
  :group 'windsize)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(defun windsize-is-horizontal (dir)
 | 
					 | 
				
			||||||
  (or (eq dir 'left) (eq dir 'right)))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(defun windsize-default-amount (dir)
 | 
					 | 
				
			||||||
  (if (windsize-is-horizontal dir)
 | 
					 | 
				
			||||||
      windsize-cols
 | 
					 | 
				
			||||||
    windsize-rows))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;; Find the window in direction dir, without wrap-around.
 | 
					 | 
				
			||||||
(defun windsize-find-other-window (dir)
 | 
					 | 
				
			||||||
  ;; Let windmove do all the hard work (but temporarily disable wrap-around)
 | 
					 | 
				
			||||||
  ;; OK, there has to be a macro for this pattern (it's 'binding' in
 | 
					 | 
				
			||||||
  ;; clojure), but I'm new to elisp...
 | 
					 | 
				
			||||||
  (let ((temp windmove-wrap-around))
 | 
					 | 
				
			||||||
    (setq windmove-wrap-around nil)
 | 
					 | 
				
			||||||
    (let ((other (windmove-find-other-window dir)))
 | 
					 | 
				
			||||||
      (setq windmove-wrap-around temp)
 | 
					 | 
				
			||||||
      (if (window-minibuffer-p other)
 | 
					 | 
				
			||||||
        nil
 | 
					 | 
				
			||||||
        other))))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(defun windsize-resize (dir &optional arg)
 | 
					 | 
				
			||||||
  ;; For right and down: check for a window right/down. If there is
 | 
					 | 
				
			||||||
  ;; one, enlarge, otherwise shrink. (case 1)
 | 
					 | 
				
			||||||
  ;; For left and up: check for a window in the opposite direction. If
 | 
					 | 
				
			||||||
  ;; there is one, shrink, otherwise enlarge. (case 2)
 | 
					 | 
				
			||||||
  ;; This is dictated somewhat by the behaviour of enlarge-window - it
 | 
					 | 
				
			||||||
  ;; seems to usually (but not always) move the right or bottom edge.
 | 
					 | 
				
			||||||
  (let* ((horiz? (windsize-is-horizontal dir))
 | 
					 | 
				
			||||||
         (pref?  (or (eq dir 'right) (eq dir 'down))) ; right/down are the
 | 
					 | 
				
			||||||
                                                      ; "preferred" directions
 | 
					 | 
				
			||||||
         (other  (windsize-find-other-window (if horiz? 'right 'down)))
 | 
					 | 
				
			||||||
         (num    (or arg (windsize-default-amount dir)))
 | 
					 | 
				
			||||||
         (amount (if (or
 | 
					 | 
				
			||||||
                      (and pref? other)              ; case 1, above
 | 
					 | 
				
			||||||
                      (and (not pref?) (not other))) ; case 2, above
 | 
					 | 
				
			||||||
                     num                             ; enlarge
 | 
					 | 
				
			||||||
                   (- num))))                        ; shrink
 | 
					 | 
				
			||||||
    (enlarge-window amount horiz?)))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;;;###autoload
 | 
					 | 
				
			||||||
(defun windsize-left (&optional arg)
 | 
					 | 
				
			||||||
  "Resize the current window by moving one of its edges to the left."
 | 
					 | 
				
			||||||
  (interactive "P")
 | 
					 | 
				
			||||||
  (windsize-resize 'left arg))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;;;###autoload
 | 
					 | 
				
			||||||
(defun windsize-right (&optional arg)
 | 
					 | 
				
			||||||
  "Resize the current window by moving one of its edges to the right."
 | 
					 | 
				
			||||||
  (interactive "P")
 | 
					 | 
				
			||||||
  (windsize-resize 'right arg))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;;;###autoload
 | 
					 | 
				
			||||||
(defun windsize-up (&optional arg)
 | 
					 | 
				
			||||||
  "Resize the current window by moving one of its edges up."
 | 
					 | 
				
			||||||
  (interactive "P")
 | 
					 | 
				
			||||||
  (windsize-resize 'up arg))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;;;###autoload
 | 
					 | 
				
			||||||
(defun windsize-down (&optional arg)
 | 
					 | 
				
			||||||
  "Resize the current window by moving one of its edges down."
 | 
					 | 
				
			||||||
  (interactive "P")
 | 
					 | 
				
			||||||
  (windsize-resize 'down arg))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;;;###autoload
 | 
					 | 
				
			||||||
(defun windsize-default-keybindings ()
 | 
					 | 
				
			||||||
  (interactive)
 | 
					 | 
				
			||||||
  (global-set-key (kbd "C-S-<left>")  'windsize-left)
 | 
					 | 
				
			||||||
  (global-set-key (kbd "C-S-<right>") 'windsize-right)
 | 
					 | 
				
			||||||
  (global-set-key (kbd "C-S-<up>")    'windsize-up)
 | 
					 | 
				
			||||||
  (global-set-key (kbd "C-S-<down>")  'windsize-down)
 | 
					 | 
				
			||||||
  )
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(provide 'windsize)
 | 
					 | 
				
			||||||
;;; windsize.el ends here
 | 
					 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										10
									
								
								init.el
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								init.el
									
									
									
									
									
								
							@@ -34,7 +34,7 @@
 | 
				
			|||||||
 '(magit-diff-use-overlays nil)
 | 
					 '(magit-diff-use-overlays nil)
 | 
				
			||||||
 '(package-selected-packages
 | 
					 '(package-selected-packages
 | 
				
			||||||
   (quote
 | 
					   (quote
 | 
				
			||||||
    (ac-emmet web-mode ac-html markdown-preview-mode multiple-cursors git-gutter powerline ample-zen-theme monokai-theme dracula-theme auto-complete windsize neotree all-the-icons spinner markdown-mode lv ht f evil dash-functional)))
 | 
					    (flycheck ac-emmet web-mode ac-html markdown-preview-mode multiple-cursors git-gutter powerline ample-zen-theme monokai-theme dracula-theme auto-complete neotree all-the-icons spinner markdown-mode lv ht f evil dash-functional)))
 | 
				
			||||||
 '(pos-tip-background-color "#FFFACE")
 | 
					 '(pos-tip-background-color "#FFFACE")
 | 
				
			||||||
 '(pos-tip-foreground-color "#272822")
 | 
					 '(pos-tip-foreground-color "#272822")
 | 
				
			||||||
 '(vc-annotate-background "#3b3b3b")
 | 
					 '(vc-annotate-background "#3b3b3b")
 | 
				
			||||||
@@ -106,12 +106,6 @@
 | 
				
			|||||||
    (display-line-numbers-mode -1))
 | 
					    (display-line-numbers-mode -1))
 | 
				
			||||||
(add-hook 'neo-after-create-hook 'my/disable-line-numbers)
 | 
					(add-hook 'neo-after-create-hook 'my/disable-line-numbers)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
;Cambiar el tamaño a las v entanas
 | 
					 | 
				
			||||||
(require 'windsize)
 | 
					 | 
				
			||||||
(setq windsize-cols 1)
 | 
					 | 
				
			||||||
(setq windsize-rows 1)
 | 
					 | 
				
			||||||
(add-hook 'after-init-hook #'windsize-default-keybindings)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
;Git gutter - Marca si 
 | 
					;Git gutter - Marca si 
 | 
				
			||||||
(global-git-gutter-mode +1)
 | 
					(global-git-gutter-mode +1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -122,7 +116,7 @@
 | 
				
			|||||||
(global-set-key (kbd "C-<") 'mc/mark-previous-like-this) ;Seleccionar anteriores como el actual
 | 
					(global-set-key (kbd "C-<") 'mc/mark-previous-like-this) ;Seleccionar anteriores como el actual
 | 
				
			||||||
(global-set-key (kbd "C-S-d") 'mc/mark-all-like-this) ;Seleccionar todos como el actual
 | 
					(global-set-key (kbd "C-S-d") 'mc/mark-all-like-this) ;Seleccionar todos como el actual
 | 
				
			||||||
(global-set-key (kbd "C-S-<mouse-1>") 'mc/add-cursor-on-click) ;Añadir cursor con clics
 | 
					(global-set-key (kbd "C-S-<mouse-1>") 'mc/add-cursor-on-click) ;Añadir cursor con clics
 | 
				
			||||||
 | 
					(toggle-scroll-bar -1) ;Eliminar barra de desplazamiento
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(require 'web-mode)
 | 
					(require 'web-mode)
 | 
				
			||||||
(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
 | 
					(add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode))
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user