Upgrade packages

This commit is contained in:
Marcus Kammer 2020-02-17 23:07:13 +01:00
parent 412b9e092a
commit 09a169f8c1
213 changed files with 2094 additions and 367 deletions

View file

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 43 KiB

View file

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View file

@ -1,4 +1,4 @@
(define-package "dashboard" "20200214.525" "A startup screen extracted from Spacemacs"
(define-package "dashboard" "20200217.1153" "A startup screen extracted from Spacemacs"
'((emacs "25.3")
(page-break-lines "0.11"))
:keywords

View file

@ -204,7 +204,8 @@ Optional prefix ARG says how many lines to move; default is one line."
(dashboard-insert-page-break)))
dashboard-items)
(when dashboard-center-content
(goto-char (car (last dashboard--section-starts)))
(when dashboard--section-starts
(goto-char (car (last dashboard--section-starts))))
(let ((margin (floor (/ (max (- (window-width) max-line-length) 0) 2))))
(while (not (eobp))
(and (not (eq ? (char-after)))

View file

@ -25,7 +25,7 @@
(require 'kubernetes)
(defcustom ein:k8s-name-deployment "jupyter-deployment"
(defcustom ein:k8s-name-deployment nil
"Regexp by which we recognize jupyter services."
:type 'string
:group 'ein)
@ -124,7 +124,7 @@
node))
(defsubst ein:k8s-ensure ()
(and (executable-find kubernetes-kubectl-executable)
(and ein:k8s-name-deployment (executable-find kubernetes-kubectl-executable)
(condition-case err
(progn
(ein:k8s-select-context)

View file

@ -57,10 +57,9 @@
(require 'ein-traceback)
(require 'ein-shared-output)
(require 'ein-notebooklist)
(require 'ob-ein)
(require 'poly-ein)
;;; Configuration
(declare-function ob-ein-anonymous-p "ob-ein")
(make-obsolete-variable 'ein:use-smartrep nil "0.17.0")

View file

@ -1,4 +1,4 @@
(define-package "ein" "20200215.1929" "Emacs IPython Notebook"
(define-package "ein" "20200217.1252" "Emacs IPython Notebook"
'((emacs "25")
(websocket "20190620.338")
(anaphora "20180618")

View file

@ -1,2 +0,0 @@
;;; -*- no-byte-compile: t -*-
(define-package "elisp-lint" "20200102.1550" "basic linting for Emacs Lisp" '((emacs "24")) :commit "f8316b84513261b17817006f5fcc25599d8e12b2" :keywords '("lisp" "maint" "tools") :authors '(("Nikolaj Schumacher <bugs * nschum de>,")) :maintainer '("Nikolaj Schumacher <bugs * nschum de>,") :url "http://github.com/gonewest818/elisp-lint/")

View file

@ -1,282 +0,0 @@
;;; elisp-lint.el --- basic linting for Emacs Lisp
;;
;; Copyright (C) 2013-2015 Nikolaj Schumacher
;; Copyright (C) 2018-2019 Neil Okamoto
;;
;; Author: Nikolaj Schumacher <bugs * nschum de>,
;; Author: Neil Okamoto <neil.okamoto+melpa@gmail.com>
;; Version: 0.4.0-SNAPSHOT
;; Package-Version: 20200102.1550
;; Keywords: lisp, maint, tools
;; Package-Requires: ((emacs "24"))
;; URL: http://github.com/gonewest818/elisp-lint/
;;
;; 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 2
;; 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 is a tool for finding certain problems in Emacs Lisp files. Use it on
;; the command line like this:
;;
;; $(EMACS) -Q --batch -l elisp-lint.el -f elisp-lint-files-batch *.el
;;
;; You can disable individual checks by passing flags on the command line:
;;
;; $(EMACS) -Q --batch -l elisp-lint.el -f elisp-lint-files-batch \
;; --no-indent *.el
;;
;; Alternatively, you can disable checks using file variables or the following
;; .dir-locals.el file:
;;
;; ((emacs-lisp-mode . ((elisp-lint-ignored-validators . ("fill-column")))))
;;
;; For a full list of validators, see `elisp-lint-file-validators' and
;; `elisp-lint-buffer-validators'.
;;
;;; Change Log:
;;
;; * Version 0.4-SNAPSHOT (available in MELPA)
;; - Provide a summary report of all tests [#20]
;; * Version 0.3 (MELPA Stable, as of December 2019)
;; - Emacs 23 support is deprecated [#13]
;; - Adopt CircleCI and drop Travis CI [#9] [#14]
;; - Add check-declare validator [#16]
;; - Generate autoloads before bytecompile [#8]
;; * Version 0.2 (Feb 2018)
;; - Project transferred to new maintainer
;; - Whitespace check permits page-delimiter (^L)
;; - Indentation check prints the diff to console
;; - User can specify indent specs to tell the checker about macros
;; - Added checkdoc (available only Emacs 25 and newer)
;; - Cleared up the console output for easier reading in CI
;; - Expand Travis CI test matrix to include Emacs 25 and 26
;; * Version 0.1 (2015)
;; - Basic linting functionality implemented
;;
;;; Code:
(require 'bytecomp)
(require 'check-declare)
(require 'checkdoc nil t)
(require 'package nil t)
(declare-function package-buffer-info "package" t)
(defconst elisp-lint-file-validators
(nconc '("byte-compile" "check-declare")
(when (fboundp 'checkdoc-file) '("checkdoc"))))
(defconst elisp-lint-buffer-validators
'("package-format" "indent" "indent-character" "fill-column"
"trailing-whitespace"))
(defvar elisp-lint-ignored-validators nil
"List of validators that should not be run.")
(put 'elisp-lint-ignored-validators 'safe-local-variable 'listp)
(defvar elisp-lint-indent-specs nil
"Alist of symbols and their indent specifiers.
The property 'lisp-indent-function will be set accordingly on
each of the provided symbols prior to running the indentation
check. Caller can set this variable as needed on the command
line or in \".dir-locals.el\". The alist should take the form
`((symbol1 . spec1) (symbol2 . spec2) ...)' where the specs are
identical to the `indent' declarations in defmacro.")
(put 'elisp-lint-indent-specs 'safe-local-variable 'listp)
(defmacro elisp-lint--protect (&rest body)
"Handle errors raised in BODY."
(declare (indent 0) (debug t))
`(condition-case err
(progn ,@body)
(error (message "%s" (error-message-string err)) nil)))
(defmacro elisp-lint--run (validator &rest args)
"Run the VALIDATOR with ARGS."
`(or (member ,validator elisp-lint-ignored-validators)
(progn
(message "* Run %s" ,validator)
(elisp-lint--protect (funcall
(intern (concat "elisp-lint--" ,validator))
,@args)))))
(defun elisp-lint--amend-ignored-validators-from-command-line ()
"Parse command line and find flags to disable specific validators."
(while (string-match "^--no-\\([a-z-]*\\)" (car command-line-args-left))
(add-to-list 'elisp-lint-ignored-validators
(match-string 1 (pop command-line-args-left)))))
;;; Validators
(defvar elisp-lint--autoloads-filename nil
"The autoloads file for this package.")
(defun elisp-lint--generate-autoloads ()
"Generate autoloads and set `elisp-lint--autoloads-filename`.
Assume `default-directory` name is also the package name,
e.g. for this package it will be \"elisp-lint-autoloads.el\"."
(let* ((dir (directory-file-name default-directory))
(prefix (file-name-nondirectory dir))
(pkg (intern prefix))
(load-prefer-newer t))
(package-generate-autoloads pkg dir)
(setq elisp-lint--autoloads-filename (format "%s-autoloads.el" prefix))))
(defun elisp-lint--byte-compile (file)
"Byte-compile FILE with warnings enabled.
Return nil if errors were found."
(let ((byte-compile-error-on-warn t)
(byte-compile-warnings t))
(unless elisp-lint--autoloads-filename
(elisp-lint--generate-autoloads))
(load-file elisp-lint--autoloads-filename)
(byte-compile-file file)))
(defun elisp-lint--check-declare (file)
"Validate `declare-function` statements in FILE."
(let ((errlist (check-declare-file file)))
(or (null errlist)
(error "Check-declare failed"))))
;; Checkdoc is available only Emacs 25 or newer
(when (fboundp 'checkdoc-file)
(defun elisp-lint--checkdoc (file)
"Run checkdoc on FILE and print the results.
Return nil if errors were found, else t."
(let* ((msgbuf (get-buffer "*Messages*"))
(tick (buffer-modified-tick msgbuf)))
(checkdoc-file file)
(or (equal tick (buffer-modified-tick msgbuf))
(error "Checkdoc failed")))))
(defun elisp-lint--package-format ()
"Call `package-buffer-info' to validate package metadata."
(or (null (require 'package nil t))
(package-buffer-info)))
(defun elisp-lint--indent ()
"Confirm buffer indentation is consistent with `emacs-lisp-mode'.
Use `indent-region' to format the entire buffer, and compare the
results to the filesystem. Print diffs if there are any
discrepancies. Prior to indenting the buffer, apply the settings
provided in `elisp-lint-indent-specs' to configure specific
symbols (typically macros) that require special handling."
(dolist (s elisp-lint-indent-specs)
(put (car s) 'lisp-indent-function (cdr s)))
(let ((tick (buffer-modified-tick)))
(indent-region (point-min) (point-max))
(or (equal tick (buffer-modified-tick))
(progn
(diff-buffer-with-file)
(with-current-buffer "*Diff*"
(message "%s" (buffer-string))
(kill-buffer))
(error "Indentation is incorrect")))))
(defun elisp-lint--indent-character ()
"Verify buffer indentation is consistent with `indent-tabs-mode`.
Use a file variable or \".dir-locals.el\" to override the default value."
(let ((lines nil)
(re (if indent-tabs-mode
(elisp-lint--not-tab-regular-expression)
"^\t"))
(msg (if indent-tabs-mode
"spaces instead of tabs"
"tabs instead of spaces")))
(save-excursion
(goto-char (point-min))
(while (re-search-forward re nil t)
(push (count-lines (point-min) (point)) lines)))
(or (null lines)
(error "Lines indented with %s: %s" msg
(elisp-lint--join-lines lines)))))
(defun elisp-lint--not-tab-regular-expression ()
"Regex to match a string of spaces with a length of `tab-width`."
(concat "^" (make-string tab-width ? )))
(defun elisp-lint--join-lines (line-numbers)
"Convert LINE-NUMBERS list into a comma delimited string."
(mapconcat (lambda (i) (format "#%d" i)) (sort line-numbers '<) ", "))
(defun elisp-lint--fill-column ()
"Confirm buffer has no lines exceeding `fill-column` in length.
Use a file variable or \".dir-locals.el\" to override the default value."
(save-excursion
(let ((line-number 1)
(too-long-lines nil))
(goto-char (point-min))
(while (not (eobp))
(goto-char (point-at-eol))
(when (> (current-column) fill-column)
(push line-number too-long-lines))
(setq line-number (1+ line-number))
(forward-line 1))
(or (null too-long-lines)
(error "Lines longer than %d characters: %s"
fill-column (elisp-lint--join-lines too-long-lines))))))
(defun elisp-lint--trailing-whitespace ()
"Confirm buffer has no line with trailing whitespace.
Allow `page-delimiter` if it is alone on a line."
(save-excursion
(let ((lines nil))
(goto-char (point-min))
(while (re-search-forward "[[:space:]]+$" nil t)
(unless (string-match-p
(concat page-delimiter "$") ; allow a solo page-delimiter
(buffer-substring-no-properties (line-beginning-position)
(line-end-position)))
(push (count-lines (point-min) (point)) lines)))
(or (null lines)
(error "Line numbers with trailing whitespace: %s"
(elisp-lint--join-lines (sort lines '<)))))))
;;; Linting
(defun elisp-lint-file (file)
"Run validators on FILE."
(with-temp-buffer
(find-file file)
(when elisp-lint-ignored-validators
(message "** Ignoring validators: %s"
(mapconcat 'identity elisp-lint-ignored-validators ", ")))
(let ((success t))
(mapc (lambda (validator)
(setq success (and (elisp-lint--run validator file) success)))
elisp-lint-file-validators)
(mapc (lambda (validator)
(setq success (and (elisp-lint--run validator) success)))
elisp-lint-buffer-validators)
success)))
(defun elisp-lint-files-batch ()
"Run validators on all files specified on the command line."
(elisp-lint--amend-ignored-validators-from-command-line)
(let ((success t))
(while command-line-args-left
(message "%s" (make-string 75 ?\*))
(message "** ELISP-LINT: check %s..." (car command-line-args-left))
(if (elisp-lint-file (car command-line-args-left))
(message "** ELISP-LINT: %s OK" (car command-line-args-left))
(message "** ELISP:LINT: %s FAIL" (car command-line-args-left))
(setq success nil))
(pop command-line-args-left))
(kill-emacs (if success 0 1))))
(provide 'elisp-lint)
;;; elisp-lint.el ends here

View file

@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "elisp-lint" "20200217.38" "Basic linting for Emacs Lisp" '((emacs "24.4") (dash "2.15.0") (package-lint "0.11")) :commit "ca06e89c10083a32cdf1567c82579828b3037444" :keywords '("lisp" "maint" "tools") :authors '(("Nikolaj Schumacher <bugs * nschum de>,")) :maintainer '("Nikolaj Schumacher <bugs * nschum de>,") :url "http://github.com/gonewest818/elisp-lint/")

View file

@ -0,0 +1,442 @@
;;; elisp-lint.el --- Basic linting for Emacs Lisp -*- lexical-binding:t -*-
;;
;; Copyright (C) 2013-2015 Nikolaj Schumacher
;; Copyright (C) 2018-2020 Neil Okamoto
;;
;; Author: Nikolaj Schumacher <bugs * nschum de>,
;; Author: Neil Okamoto <neil.okamoto+melpa@gmail.com>
;; Version: 0.4.0-SNAPSHOT
;; Package-Version: 20200217.38
;; Keywords: lisp, maint, tools
;; Package-Requires: ((emacs "24.4") (dash "2.15.0") (package-lint "0.11"))
;; URL: http://github.com/gonewest818/elisp-lint/
;;
;; 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 2
;; 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 is a tool for finding certain problems in Emacs Lisp files. Use it on
;; the command line like this:
;;
;; $(EMACS) -Q --batch -l elisp-lint.el -f elisp-lint-files-batch *.el
;;
;; You can disable individual checks by passing flags on the command line:
;;
;; $(EMACS) -Q --batch -l elisp-lint.el -f elisp-lint-files-batch \
;; --no-indent *.el
;;
;; Alternatively, you can disable checks using file variables or the following
;; .dir-locals.el file:
;;
;; ((emacs-lisp-mode . ((elisp-lint-ignored-validators . ("fill-column")))))
;;
;; For a full list of validators, see `elisp-lint-file-validators' and
;; `elisp-lint-buffer-validators'.
;;
;;; Change Log:
;;
;; * Version 0.4-SNAPSHOT (available in MELPA)
;; - Provide a summary report of all tests [#20]
;; - Integrate `package-lint' [#19]
;; - Remove `package-format', as `package-lint' covers the same
;; - Add dependency on `dash.el'
;; - Colorized output
;; * Version 0.3 (MELPA Stable, as of December 2019)
;; - Emacs 23 support is deprecated [#13]
;; - Adopt CircleCI and drop Travis CI [#9] [#14]
;; - Add `check-declare' validator [#16]
;; - Generate autoloads before byte-compile [#8]
;; * Version 0.2 (Feb 2018)
;; - Project transferred to new maintainer
;; - Whitespace check permits page-delimiter (^L)
;; - Indentation check prints the diff to console
;; - User can specify indent specs to tell the checker about macros
;; - Added `checkdoc' (available only Emacs 25 and newer)
;; - Cleared up the console output for easier reading in CI
;; - Expand Travis CI test matrix to include Emacs 25 and 26
;; * Version 0.1 (2015)
;; - Basic linting functionality implemented
;;
;;; Code:
(require 'bytecomp)
(require 'check-declare)
(require 'checkdoc nil t)
(require 'package-lint)
(require 'subr-x)
(require 'dash)
(defconst elisp-lint-file-validators
'("byte-compile"
"check-declare"))
(defconst elisp-lint-buffer-validators
(append (when (fboundp 'checkdoc-current-buffer)
'("checkdoc"))
'("package-lint"
"indent"
"indent-character"
"fill-column"
"trailing-whitespace")))
(defvar elisp-lint-ignored-validators nil
"List of validators that should not be run.")
(put 'elisp-lint-ignored-validators 'safe-local-variable 'listp)
(defvar elisp-lint-batch-files nil
"List of files to be processed in batch execution.")
(defvar elisp-lint-indent-specs nil
"Alist of symbols and their indent specifiers.
The property 'lisp-indent-function will be set accordingly on
each of the provided symbols prior to running the indentation
check. Caller can set this variable as needed on the command
line or in \".dir-locals.el\". The alist should take the form
`((symbol1 . spec1) (symbol2 . spec2) ...)' where the specs are
identical to the `indent' declarations in defmacro.")
(put 'elisp-lint-indent-specs 'safe-local-variable 'listp)
(defvar elisp-lint--debug nil
"Toggle when debugging interactively for extra warnings, etc.")
(defmacro elisp-lint--protect (&rest body)
"Handle errors raised in BODY."
(declare (indent 0) (debug t))
`(condition-case err
(progn ,@body)
(error (message "%s" (error-message-string err)) nil)))
(defmacro elisp-lint--run (validator &rest args)
"Run the VALIDATOR with ARGS."
`(unless (member ,validator elisp-lint-ignored-validators)
(let ((v (elisp-lint--protect
(funcall (intern (concat "elisp-lint--" ,validator)) ,@args))))
(copy-tree v)))) ;; TODO: is deep copy necessary?
(defun elisp-lint--handle-argv ()
"Parse command line and find flags to disable specific validators.
Push results to `elisp-lint-ignored-validators' and `elisp-lint-batch-files'."
(dolist (option command-line-args-left)
(cond ((string-match "^--no-\\([a-z-]*\\)" option)
(add-to-list 'elisp-lint-ignored-validators
(substring-no-properties option 5)))
(t (add-to-list 'elisp-lint-batch-files option))))
(setq command-line-args-left nil)) ; empty this. we've handled all.
;;; Validators
(defvar elisp-lint--autoloads-filename nil
"The autoloads file for this package.")
(defun elisp-lint--generate-autoloads ()
"Generate autoloads and set `elisp-lint--autoloads-filename`.
Assume `default-directory` name is also the package name,
e.g. for this package it will be \"elisp-lint-autoloads.el\"."
(let* ((dir (directory-file-name default-directory))
(prefix (file-name-nondirectory dir))
(pkg (intern prefix))
(load-prefer-newer t))
(package-generate-autoloads pkg dir)
(setq elisp-lint--autoloads-filename (format "%s-autoloads.el" prefix))))
(defun elisp-lint--byte-compile (file)
"Byte-compile FILE with warnings enabled.
Return nil if errors were found."
(let ((comp-log "*Compile-Log*")
(lines nil)
(byte-compile-warnings t))
(unless elisp-lint--autoloads-filename
(elisp-lint--generate-autoloads))
(load-file elisp-lint--autoloads-filename)
(when (get-buffer comp-log) (kill-buffer comp-log))
(byte-compile-file file)
(with-current-buffer comp-log
(goto-char (point-min))
(beginning-of-line 3) ; skip header lines
(while (not (eobp))
(let ((item (split-string
(buffer-substring-no-properties
(line-beginning-position)
(line-end-position))
":")))
(push (list (string-to-number (nth 1 item)) ; LINE
(string-to-number (nth 2 item)) ; COL
'byte-compile ; TYPE
(string-trim ; MSG
(mapconcat #'identity (cdddr item) ":")))
lines)
(beginning-of-line 2))))
lines))
(defun elisp-lint--check-declare (file)
"Validate `declare-function` statements in FILE."
(let ((errlist (check-declare-file file)))
(mapcar
(lambda (item)
;; check-declare-file returns a list of items containing, from
;; left to right, the name of the library where `declare-function'
;; said to find the definition, followed by a list of the filename
;; we are currently linting, the function name being looked up,
;; and the error returned by `check-declare-file':
;;
;; ((".../path/to/library1.el.gz" ("foo.el" "func1" "err message"))
;; (".../path/to/library2.el.gz" ("foo.el" "func2" "err message"))
;; ...
;; (".../path/to/libraryN.el.gz" ("foo.el" "funcN" "err message")))
;;
;; For now we don't get line numbers for warnings, but the
;; `declare-function' lines are easy for the user to find.
(list 0 0 'check-declare
(format "(declare-function) %s: \"%s\" in file \"%s\""
(car (cddadr item))
(cadadr item)
(car item))))
errlist)))
;; Checkdoc is available only Emacs 25 or newer
(when (fboundp 'checkdoc-current-buffer)
(defun elisp-lint--checkdoc ()
"Run checkdoc on the current buffer.
Parse warnings and return in a list, or nil if no errors found."
(let ((style-buf "*Style Warnings*")
(lines nil))
(when (get-buffer style-buf) (kill-buffer style-buf))
(checkdoc-current-buffer t)
(with-current-buffer style-buf
(goto-char (point-min))
(beginning-of-line 5) ; skip empty lines and ^L
(while (not (eobp))
(let ((item (split-string
(buffer-substring-no-properties
(line-beginning-position) (line-end-position))
":")))
(push (list (string-to-number (nth 1 item)) ; LINE
0 ; COLUMN
'checkdoc ; TYPE
(string-trim
(mapconcat #'identity (cddr item) ":"))) ; MSG
lines)
(beginning-of-line 2))))
lines)))
(defun elisp-lint--package-lint ()
"Run package-lint on buffer and return results.
Result is a list of one item per line having an error, and each
entry contains: (LINE COLUMN TYPE MESSAGE)"
(package-lint-buffer))
(defun elisp-lint--next-diff ()
"Search via regexp for the next diff in the current buffer.
We expect this buffer to contain the output of \"diff -C 0\" and
that the point is advancing through the buffer as it is parsed.
Here we know each diff entry will be formatted like this if the
indentation problem occurs in an isolated line:
***************
*** 195 ****
! (let ((tick (buffer-modified-tick)))
--- 195 ----
! (let ((tick (buffer-modified-tick)))
or formatted like this if there is a series of lines:
***************
*** 195,196 ****
! (let ((tick (buffer-modified-tick)))
! (indent-region (point-min) (point-max))
--- 195,196 ----
! (let ((tick (buffer-modified-tick)))
! (indent-region (point-min) (point-max))
So we will search for the asterisks and line numbers. Return a
list containing the range of line numbers for this next
diff. Return nil if no more diffs found in the buffer."
(when (re-search-forward
"^\\*\\*\\* \\([0-9]+\\),*\\([0-9]*\\) \\*\\*\\*\\*$" nil t)
(let* ((r1 (string-to-number (match-string-no-properties 1)))
(r2 (match-string-no-properties 2))
(r2 (if (equal r2 "") r1 (string-to-number r2))))
(beginning-of-line 2) ; leave point at start of next line
(number-sequence r1 r2))))
(defun elisp-lint--indent ()
"Confirm buffer indentation is consistent with `emacs-lisp-mode'.
Use `indent-region' to format the entire buffer, and compare the
results to the filesystem. Return a list of diffs if there are
any discrepancies. Prior to indenting the buffer, apply the
settings provided in `elisp-lint-indent-specs' to configure
specific symbols (typically macros) that require special
handling. Result is a list of one item per line having an error,
and each entry contains: (LINE COLUMN TYPE MESSAGE)"
(dolist (s elisp-lint-indent-specs)
(put (car s) 'lisp-indent-function (cdr s)))
(let ((tick (buffer-modified-tick))
(errlist nil))
(indent-region (point-min) (point-max))
(unless (equal tick (buffer-modified-tick))
(let ((diff-switches "-C 0")) (diff-buffer-with-file))
(revert-buffer t t) ; revert indent changes
(with-current-buffer "*Diff*"
(goto-char (point-min))
(while (not (eobp))
(let ((line-range (elisp-lint--next-diff)))
(if line-range
(mapc (lambda (linenum) ; loop over the range and report
(push (list linenum 0 'indent
(buffer-substring-no-properties
(line-beginning-position)
(line-end-position))) errlist)
(beginning-of-line 2)) ; next line
line-range)
(goto-char (point-max)))))
(kill-buffer)))
errlist))
(defun elisp-lint--indent-character ()
"Verify buffer indentation is consistent with `indent-tabs-mode`.
Use a file variable or \".dir-locals.el\" to override the default value."
(let ((lines nil)
(re (if indent-tabs-mode
(elisp-lint--not-tab-regular-expression)
"^\t"))
(msg (if indent-tabs-mode
"spaces instead of tabs"
"tabs instead of spaces")))
(save-excursion
(goto-char (point-min))
(while (re-search-forward re nil t)
(push (list (count-lines (point-min) (point))
0 'indent-character msg) lines)))
lines))
(defun elisp-lint--not-tab-regular-expression ()
"Regex to match a string of spaces with a length of `tab-width`."
(concat "^" (make-string tab-width ? )))
(defun elisp-lint--fill-column ()
"Confirm buffer has no lines exceeding `fill-column` in length.
Use a file variable or \".dir-locals.el\" to override the default value."
(save-excursion
(let ((line-number 1)
(too-long-lines nil))
(goto-char (point-min))
(while (not (eobp))
(goto-char (point-at-eol))
(when (> (current-column) fill-column)
(push (list line-number 0 'fill-column
(format "line length %s exceeded" fill-column))
too-long-lines))
(setq line-number (1+ line-number))
(forward-line 1))
too-long-lines)))
(defun elisp-lint--trailing-whitespace ()
"Confirm buffer has no line with trailing whitespace.
Allow `page-delimiter` if it is alone on a line."
(save-excursion
(let ((lines nil))
(goto-char (point-min))
(while (re-search-forward "[[:space:]]+$" nil t)
(unless (string-match-p
(concat page-delimiter "$") ; allow a solo page-delimiter
(buffer-substring-no-properties (line-beginning-position)
(line-end-position)))
(push (list (count-lines (point-min) (point)) 0
'whitespace "trailing whitespace found")
lines)))
lines)))
;;; Colorized output
;; Derived from similar functionality in buttercup.el
;; whose implementation is also licensed under the GPL:
;; https://github.com/jorgenschaefer/emacs-buttercup/
(defconst elisp-lint--ansi-colors
'((black . 30)
(red . 31)
(green . 32)
(yellow . 33)
(blue . 34)
(magenta . 35)
(cyan . 36)
(white . 37))
"ANSI color escape codes.")
(defun elisp-lint--print (color fmt &rest args)
"Print output text in COLOR, formatted according to FMT and ARGS."
(let ((ansi-val (cdr (assoc color elisp-lint--ansi-colors)))
(cfmt (concat "\u001b[%sm" fmt "\u001b[0m")))
(princ (apply #'format cfmt ansi-val args))
(terpri)))
;;; Linting
(defun elisp-lint-file (file)
"Run validators on FILE."
(with-temp-buffer
(find-file file)
(let ((warnings (-concat (-mapcat (lambda (validator)
(elisp-lint--run validator file))
elisp-lint-file-validators)
(-mapcat (lambda (validator)
(elisp-lint--run validator))
elisp-lint-buffer-validators))))
(mapc (lambda (w)
;; TODO: with two passes we could exactly calculate the number of
;; spaces to indent after the filenames and line numbers.
(elisp-lint--print 'cyan "%-32s %s"
(format "%s:%d:%d (%s)"
file (nth 0 w) (nth 1 w) (nth 2 w))
(nth 3 w)))
(sort warnings (lambda (x y) (< (car x) (car y)))))
(not warnings))))
(defun elisp-lint-files-batch ()
"Run validators on all files specified on the command line."
(elisp-lint--handle-argv)
(when elisp-lint--debug
(elisp-lint--print 'cyan "files: %s"
elisp-lint-batch-files)
(elisp-lint--print 'cyan "ignored: %s"
elisp-lint-ignored-validators)
(elisp-lint--print 'cyan "file validators: %s"
elisp-lint-file-validators)
(elisp-lint--print 'cyan "buffer validators: %s"
elisp-lint-buffer-validators))
(let ((success t))
(dolist (file elisp-lint-batch-files)
(if (elisp-lint-file file)
(elisp-lint--print 'green "%s OK" file)
(elisp-lint--print 'red "%s FAIL" file)
(setq success nil)))
(unless elisp-lint--debug (kill-emacs (if success 0 1)))))
;; ELISP>
;; (let ((command-line-args-left '("--no-byte-compile"
;; "--no-package-format"
;; "--no-checkdoc"
;; "--no-check-declare"
;; "example.el")))
;; (setq elisp-lint-ignored-validators nil
;; elisp-lint-file-validators nil
;; elisp-lint-buffer-validators nil
;; elisp-lint-batch-files nil)
;; (elisp-lint-files-batch))
(provide 'elisp-lint)
;;; elisp-lint.el ends here

Binary file not shown.

View file

@ -0,0 +1 @@
Good signature from 066DAFCB81E42C40 GNU ELPA Signing Agent (2019) <elpasign@elpa.gnu.org> (trust undefined) created at 2019-09-21T19:55:43+0200 using RSA

View file

@ -0,0 +1,55 @@
;;; let-alist-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "let-alist" "let-alist.el" (0 0 0 0))
;;; Generated autoloads from let-alist.el
(autoload 'let-alist "let-alist" "\
Let-bind dotted symbols to their cdrs in ALIST and execute BODY.
Dotted symbol is any symbol starting with a `.'. Only those present
in BODY are let-bound and this search is done at compile time.
For instance, the following code
(let-alist alist
(if (and .title .body)
.body
.site
.site.contents))
essentially expands to
(let ((.title (cdr (assq \\='title alist)))
(.body (cdr (assq \\='body alist)))
(.site (cdr (assq \\='site alist)))
(.site.contents (cdr (assq \\='contents (cdr (assq \\='site alist))))))
(if (and .title .body)
.body
.site
.site.contents))
If you nest `let-alist' invocations, the inner one can't access
the variables of the outer one. You can, however, access alists
inside the original alist by using dots inside the symbol, as
displayed in the example above.
\(fn ALIST &rest BODY)" nil t)
(function-put 'let-alist 'lisp-indent-function '1)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "let-alist" '("let-alist--")))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; let-alist-autoloads.el ends here

View file

@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "let-alist" "1.0.6" "Easily let-bind values of an assoc-list by their names" '((emacs "24.1")) :url "http://elpa.gnu.org/packages/let-alist.html" :keywords '("extensions" "lisp") :authors '(("Artur Malabarba" . "emacs@endlessparentheses.com")) :maintainer '("Artur Malabarba" . "emacs@endlessparentheses.com"))

View file

@ -0,0 +1,184 @@
;;; let-alist.el --- Easily let-bind values of an assoc-list by their names -*- lexical-binding: t; -*-
;; Copyright (C) 2014-2019 Free Software Foundation, Inc.
;; Author: Artur Malabarba <emacs@endlessparentheses.com>
;; Package-Requires: ((emacs "24.1"))
;; Version: 1.0.6
;; Keywords: extensions lisp
;; Prefix: let-alist
;; Separator: -
;; This is an Elpa :core package. Don't use functionality that is not
;; compatible with Emacs 24.1.
;; This file is part of GNU Emacs.
;; GNU Emacs 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.
;; GNU Emacs 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. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; This package offers a single macro, `let-alist'. This macro takes a
;; first argument (whose value must be an alist) and a body.
;;
;; The macro expands to a let form containing body, where each dotted
;; symbol inside body is let-bound to their cdrs in the alist. Dotted
;; symbol is any symbol starting with a `.'. Only those present in
;; the body are let-bound and this search is done at compile time.
;;
;; For instance, the following code
;;
;; (let-alist alist
;; (if (and .title .body)
;; .body
;; .site
;; .site.contents))
;;
;; essentially expands to
;;
;; (let ((.title (cdr (assq 'title alist)))
;; (.body (cdr (assq 'body alist)))
;; (.site (cdr (assq 'site alist)))
;; (.site.contents (cdr (assq 'contents (cdr (assq 'site alist))))))
;; (if (and .title .body)
;; .body
;; .site
;; .site.contents))
;;
;; If you nest `let-alist' invocations, the inner one can't access
;; the variables of the outer one. You can, however, access alists
;; inside the original alist by using dots inside the symbol, as
;; displayed in the example above by the `.site.contents'.
;;
;;; Code:
(defun let-alist--deep-dot-search (data)
"Return alist of symbols inside DATA that start with a `.'.
Perform a deep search and return an alist where each car is the
symbol, and each cdr is the same symbol without the `.'."
(cond
((symbolp data)
(let ((name (symbol-name data)))
(when (string-match "\\`\\." name)
;; Return the cons cell inside a list, so it can be appended
;; with other results in the clause below.
(list (cons data (intern (replace-match "" nil nil name)))))))
((vectorp data)
(apply #'nconc (mapcar #'let-alist--deep-dot-search data)))
((not (consp data)) nil)
((eq (car data) 'let-alist)
;; For nested let-alist forms, ignore symbols appearing in the
;; inner body because they dont refer to the alist currently
;; being processed. See Bug#24641.
(let-alist--deep-dot-search (cadr data)))
(t (append (let-alist--deep-dot-search (car data))
(let-alist--deep-dot-search (cdr data))))))
(defun let-alist--access-sexp (symbol variable)
"Return a sexp used to access SYMBOL inside VARIABLE."
(let* ((clean (let-alist--remove-dot symbol))
(name (symbol-name clean)))
(if (string-match "\\`\\." name)
clean
(let-alist--list-to-sexp
(mapcar #'intern (nreverse (split-string name "\\.")))
variable))))
(defun let-alist--list-to-sexp (list var)
"Turn symbols LIST into recursive calls to `cdr' `assq' on VAR."
`(cdr (assq ',(car list)
,(if (cdr list) (let-alist--list-to-sexp (cdr list) var)
var))))
(defun let-alist--remove-dot (symbol)
"Return SYMBOL, sans an initial dot."
(let ((name (symbol-name symbol)))
(if (string-match "\\`\\." name)
(intern (replace-match "" nil nil name))
symbol)))
;;; The actual macro.
;;;###autoload
(defmacro let-alist (alist &rest body)
"Let-bind dotted symbols to their cdrs in ALIST and execute BODY.
Dotted symbol is any symbol starting with a `.'. Only those present
in BODY are let-bound and this search is done at compile time.
For instance, the following code
(let-alist alist
(if (and .title .body)
.body
.site
.site.contents))
essentially expands to
(let ((.title (cdr (assq \\='title alist)))
(.body (cdr (assq \\='body alist)))
(.site (cdr (assq \\='site alist)))
(.site.contents (cdr (assq \\='contents (cdr (assq \\='site alist))))))
(if (and .title .body)
.body
.site
.site.contents))
If you nest `let-alist' invocations, the inner one can't access
the variables of the outer one. You can, however, access alists
inside the original alist by using dots inside the symbol, as
displayed in the example above."
(declare (indent 1) (debug t))
(let ((var (make-symbol "alist")))
`(let ((,var ,alist))
(let ,(mapcar (lambda (x) `(,(car x) ,(let-alist--access-sexp (car x) var)))
(delete-dups (let-alist--deep-dot-search body)))
,@body))))
;;;; ChangeLog:
;; 2015-12-01 Artur Malabarba <bruce.connor.am@gmail.com>
;;
;; packages/let-alist: Define it as a :core package
;;
;; 2015-06-11 Artur Malabarba <bruce.connor.am@gmail.com>
;;
;; * let-alist (let-alist--deep-dot-search): Fix cons
;;
;; 2015-03-07 Artur Malabarba <bruce.connor.am@gmail.com>
;;
;; let-alist: Update copyright
;;
;; 2014-12-22 Artur Malabarba <bruce.connor.am@gmail.com>
;;
;; packages/let-alist: Use `make-symbol' instead of `gensym'.
;;
;; 2014-12-20 Artur Malabarba <bruce.connor.am@gmail.com>
;;
;; packages/let-alist: Enable access to deeper alists
;;
;; 2014-12-14 Artur Malabarba <bruce.connor.am@gmail.com>
;;
;; let-alist.el: Add lexical binding. Version bump.
;;
;; 2014-12-11 Artur Malabarba <bruce.connor.am@gmail.com>
;;
;; let-alist: New package
;;
(provide 'let-alist)
;;; let-alist.el ends here

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more