This commit is contained in:
Raymundo Vásquez Ruiz
2019-12-01 19:55:19 +01:00
parent db783b92af
commit b62e260b24
460 changed files with 21878 additions and 4341 deletions

View File

@@ -193,6 +193,18 @@
("Artur Malabarba" . "emacs@endlessparentheses.com"))
(:maintainer "Artur Malabarba" . "emacs@endlessparentheses.com")
(:url . "https://github.com/Malabarba/beacon"))])
(bluetooth .
[(0 1 2)
((emacs
(25 1))
(dash
(2 12 0)))
"A Major mode for Bluetooth devices" single
((:keywords "hardware")
(:authors
("Raffael Stocker" . "r.stocker@mnet-mail.de"))
(:maintainer "Raffael Stocker" . "r.stocker@mnet-mail.de")
(:url . "https://gitlab.com/rstocker/emacs-bluetooth"))])
(bnf-mode .
[(0 4 2)
((cl-lib
@@ -433,13 +445,11 @@
("Daiki Ueno" . "ueno@gnu.org"))
(:maintainer nil . "emacs-devel@gnu.org"))])
(debbugs .
[(0 20)
[(0 21)
((emacs
(25 1))
(soap-client
(3 1 5))
(cl-lib
(0 5)))
(3 1 5)))
"SOAP library to access debbugs servers" tar
((:maintainer "Michael Albinus" . "michael.albinus@gmx.de")
(:authors
@@ -615,7 +625,7 @@
(:maintainer "Markus Triska" . "triska@metalevel.at")
(:url . "https://www.metalevel.at/ediprolog/"))])
(eev .
[(20190902)
[(20191105)
((emacs
(24 1)))
"Support for e-scripts (eepitch blocks, elisp hyperlinks, etc)" tar
@@ -1017,12 +1027,12 @@
(:maintainer "Clemens Radermacher" . "clemera@posteo.net")
(:url . "https://github.com/clemera/ivy-explorer"))])
(javaimp .
[(0 6 1)
nil "Add and reorder Java import statements in Maven projects" tar
[(0 7 1)
nil "Add and reorder Java import statements in Maven/Gradle projects" tar
((:maintainer "Filipp Gunbin" . "fgunbin@fastmail.fm")
(:authors
("Filipp Gunbin" . "fgunbin@fastmail.fm"))
(:keywords "java" "maven" "programming")
(:keywords "java" "maven" "gradle" "programming")
(:url . "http://elpa.gnu.org/packages/javaimp.html"))])
(jgraph-mode .
[(1 1)
@@ -1059,7 +1069,7 @@
("Simen Heggestøyl" . "simenheg@gmail.com"))
(:maintainer "Simen Heggestøyl" . "simenheg@gmail.com"))])
(jsonrpc .
[(1 0 7)
[(1 0 8)
((emacs
(25 2)))
"JSON-RPC library" single
@@ -1499,7 +1509,7 @@
("Phillip Lord" . "phillip.lord@russet.org.uk"))
(:url . "http://elpa.gnu.org/packages/persist.html"))])
(phps-mode .
[(0 3 5)
[(0 3 19)
((emacs
(26)))
"Major mode for PHP with Semantic integration" tar
@@ -1573,7 +1583,7 @@
(:maintainer "Toby Cubitt" . "toby-predictive@dr-qubit.org")
(:url . "http://www.dr-qubit.org/emacs.php"))])
(rainbow-mode .
[(1 0 1)
[(1 0 2)
nil "Colorize color names in buffers" single
((:url . "http://elpa.gnu.org/packages/rainbow-mode.html")
(:keywords "faces")
@@ -1924,7 +1934,7 @@
("Felix E. Klee" . "felix.klee@inka.de"))
(:maintainer "Lars Magne Ingebrigtsen" . "larsi@gnus.org"))])
(svg-clock .
[(1 0)
[(1 1)
((svg
(0 1))
(emacs
@@ -1992,7 +2002,7 @@
("Oleh Krehel" . "ohwoeowho@gmail.com"))
(:keywords "convenience"))])
(tramp .
[(2 4 2 4)
[(2 4 2 5)
((emacs
(24 4)))
"Transparent Remote Access, Multiple Protocol" tar
@@ -2101,7 +2111,7 @@
(:maintainer "Justin Burkett" . "justin@burkett.cc")
(:url . "https://github.com/justbur/emacs-vdiff"))])
(verilog-mode .
[(2019 9 23 4801067)
[(2019 11 21 248091482)
nil "major mode for editing verilog source in Emacs" single
((:keywords "languages")
(:authors
@@ -2189,7 +2199,7 @@
("Pierre Neidhardt" . "mail@ambrevar.xyz"))
(:keywords "news" "hypermedia" "blog" "feed" "rss" "atom"))])
(websocket .
[(1 11 1)
[(1 12)
((cl-lib
(0 5)))
"Emacs WebSocket client and server" tar

View File

@@ -1 +1 @@
Good signature from 066DAFCB81E42C40 GNU ELPA Signing Agent (2019) <elpasign@elpa.gnu.org> (trust undefined) created at 2019-11-02T10:10:05+0100 using RSA
Good signature from 066DAFCB81E42C40 GNU ELPA Signing Agent (2019) <elpasign@elpa.gnu.org> (trust undefined) created at 2019-11-09T11:05:07+0100 using RSA

File diff suppressed because it is too large Load Diff

View File

@@ -47,7 +47,7 @@
;; they get compiled asynchronously, so this conservative default value is
;; here to make sure that the mode can be enabled without the user's
;; explicit consent.
'(async helm helm-core helm-ls-git helm-ls-hg magit)
'(async forge helm helm-core helm-ls-git helm-ls-hg magit)
"Packages in this list will be compiled asynchronously by `package--compile'.
All the dependencies of these packages will be compiled async too,
so no need to add dependencies to this list.

View File

@@ -1,4 +1,4 @@
(define-package "async" "20191009.1018" "Asynchronous processing in Emacs" 'nil :keywords
(define-package "async" "20191030.2138" "Asynchronous processing in Emacs" 'nil :keywords
'("async")
:url "https://github.com/jwiegley/emacs-async")
;; Local Variables:

View File

@@ -173,6 +173,14 @@ Cargo: This command allows you to add a dependency to a Cargo.toml manifest file
\(fn CRATE)" t nil)
(autoload 'cargo-process-audit "cargo-process" "\
Run the Cargo audit command.
With the prefix argument, modify the command's invocation.
Cargo: Audit checks the current project's Cargo.lock for security vulnerabilities.
Requires Cargo Audit to be installed.
\(fn)" t nil)
(autoload 'cargo-process-rm "cargo-process" "\
Run the Cargo rm command.
With the prefix argument, modify the command's invocation.

View File

@@ -1,4 +1,4 @@
(define-package "cargo" "20190902.754" "Emacs Minor Mode for Cargo, Rust's Package Manager."
(define-package "cargo" "20191121.1116" "Emacs Minor Mode for Cargo, Rust's Package Manager."
'((emacs "24.3")
(rust-mode "0.2.0")
(markdown-mode "2.4"))

View File

@@ -46,6 +46,7 @@
;; * cargo-process-rm - Run the optional cargo command rm.
;; * cargo-process-upgrade - Run the optional cargo command upgrade.
;; * cargo-process-outdated - Run the optional cargo command outdated.
;; * cargo-process-audit - Run the optional cargo command audit.
;;
;;; Code:
@@ -90,7 +91,7 @@
"Keymap for Cargo major mode.")
(defvar cargo-process--no-manifest-commands
'("New" "Init" "Search" "Fmt")
'("New" "Init" "Search" "Fmt" "Audit")
"These commands should not specify a manifest file.")
(defvar cargo-process-last-command nil "Command used last for repeating.")
@@ -163,6 +164,9 @@
(defcustom cargo-process--command-upgrade "upgrade"
"Subcommand used by `cargo-process-upgrade'.")
(defcustom cargo-process--command-audit "audit -f"
"Subcommand used by `cargo-process-audit'.")
(defvar cargo-process-favorite-crates nil)
(defface cargo-process--ok-face
@@ -624,6 +628,17 @@ Cargo: This command allows you to add a dependency to a Cargo.toml manifest file
" "
crate)))
;;;###autoload
(defun cargo-process-audit ()
"Run the Cargo audit command.
With the prefix argument, modify the command's invocation.
Cargo: Audit checks the current project's Cargo.lock for security vulnerabilities.
Requires Cargo Audit to be installed."
(interactive)
(cargo-process--start "Audit" (concat cargo-process--command-audit
" "
(cargo-process--project-root "Cargo.lock"))))
;;;###autoload
(defun cargo-process-rm (crate)
"Run the Cargo rm command.

View File

@@ -47,6 +47,7 @@
;; * C-c C-c C-a - cargo-process-add
;; * C-c C-c C-D - cargo-process-rm
;; * C-c C-c C-U - cargo-process-upgrade
;; * C-c C-c C-A - cargo-process-audit
;;
;;; Code:
@@ -90,6 +91,7 @@
(define-key cargo-minor-mode-map (kbd "C-c C-c C-a") 'cargo-process-add)
(define-key cargo-minor-mode-map (kbd "C-c C-c C-S-d") 'cargo-process-rm)
(define-key cargo-minor-mode-map (kbd "C-c C-c C-S-u") 'cargo-process-upgrade)
(define-key cargo-minor-mode-map (kbd "C-c C-c C-S-a") 'cargo-process-audit)
(provide 'cargo)
;;; cargo.el ends here

View File

@@ -1,6 +1,6 @@
;;; company-capf.el --- company-mode completion-at-point-functions backend -*- lexical-binding: t -*-
;; Copyright (C) 2013-2018 Free Software Foundation, Inc.
;; Copyright (C) 2013-2019 Free Software Foundation, Inc.
;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
@@ -32,6 +32,7 @@
(require 'company)
(require 'cl-lib)
;; Amortizes several calls to a c-a-p-f from the same position.
(defvar company--capf-cache nil)
;; FIXME: Provide a way to save this info once in Company itself
@@ -39,7 +40,11 @@
(defvar-local company-capf--current-completion-data nil
"Value last returned by `company-capf' when called with `candidates'.
For most properties/actions, this is just what we need: the exact values
that accompanied the completion table that's currently is use.")
that accompanied the completion table that's currently is use.
`company-capf', however, could be called at some different positions during
a completion session (most importantly, by `company-sort-by-occurrence'),
so we can't just use the preceding variable instead.")
(defun company--capf-data ()
(let ((cache company--capf-cache))
@@ -191,7 +196,7 @@ that accompanied the completion table that's currently is use.")
;; FIXME: Should probably use an additional heuristic:
;; completion-at-point doesn't know when the user picked a
;; particular candidate explicitly (it only checks whether
;; futher completions exist). Whereas company user can press
;; further completions exist). Whereas company user can press
;; RET (or use implicit completion with company-tng).
(if (eq (try-completion arg table pred) t)
'finished 'sole)))))

View File

@@ -1,4 +1,4 @@
(define-package "company" "20191029.2116" "Modular text completion framework"
(define-package "company" "20191127.16" "Modular text completion framework"
'((emacs "24.3"))
:keywords
'("abbrev" "convenience" "matching")

View File

@@ -415,7 +415,8 @@ non-prefix completion.
anything not offered as a candidate. Please don't use that value in normal
backends. The default value nil gives the user that choice with
`company-require-match'. Return value `never' overrides that option the
other way around.
other way around (using that value will indicate that the returned set of
completions is often incomplete, so this behavior will not be useful).
`init': Called once for each buffer. The backend can check for external
programs and files and load any required libraries. Raising an error here
@@ -553,7 +554,7 @@ This can also be a function."
(defcustom company-auto-complete-chars '(?\ ?\) ?.)
"Determines which characters trigger auto-completion.
See `company-auto-complete'. If this is a string, each string character
tiggers auto-completion. If it is a list of syntax description characters (see
triggers auto-completion. If it is a list of syntax description characters (see
`modify-syntax-entry'), all characters with that syntax auto-complete.
This can also be a function, which is called with the new input and should
@@ -2271,7 +2272,8 @@ character, stripping the modifiers. That character must be a digit."
(erase-buffer)
(when string
(save-excursion
(insert string)))
(insert string)
(visual-line-mode)))
(current-buffer)))
(defvar company--electric-saved-window-configuration nil)
@@ -3037,7 +3039,7 @@ Delay is determined by `company-tooltip-idle-delay'."
pto
(char-before pos)
(eq pos (overlay-start pto)))))
;; Try to accomodate for the pseudo-tooltip overlay,
;; Try to accommodate for the pseudo-tooltip overlay,
;; which may start at the same position if it's at eol.
(when ptf-workaround
(cl-decf beg)

View File

@@ -1,2 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "dash" "20191024.1908" "A modern list library for Emacs" 'nil :commit "9631947f2fbeed58b1d07a3ebc1340a3626b2823" :keywords '("lists") :authors '(("Magnar Sveen" . "magnars@gmail.com")) :maintainer '("Magnar Sveen" . "magnars@gmail.com"))
(define-package "dash" "20191109.1327" "A modern list library for Emacs" 'nil :commit "e85ed7aa93ef0959b630607bca17af90c74b34be" :keywords '("lists") :authors '(("Magnar Sveen" . "magnars@gmail.com")) :maintainer '("Magnar Sveen" . "magnars@gmail.com"))

View File

@@ -4,7 +4,7 @@
;; Author: Magnar Sveen <magnars@gmail.com>
;; Version: 2.16.0
;; Package-Version: 20191024.1908
;; Package-Version: 20191109.1327
;; Keywords: lists
;; This program is free software; you can redistribute it and/or modify
@@ -404,7 +404,7 @@ See also: `-remove', `-map-last'"
(defalias '--reject-last '--remove-last)
(defun -remove-item (item list)
"Remove all occurences of ITEM from LIST.
"Remove all occurrences of ITEM from LIST.
Comparison is done with `equal'."
(declare (pure t) (side-effect-free t))
@@ -504,7 +504,7 @@ See also: `-replace-at'"
(--map-when (equal it old) new list))
(defun -replace-first (old new list)
"Replace the first occurence of OLD with NEW in LIST.
"Replace the first occurrence of OLD with NEW in LIST.
Elements are compared using `equal'.
@@ -513,7 +513,7 @@ See also: `-map-first'"
(--map-first (equal old it) new list))
(defun -replace-last (old new list)
"Replace the last occurence of OLD with NEW in LIST.
"Replace the last occurrence of OLD with NEW in LIST.
Elements are compared using `equal'.
@@ -1273,7 +1273,10 @@ If two lists are provided as arguments, return the groupings as a list
of cons cells. Otherwise, return the groupings as a list of lists.
Please note! This distinction is being removed in an upcoming 3.0
release of Dash. If you rely on this behavior, use -zip-pair instead."
release of Dash. If you rely on this behavior, use `-zip-pair` instead,
which will retain that behaviour in future versions.
Alias: `-zip-pair'"
(declare (pure t) (side-effect-free t))
(when lists
(let (results)
@@ -1282,7 +1285,7 @@ release of Dash. If you rely on this behavior, use -zip-pair instead."
(setq lists (mapcar 'cdr lists)))
(setq results (nreverse results))
(if (= (length lists) 2)
;; to support backward compatability, return
;; to support backward compatibility, return
;; a cons cell if two lists were provided
(--map (cons (car it) (cadr it)) results)
results))))
@@ -1537,7 +1540,8 @@ VARIABLE to the result of the first form, and so forth."
(defmacro -some-> (x &optional form &rest more)
"When expr is non-nil, thread it through the first form (via `->'),
and when that result is non-nil, through the next form, etc."
(declare (debug ->))
(declare (debug ->)
(indent 1))
(if (null form) x
(let ((result (make-symbol "result")))
`(-some-> (-when-let (,result ,x)
@@ -1547,7 +1551,8 @@ and when that result is non-nil, through the next form, etc."
(defmacro -some->> (x &optional form &rest more)
"When expr is non-nil, thread it through the first form (via `->>'),
and when that result is non-nil, through the next form, etc."
(declare (debug ->))
(declare (debug ->)
(indent 1))
(if (null form) x
(let ((result (make-symbol "result")))
`(-some->> (-when-let (,result ,x)
@@ -1557,7 +1562,8 @@ and when that result is non-nil, through the next form, etc."
(defmacro -some--> (x &optional form &rest more)
"When expr in non-nil, thread it through the first form (via `-->'),
and when that result is non-nil, through the next form, etc."
(declare (debug ->))
(declare (debug ->)
(indent 1))
(if (null form) x
(let ((result (make-symbol "result")))
`(-some--> (-when-let (,result ,x)

View File

@@ -1,22 +0,0 @@
;;; deferred-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "deferred" "deferred.el" (0 0 0 0))
;;; Generated autoloads from deferred.el
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "deferred" '("deferred:")))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; deferred-autoloads.el ends here

View File

@@ -1,2 +0,0 @@
;;; -*- no-byte-compile: t -*-
(define-package "deferred" "20170901.1330" "Simple asynchronous functions for emacs lisp" '((emacs "24.4")) :commit "2239671d94b38d92e9b28d4e12fd79814cfb9c16" :keywords '("deferred" "async") :authors '(("SAKURAI Masashi <m.sakurai at kiwanami.net>")) :maintainer '("SAKURAI Masashi <m.sakurai at kiwanami.net>") :url "https://github.com/kiwanami/emacs-deferred")

View File

@@ -1,972 +0,0 @@
;;; deferred.el --- Simple asynchronous functions for emacs lisp -*- lexical-binding: t; -*-
;; Copyright (C) 2010-2016 SAKURAI Masashi
;; Author: SAKURAI Masashi <m.sakurai at kiwanami.net>
;; Version: 0.5.1
;; Package-Version: 20170901.1330
;; Keywords: deferred, async
;; Package-Requires: ((emacs "24.4"))
;; URL: https://github.com/kiwanami/emacs-deferred
;; 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:
;; 'deferred.el' is a simple library for asynchronous tasks.
;; [https://github.com/kiwanami/emacs-deferred]
;; The API is almost the same as JSDeferred written by cho45. See the
;; JSDeferred and Mochikit.Async web sites for further documentations.
;; [https://github.com/cho45/jsdeferred]
;; [http://mochikit.com/doc/html/MochiKit/Async.html]
;; A good introduction document (JavaScript)
;; [http://cho45.stfuawsc.com/jsdeferred/doc/intro.en.html]
;;; Samples:
;; ** HTTP Access
;; (require 'url)
;; (deferred:$
;; (deferred:url-retrieve "http://www.gnu.org")
;; (deferred:nextc it
;; (lambda (buf)
;; (insert (with-current-buffer buf (buffer-string)))
;; (kill-buffer buf))))
;; ** Invoking command tasks
;; (deferred:$
;; (deferred:process "wget" "-O" "a.jpg" "http://www.gnu.org/software/emacs/tour/images/splash.png")
;; (deferred:nextc it
;; (lambda (x) (deferred:process "convert" "a.jpg" "-resize" "100x100" "jpg:b.jpg")))
;; (deferred:nextc it
;; (lambda (x)
;; (insert-image (create-image (expand-file-name "b.jpg") 'jpeg nil)))))
;; See the readme for further API documentation.
;; ** Applications
;; *Inertial scrolling for Emacs
;; [https://github.com/kiwanami/emacs-inertial-scroll]
;; This program makes simple multi-thread function, using
;; deferred.el.
(require 'cl-lib)
(require 'subr-x)
(declare-function pp-display-expression 'pp)
(defvar deferred:version nil "deferred.el version")
(setq deferred:version "0.5.0")
;;; Code:
(defmacro deferred:aand (test &rest rest)
"[internal] Anaphoric AND."
(declare (debug ("test" form &rest form)))
`(let ((it ,test))
(if it ,(if rest `(deferred:aand ,@rest) 'it))))
(defmacro deferred:$ (&rest elements)
"Anaphoric function chain macro for deferred chains."
(declare (debug (&rest form)))
`(let (it)
,@(cl-loop for i in elements
collect
`(setq it ,i))
it))
(defmacro deferred:lambda (args &rest body)
"Anaphoric lambda macro for self recursion."
(declare (debug ("args" form &rest form)))
(let ((argsyms (cl-loop repeat (length args) collect (cl-gensym))))
`(lambda (,@argsyms)
(let (self)
(setq self (lambda( ,@args ) ,@body))
(funcall self ,@argsyms)))))
(cl-defmacro deferred:try (d &key catch finally)
"Try-catch-finally macro. This macro simulates the
try-catch-finally block asynchronously. CATCH and FINALLY can be
nil. Because of asynchrony, this macro does not ensure that the
task FINALLY should be called."
(let ((chain
(if catch `((deferred:error it ,catch)))))
(when finally
(setq chain (append chain `((deferred:watch it ,finally)))))
`(deferred:$ ,d ,@chain)))
(defun deferred:setTimeout (f msec)
"[internal] Timer function that emulates the `setTimeout' function in JS."
(run-at-time (/ msec 1000.0) nil f))
(defun deferred:cancelTimeout (id)
"[internal] Timer cancellation function that emulates the `cancelTimeout' function in JS."
(cancel-timer id))
(defun deferred:run-with-idle-timer (sec f)
"[internal] Wrapper function for run-with-idle-timer."
(run-with-idle-timer sec nil f))
(defun deferred:call-lambda (f &optional arg)
"[internal] Call a function with one or zero argument safely.
The lambda function can define with zero and one argument."
(condition-case err
(funcall f arg)
('wrong-number-of-arguments
(display-warning 'deferred "\
Callback that takes no argument may be specified.
Passing callback with no argument is deprecated.
Callback must take one argument.
Or, this error is coming from somewhere inside of the callback: %S" err)
(condition-case nil
(funcall f)
('wrong-number-of-arguments
(signal 'wrong-number-of-arguments (cdr err))))))) ; return the first error
;; debug
(eval-and-compile
(defvar deferred:debug nil "Debug output switch."))
(defvar deferred:debug-count 0 "[internal] Debug output counter.")
(defmacro deferred:message (&rest args)
"[internal] Debug log function."
(when deferred:debug
`(progn
(with-current-buffer (get-buffer-create "*deferred:debug*")
(save-excursion
(goto-char (point-max))
(insert (format "%5i %s\n" deferred:debug-count (format ,@args)))))
(cl-incf deferred:debug-count))))
(defun deferred:message-mark ()
"[internal] Debug log function."
(interactive)
(deferred:message "==================== mark ==== %s"
(format-time-string "%H:%M:%S" (current-time))))
(defun deferred:pp (d)
(require 'pp)
(deferred:$
(deferred:nextc d
(lambda (x)
(pp-display-expression x "*deferred:pp*")))
(deferred:error it
(lambda (e)
(pp-display-expression e "*deferred:pp*")))
(deferred:nextc it
(lambda (_x) (pop-to-buffer "*deferred:pp*")))))
(defvar deferred:debug-on-signal nil
"If non nil, the value `debug-on-signal' is substituted this
value in the `condition-case' form in deferred
implementations. Then, Emacs debugger can catch an error occurred
in the asynchronous tasks.")
(defmacro deferred:condition-case (var protected-form &rest handlers)
"[internal] Custom condition-case. See the comment for
`deferred:debug-on-signal'."
(declare (debug condition-case)
(indent 2))
`(let ((debug-on-signal
(or debug-on-signal deferred:debug-on-signal)))
(condition-case ,var
,protected-form
,@handlers)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Back end functions of deferred tasks
(defvar deferred:tick-time 0.001
"Waiting time between asynchronous tasks (second).
The shorter waiting time increases the load of Emacs. The end
user can tune this parameter. However, applications should not
modify it because the applications run on various environments.")
(defvar deferred:queue nil
"[internal] The execution queue of deferred objects.
See the functions `deferred:post-task' and `deferred:worker'.")
(defmacro deferred:pack (a b c)
`(cons ,a (cons ,b ,c)))
(defun deferred:schedule-worker ()
"[internal] Schedule consuming a deferred task in the execution queue."
(run-at-time deferred:tick-time nil 'deferred:worker))
(defun deferred:post-task (d which &optional arg)
"[internal] Add a deferred object to the execution queue
`deferred:queue' and schedule to execute.
D is a deferred object. WHICH is a symbol, `ok' or `ng'. ARG is
an argument value for execution of the deferred task."
(push (deferred:pack d which arg) deferred:queue)
(deferred:message "QUEUE-POST [%s]: %s"
(length deferred:queue) (deferred:pack d which arg))
(deferred:schedule-worker)
d)
(defun deferred:clear-queue ()
"Clear the execution queue. For test and debugging."
(interactive)
(deferred:message "QUEUE-CLEAR [%s -> 0]" (length deferred:queue))
(setq deferred:queue nil))
(defun deferred:worker ()
"[internal] Consume a deferred task.
Mainly this function is called by timer asynchronously."
(when deferred:queue
(let* ((pack (car (last deferred:queue)))
(d (car pack))
(which (cadr pack))
(arg (cddr pack)) value)
(setq deferred:queue (nbutlast deferred:queue))
(condition-case err
(setq value (deferred:exec-task d which arg))
(error
(deferred:message "ERROR : %s" err)
(message "deferred error : %s" err)))
value)))
(defun deferred:flush-queue! ()
"Call all deferred tasks synchronously. For test and debugging."
(let (value)
(while deferred:queue
(setq value (deferred:worker)))
value))
(defun deferred:sync! (d)
"Wait for the given deferred task. For test and debugging.
Error is raised if it is not processed within deferred chain D."
(progn
(let ((last-value 'deferred:undefined*)
uncaught-error)
(deferred:try
(deferred:nextc d
(lambda (x) (setq last-value x)))
:catch
(lambda (err) (setq uncaught-error err)))
(while (and (eq 'deferred:undefined* last-value)
(not uncaught-error))
(sit-for 0.05)
(sleep-for 0.05))
(when uncaught-error
(deferred:resignal uncaught-error))
last-value)))
;; Struct: deferred
;;
;; callback : a callback function (default `deferred:default-callback')
;; errorback : an errorback function (default `deferred:default-errorback')
;; cancel : a canceling function (default `deferred:default-cancel')
;; next : a next chained deferred object (default nil)
;; status : if 'ok or 'ng, this deferred has a result (error) value. (default nil)
;; value : saved value (default nil)
;;
(cl-defstruct deferred
(callback 'deferred:default-callback)
(errorback 'deferred:default-errorback)
(cancel 'deferred:default-cancel)
next status value)
(defun deferred:default-callback (i)
"[internal] Default callback function."
(identity i))
(defun deferred:default-errorback (err)
"[internal] Default errorback function."
(deferred:resignal err))
(defun deferred:resignal (err)
"[internal] Safely resignal ERR as an Emacs condition.
If ERR is a cons (ERROR-SYMBOL . DATA) where ERROR-SYMBOL has an
`error-conditions' property, it is re-signaled unchanged. If ERR
is a string, it is signaled as a generic error using `error'.
Otherwise, ERR is formatted into a string as if by `print' before
raising with `error'."
(cond ((and (listp err)
(symbolp (car err))
(get (car err) 'error-conditions))
(signal (car err) (cdr err)))
((stringp err)
(error "%s" err))
(t
(error "%S" err))))
(defun deferred:default-cancel (d)
"[internal] Default canceling function."
(deferred:message "CANCEL : %s" d)
(setf (deferred-callback d) 'deferred:default-callback)
(setf (deferred-errorback d) 'deferred:default-errorback)
(setf (deferred-next d) nil)
d)
(defvar deferred:onerror nil
"Default error handler. This value is nil or a function that
have one argument for the error message.")
(defun deferred:exec-task (d which &optional arg)
"[internal] Executing deferred task. If the deferred object has
next deferred task or the return value is a deferred object, this
function adds the task to the execution queue.
D is a deferred object. WHICH is a symbol, `ok' or `ng'. ARG is
an argument value for execution of the deferred task."
(deferred:message "EXEC : %s / %s / %s" d which arg)
(when (null d) (error "deferred:exec-task was given a nil."))
(let ((callback (if (eq which 'ok)
(deferred-callback d)
(deferred-errorback d)))
(next-deferred (deferred-next d)))
(cond
(callback
(deferred:condition-case err
(let ((value (deferred:call-lambda callback arg)))
(cond
((deferred-p value)
(deferred:message "WAIT NEST : %s" value)
(if next-deferred
(deferred:set-next value next-deferred)
value))
(t
(if next-deferred
(deferred:post-task next-deferred 'ok value)
(setf (deferred-status d) 'ok)
(setf (deferred-value d) value)
value))))
(error
(cond
(next-deferred
(deferred:post-task next-deferred 'ng err))
(deferred:onerror
(deferred:call-lambda deferred:onerror err))
(t
(deferred:message "ERROR : %S" err)
(message "deferred error : %S" err)
(setf (deferred-status d) 'ng)
(setf (deferred-value d) err)
err)))))
(t ; <= (null callback)
(cond
(next-deferred
(deferred:exec-task next-deferred which arg))
((eq which 'ok) arg)
(t ; (eq which 'ng)
(deferred:resignal arg)))))))
(defun deferred:set-next (prev next)
"[internal] Connect deferred objects."
(setf (deferred-next prev) next)
(cond
((eq 'ok (deferred-status prev))
(setf (deferred-status prev) nil)
(let ((ret (deferred:exec-task
next 'ok (deferred-value prev))))
(if (deferred-p ret) ret
next)))
((eq 'ng (deferred-status prev))
(setf (deferred-status prev) nil)
(let ((ret (deferred:exec-task next 'ng (deferred-value prev))))
(if (deferred-p ret) ret
next)))
(t
next)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Basic functions for deferred objects
(defun deferred:new (&optional callback)
"Create a deferred object."
(if callback
(make-deferred :callback callback)
(make-deferred)))
(defun deferred:callback (d &optional arg)
"Start deferred chain with a callback message."
(deferred:exec-task d 'ok arg))
(defun deferred:errorback (d &optional arg)
"Start deferred chain with an errorback message."
(deferred:exec-task d 'ng arg))
(defun deferred:callback-post (d &optional arg)
"Add the deferred object to the execution queue."
(deferred:post-task d 'ok arg))
(defun deferred:errorback-post (d &optional arg)
"Add the deferred object to the execution queue."
(deferred:post-task d 'ng arg))
(defun deferred:cancel (d)
"Cancel all callbacks and deferred chain in the deferred object."
(deferred:message "CANCEL : %s" d)
(funcall (deferred-cancel d) d)
d)
(defun deferred:status (d)
"Return a current status of the deferred object. The returned value means following:
`ok': the callback was called and waiting for next deferred.
`ng': the errorback was called and waiting for next deferred.
nil: The neither callback nor errorback was not called."
(deferred-status d))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Basic utility functions
(defun deferred:succeed (&optional arg)
"Create a synchronous deferred object."
(let ((d (deferred:new)))
(deferred:exec-task d 'ok arg)
d))
(defun deferred:fail (&optional arg)
"Create a synchronous deferred object."
(let ((d (deferred:new)))
(deferred:exec-task d 'ng arg)
d))
(defun deferred:next (&optional callback arg)
"Create a deferred object and schedule executing. This function
is a short cut of following code:
(deferred:callback-post (deferred:new callback))."
(let ((d (if callback
(make-deferred :callback callback)
(make-deferred))))
(deferred:callback-post d arg)
d))
(defun deferred:nextc (d callback)
"Create a deferred object with OK callback and connect it to the given deferred object."
(let ((nd (make-deferred :callback callback)))
(deferred:set-next d nd)))
(defun deferred:error (d callback)
"Create a deferred object with errorback and connect it to the given deferred object."
(let ((nd (make-deferred :errorback callback)))
(deferred:set-next d nd)))
(defun deferred:watch (d callback)
"Create a deferred object with watch task and connect it to the given deferred object.
The watch task CALLBACK can not affect deferred chains with
return values. This function is used in following purposes,
simulation of try-finally block in asynchronous tasks, progress
monitoring of tasks."
(let* ((callback callback)
(normal (lambda (x) (ignore-errors (deferred:call-lambda callback x)) x))
(err (lambda (e)
(ignore-errors (deferred:call-lambda callback e))
(deferred:resignal e))))
(let ((nd (make-deferred :callback normal :errorback err)))
(deferred:set-next d nd))))
(defun deferred:wait (msec)
"Return a deferred object scheduled at MSEC millisecond later."
(let ((d (deferred:new)) (start-time (float-time)) timer)
(deferred:message "WAIT : %s" msec)
(setq timer (deferred:setTimeout
(lambda ()
(deferred:exec-task d 'ok
(* 1000.0 (- (float-time) start-time)))
nil) msec))
(setf (deferred-cancel d)
(lambda (x)
(deferred:cancelTimeout timer)
(deferred:default-cancel x)))
d))
(defun deferred:wait-idle (msec)
"Return a deferred object which will run when Emacs has been
idle for MSEC millisecond."
(let ((d (deferred:new)) (start-time (float-time)) timer)
(deferred:message "WAIT-IDLE : %s" msec)
(setq timer
(deferred:run-with-idle-timer
(/ msec 1000.0)
(lambda ()
(deferred:exec-task d 'ok
(* 1000.0 (- (float-time) start-time)))
nil)))
(setf (deferred-cancel d)
(lambda (x)
(deferred:cancelTimeout timer)
(deferred:default-cancel x)))
d))
(defun deferred:call (f &rest args)
"Call the given function asynchronously."
(deferred:next
(lambda (_x)
(apply f args))))
(defun deferred:apply (f &optional args)
"Call the given function asynchronously."
(deferred:next
(lambda (_x)
(apply f args))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Utility functions
(defun deferred:empty-p (times-or-seq)
"[internal] Return non-nil if TIMES-OR-SEQ is the number zero or nil."
(or (and (numberp times-or-seq) (<= times-or-seq 0))
(and (sequencep times-or-seq) (= (length times-or-seq) 0))))
(defun deferred:loop (times-or-seq func)
"Return a iteration deferred object."
(deferred:message "LOOP : %s" times-or-seq)
(if (deferred:empty-p times-or-seq) (deferred:next)
(let* (items (rd
(cond
((numberp times-or-seq)
(cl-loop for i from 0 below times-or-seq
with ld = (deferred:next)
do
(push ld items)
(setq ld
(let ((i i))
(deferred:nextc ld
(lambda (_x) (deferred:call-lambda func i)))))
finally return ld))
((sequencep times-or-seq)
(cl-loop for i in (append times-or-seq nil) ; seq->list
with ld = (deferred:next)
do
(push ld items)
(setq ld
(let ((i i))
(deferred:nextc ld
(lambda (_x) (deferred:call-lambda func i)))))
finally return ld)))))
(setf (deferred-cancel rd)
(lambda (x) (deferred:default-cancel x)
(cl-loop for i in items
do (deferred:cancel i))))
rd)))
(defun deferred:trans-multi-args (args self-func list-func main-func)
"[internal] Check the argument values and dispatch to methods."
(cond
((and (= 1 (length args)) (consp (car args)) (not (functionp (car args))))
(let ((lst (car args)))
(cond
((or (null lst) (null (car lst)))
(deferred:next))
((deferred:aand lst (car it) (or (functionp it) (deferred-p it)))
;; a list of deferred objects
(funcall list-func lst))
((deferred:aand lst (consp it))
;; an alist of deferred objects
(funcall main-func lst))
(t (error "Wrong argument type. %s" args)))))
(t (funcall self-func args))))
(defun deferred:parallel-array-to-alist (lst)
"[internal] Translation array to alist."
(cl-loop for d in lst
for i from 0 below (length lst)
collect (cons i d)))
(defun deferred:parallel-alist-to-array (alst)
"[internal] Translation alist to array."
(cl-loop for pair in
(sort alst (lambda (x y)
(< (car x) (car y))))
collect (cdr pair)))
(defun deferred:parallel-func-to-deferred (alst)
"[internal] Normalization for parallel and earlier arguments."
(cl-loop for pair in alst
for d = (cdr pair)
collect
(progn
(unless (deferred-p d)
(setf (cdr pair) (deferred:next d)))
pair)))
(defun deferred:parallel-main (alst)
"[internal] Deferred alist implementation for `deferred:parallel'. "
(deferred:message "PARALLEL<KEY . VALUE>" )
(let ((nd (deferred:new))
(len (length alst))
values)
(cl-loop for pair in
(deferred:parallel-func-to-deferred alst)
with cd ; current child deferred
do
(let ((name (car pair)))
(setq cd
(deferred:nextc (cdr pair)
(lambda (x)
(push (cons name x) values)
(deferred:message "PARALLEL VALUE [%s/%s] %s"
(length values) len (cons name x))
(when (= len (length values))
(deferred:message "PARALLEL COLLECTED")
(deferred:post-task nd 'ok (nreverse values)))
nil)))
(deferred:error cd
(lambda (e)
(push (cons name e) values)
(deferred:message "PARALLEL ERROR [%s/%s] %s"
(length values) len (cons name e))
(when (= (length values) len)
(deferred:message "PARALLEL COLLECTED")
(deferred:post-task nd 'ok (nreverse values)))
nil))))
nd))
(defun deferred:parallel-list (lst)
"[internal] Deferred list implementation for `deferred:parallel'. "
(deferred:message "PARALLEL<LIST>" )
(let* ((pd (deferred:parallel-main (deferred:parallel-array-to-alist lst)))
(rd (deferred:nextc pd 'deferred:parallel-alist-to-array)))
(setf (deferred-cancel rd)
(lambda (x) (deferred:default-cancel x)
(deferred:cancel pd)))
rd))
(defun deferred:parallel (&rest args)
"Return a deferred object that calls given deferred objects or
functions in parallel and wait for all callbacks. The following
deferred task will be called with an array of the return
values. ARGS can be a list or an alist of deferred objects or
functions."
(deferred:message "PARALLEL : %s" args)
(deferred:trans-multi-args args
'deferred:parallel 'deferred:parallel-list 'deferred:parallel-main))
(defun deferred:earlier-main (alst)
"[internal] Deferred alist implementation for `deferred:earlier'. "
(deferred:message "EARLIER<KEY . VALUE>" )
(let ((nd (deferred:new))
(len (length alst))
value results)
(cl-loop for pair in
(deferred:parallel-func-to-deferred alst)
with cd ; current child deferred
do
(let ((name (car pair)))
(setq cd
(deferred:nextc (cdr pair)
(lambda (x)
(push (cons name x) results)
(cond
((null value)
(setq value (cons name x))
(deferred:message "EARLIER VALUE %s" (cons name value))
(deferred:post-task nd 'ok value))
(t
(deferred:message "EARLIER MISS [%s/%s] %s" (length results) len (cons name value))
(when (eql (length results) len)
(deferred:message "EARLIER COLLECTED"))))
nil)))
(deferred:error cd
(lambda (e)
(push (cons name e) results)
(deferred:message "EARLIER ERROR [%s/%s] %s" (length results) len (cons name e))
(when (and (eql (length results) len) (null value))
(deferred:message "EARLIER FAILED")
(deferred:post-task nd 'ok nil))
nil))))
nd))
(defun deferred:earlier-list (lst)
"[internal] Deferred list implementation for `deferred:earlier'. "
(deferred:message "EARLIER<LIST>" )
(let* ((pd (deferred:earlier-main (deferred:parallel-array-to-alist lst)))
(rd (deferred:nextc pd (lambda (x) (cdr x)))))
(setf (deferred-cancel rd)
(lambda (x) (deferred:default-cancel x)
(deferred:cancel pd)))
rd))
(defun deferred:earlier (&rest args)
"Return a deferred object that calls given deferred objects or
functions in parallel and wait for the first callback. The
following deferred task will be called with the first return
value. ARGS can be a list or an alist of deferred objects or
functions."
(deferred:message "EARLIER : %s" args)
(deferred:trans-multi-args args
'deferred:earlier 'deferred:earlier-list 'deferred:earlier-main))
(defmacro deferred:timeout (timeout-msec timeout-form d)
"Time out macro on a deferred task D. If the deferred task D
does not complete within TIMEOUT-MSEC, this macro cancels the
deferred task and return the TIMEOUT-FORM."
`(deferred:earlier
(deferred:nextc (deferred:wait ,timeout-msec)
(lambda (x) ,timeout-form))
,d))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Application functions
(defvar deferred:uid 0 "[internal] Sequence number for some utilities. See the function `deferred:uid'.")
(defun deferred:uid ()
"[internal] Generate a sequence number."
(cl-incf deferred:uid))
(defun deferred:buffer-string (strformat buf)
"[internal] Return a string in the buffer with the given format."
(format strformat
(with-current-buffer buf (buffer-string))))
(defun deferred:process (command &rest args)
"A deferred wrapper of `start-process'. Return a deferred
object. The process name and buffer name of the argument of the
`start-process' are generated by this function automatically.
The next deferred object receives stdout and stderr string from
the command process."
(deferred:process-gen 'start-process command args))
(defun deferred:process-shell (command &rest args)
"A deferred wrapper of `start-process-shell-command'. Return a deferred
object. The process name and buffer name of the argument of the
`start-process-shell-command' are generated by this function automatically.
The next deferred object receives stdout and stderr string from
the command process."
(deferred:process-gen 'start-process-shell-command command args))
(defun deferred:process-buffer (command &rest args)
"A deferred wrapper of `start-process'. Return a deferred
object. The process name and buffer name of the argument of the
`start-process' are generated by this function automatically.
The next deferred object receives stdout and stderr buffer from
the command process."
(deferred:process-buffer-gen 'start-process command args))
(defun deferred:process-shell-buffer (command &rest args)
"A deferred wrapper of `start-process-shell-command'. Return a deferred
object. The process name and buffer name of the argument of the
`start-process-shell-command' are generated by this function automatically.
The next deferred object receives stdout and stderr buffer from
the command process."
(deferred:process-buffer-gen 'start-process-shell-command command args))
(defun deferred:process-gen (f command args)
"[internal]"
(let ((pd (deferred:process-buffer-gen f command args)) d)
(setq d (deferred:nextc pd
(lambda (buf)
(prog1
(with-current-buffer buf (buffer-string))
(kill-buffer buf)))))
(setf (deferred-cancel d)
(lambda (_x)
(deferred:default-cancel d)
(deferred:default-cancel pd)))
d))
(defun deferred:process-buffer-gen (f command args)
"[internal]"
(let ((d (deferred:next)) (uid (deferred:uid)))
(let ((proc-name (format "*deferred:*%s*:%s" command uid))
(buf-name (format " *deferred:*%s*:%s" command uid))
(pwd default-directory)
(env process-environment)
(con-type process-connection-type)
(nd (deferred:new)) proc-buf proc)
(deferred:nextc d
(lambda (_x)
(setq proc-buf (get-buffer-create buf-name))
(condition-case err
(let ((default-directory pwd)
(process-environment env)
(process-connection-type con-type))
(setq proc
(if (null (car args))
(apply f proc-name buf-name command nil)
(apply f proc-name buf-name command args)))
(set-process-sentinel
proc
(lambda (proc event)
(unless (process-live-p proc)
(if (zerop (process-exit-status proc))
(deferred:post-task nd 'ok proc-buf)
(let ((msg (format "Deferred process exited abnormally:\n command: %s\n exit status: %s %s\n event: %s\n buffer contents: %S"
command
(process-status proc)
(process-exit-status proc)
(string-trim-right event)
(if (buffer-live-p proc-buf)
(with-current-buffer proc-buf
(buffer-string))
"(unavailable)"))))
(kill-buffer proc-buf)
(deferred:post-task nd 'ng msg))))))
(setf (deferred-cancel nd)
(lambda (x) (deferred:default-cancel x)
(when proc
(kill-process proc)
(kill-buffer proc-buf)))))
(error (deferred:post-task nd 'ng err)))
nil))
nd)))
(defmacro deferred:processc (d command &rest args)
"Process chain of `deferred:process'."
`(deferred:nextc ,d
(lambda (,(cl-gensym)) (deferred:process ,command ,@args))))
(defmacro deferred:process-bufferc (d command &rest args)
"Process chain of `deferred:process-buffer'."
`(deferred:nextc ,d
(lambda (,(cl-gensym)) (deferred:process-buffer ,command ,@args))))
(defmacro deferred:process-shellc (d command &rest args)
"Process chain of `deferred:process'."
`(deferred:nextc ,d
(lambda (,(cl-gensym)) (deferred:process-shell ,command ,@args))))
(defmacro deferred:process-shell-bufferc (d command &rest args)
"Process chain of `deferred:process-buffer'."
`(deferred:nextc ,d
(lambda (,(cl-gensym)) (deferred:process-shell-buffer ,command ,@args))))
;; Special variables defined in url-vars.el.
(defvar url-request-data)
(defvar url-request-method)
(defvar url-request-extra-headers)
(declare-function url-http-symbol-value-in-buffer "url-http"
(symbol buffer &optional unbound-value))
(declare-function deferred:url-param-serialize "request" (params))
(declare-function deferred:url-escape "request" (val))
(eval-after-load "url"
;; for url package
;; TODO: proxy, charaset
;; List of gloabl variables to preserve and restore before url-retrieve call
'(let ((url-global-variables '(url-request-data
url-request-method
url-request-extra-headers)))
(defun deferred:url-retrieve (url &optional cbargs silent inhibit-cookies)
"A wrapper function for url-retrieve. The next deferred
object receives the buffer object that URL will load
into. Values of dynamically bound 'url-request-data', 'url-request-method' and
'url-request-extra-headers' are passed to url-retrieve call."
(let ((nd (deferred:new))
buf
(local-values (mapcar (lambda (symbol) (symbol-value symbol)) url-global-variables)))
(deferred:next
(lambda (_x)
(cl-progv url-global-variables local-values
(condition-case err
(setq buf
(url-retrieve
url (lambda (_xx) (deferred:post-task nd 'ok buf))
cbargs silent inhibit-cookies))
(error (deferred:post-task nd 'ng err)))
nil)))
(setf (deferred-cancel nd)
(lambda (_x)
(when (buffer-live-p buf)
(kill-buffer buf))))
nd))
(defun deferred:url-delete-header (buf)
(with-current-buffer buf
(let ((pos (url-http-symbol-value-in-buffer
'url-http-end-of-headers buf)))
(when pos
(delete-region (point-min) (1+ pos)))))
buf)
(defun deferred:url-delete-buffer (buf)
(when (and buf (buffer-live-p buf))
(kill-buffer buf))
nil)
(defun deferred:url-get (url &optional params &rest args)
"Perform a HTTP GET method with `url-retrieve'. PARAMS is
a parameter list of (key . value) or key. ARGS will be appended
to deferred:url-retrieve args list. The next deferred
object receives the buffer object that URL will load into."
(when params
(setq url
(concat url "?" (deferred:url-param-serialize params))))
(let ((d (deferred:$
(apply 'deferred:url-retrieve url args)
(deferred:nextc it 'deferred:url-delete-header))))
(deferred:set-next
d (deferred:new 'deferred:url-delete-buffer))
d))
(defun deferred:url-post (url &optional params &rest args)
"Perform a HTTP POST method with `url-retrieve'. PARAMS is
a parameter list of (key . value) or key. ARGS will be appended
to deferred:url-retrieve args list. The next deferred
object receives the buffer object that URL will load into."
(let ((url-request-method "POST")
(url-request-extra-headers
(append url-request-extra-headers
'(("Content-Type" . "application/x-www-form-urlencoded"))))
(url-request-data (deferred:url-param-serialize params)))
(let ((d (deferred:$
(apply 'deferred:url-retrieve url args)
(deferred:nextc it 'deferred:url-delete-header))))
(deferred:set-next
d (deferred:new 'deferred:url-delete-buffer))
d)))
(defun deferred:url-escape (val)
"[internal] Return a new string that is VAL URI-encoded."
(unless (stringp val)
(setq val (format "%s" val)))
(url-hexify-string
(encode-coding-string val 'utf-8)))
(defun deferred:url-param-serialize (params)
"[internal] Serialize a list of (key . value) cons cells
into a query string."
(when params
(mapconcat
'identity
(cl-loop for p in params
collect
(cond
((consp p)
(concat
(deferred:url-escape (car p)) "="
(deferred:url-escape (cdr p))))
(t
(deferred:url-escape p))))
"&")))
))
(provide 'deferred)
;;; deferred.el ends here

View File

@@ -1,2 +0,0 @@
;;; -*- no-byte-compile: t -*-
(define-package "dumb-jump" "20190928.1758" "jump to definition for 40+ languages without configuration." '((emacs "24.3") (f "0.20.0") (s "1.11.0") (dash "2.9.0") (popup "0.5.3")) :commit "34fb76982dafc62f8105c520aece4c3ceccb7307" :keywords '("programming") :authors '(("jack angers and contributors")) :maintainer '("jack angers and contributors"))

View File

@@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "dumb-jump" "20191128.1910" "Jump to definition for 40+ languages without configuration" '((emacs "24.3") (f "0.20.0") (s "1.11.0") (dash "2.9.0") (popup "0.5.3")) :commit "738d40ceb7e2d6a3a26f7f27a31ba93924baaa2d" :keywords '("programming") :authors '(("jack angers and contributors")) :maintainer '("jack angers and contributors") :url "https://github.com/jacktasia/dumb-jump")

View File

@@ -1,8 +1,9 @@
;;; dumb-jump.el --- jump to definition for 40+ languages without configuration. -*- lexical-binding: t; -*-
;;; dumb-jump.el --- Jump to definition for 40+ languages without configuration -*- lexical-binding: t; -*-
;; Copyright (C) 2015-2019 jack angers
;; Author: jack angers and contributors
;; Url: https://github.com/jacktasia/dumb-jump
;; Package-Version: 20191128.1910
;; Version: 0.5.3
;; Package-Version: 20190928.1758
;; Package-Requires: ((emacs "24.3") (f "0.20.0") (s "1.11.0") (dash "2.9.0") (popup "0.5.3"))
;; Keywords: programming
@@ -277,6 +278,46 @@ or most optimal searcher."
:tests ("(defparameter test " "(defparameter test\n")
:not ("(defparameter tester" "(defparameter test?" "(defparameter test-"))
;; racket
(:type "function" :supports ("ag" "grep" "rg" "git-grep") :language "racket"
:regex "\\\(define\\s+\\(\\s*JJJ\\j"
:tests ("(define (test blah)" "(define (test\n")
:not ("(define test blah" "(define (test-asdf blah)" "(define test (lambda (blah"))
(:type "function" :supports ("ag" "grep" "rg" "git-grep") :language "racket"
:regex "\\\(define\\s+JJJ\\s*\\\(\\s*lambda"
:tests ("(define test (lambda (blah" "(define test (lambda\n")
:not ("(define test blah" "(define test-asdf (lambda (blah)" "(define (test)" "(define (test blah) (lambda (foo"))
(:type "function" :supports ("ag" "grep" "rg" "git-grep") :language "racket"
:regex "\\\(let\\s+JJJ\\s*(\\\(|\\\[)*"
:tests ("(let test ((blah foo) (bar bas))" "(let test\n" "(let test [(foo")
:not ("(let ((test blah"))
(:type "variable" :supports ("ag" "grep" "rg" "git-grep") :language "racket"
:regex "\\\(define\\s+JJJ\\j"
:tests ("(define test " "(define test\n")
:not ("(define (test"))
(:type "variable" :supports ("ag" "grep" "rg" "git-grep") :language "racket"
:regex "(\\\(|\\\[)\\s*JJJ\\s+"
:tests ("(let ((test 'foo" "(let [(test 'foo" "(let [(test 'foo" "(let [[test 'foo" "(let ((blah 'foo) (test 'bar)")
:not ("{test foo"))
(:type "variable" :supports ("ag" "grep" "rg" "git-grep") :language "racket"
:regex "\\\(lambda\\s+\\\(?[^\(\)]*\\s*JJJ\\j\\s*\\\)?"
:tests ("(lambda (test)" "(lambda (foo test)" "(lambda test (foo)")
:not ("(lambda () test"))
(:type "variable" :supports ("ag" "grep" "rg" "git-grep") :language "racket"
:regex "\\\(define\\s+\\\([^\(\)]+\\s*JJJ\\j\\s*\\\)?"
:tests ("(define (foo test)" "(define (foo test bar)")
:not ("(define foo test" "(define (test foo" "(define (test)"))
(:type "type" :supports ("ag" "grep" "rg" "git-grep") :language "racket"
:regex "\\(struct\\s+JJJ\\j"
:tests ("(struct test (a b)"))
;; scheme
(:type "function" :supports ("ag" "grep" "rg" "git-grep") :language "scheme"
:regex "\\\(define\\s+\\(\\s*JJJ\\j"
@@ -940,8 +981,7 @@ or most optimal searcher."
"test unwrap wrap nr@Naoeu {..} (Action action, specSpecs) = \n undefined")
:not ("nottest n = n * 2"
"let testnot x y = x * y" "test $ y z" "let test a o = mda"
"test :: Sometype -> AnotherType aoeu kek = undefined"
))
"test :: Sometype -> AnotherType aoeu kek = undefined"))
(:type "type-like" :supports ("ag") :language "haskell"
:regex "^\\s*((data(\\s+family)?)|(newtype)|(type(\\s+family)?))\\s+JJJ\\s+"
@@ -958,8 +998,7 @@ or most optimal searcher."
:regex "(data|newtype)\\s{1,3}(?!JJJ\\s+)([^=]{1,40})=((\\s{0,3}JJJ\\s+)|([^=]{0,500}?((?<!(-- ))\\|\\s{0,3}JJJ\\s+)))"
:tests ("data Something a = Test { b :: Kek }"
"data Mem a = TrueMem { b :: Kek } | Test (Mem Int) deriving Mda"
"newtype SafeTest a = Test (Kek a) deriving (YonedaEmbedding)"
)
"newtype SafeTest a = Test (Kek a) deriving (YonedaEmbedding)")
:not ("data Test = Test { b :: Kek }"))
@@ -974,8 +1013,7 @@ or most optimal searcher."
"newtype Mem = Mem { -- | Some docs \n test :: Kek -- ^ More docs } deriving Eq"
"newtype Mem = Mem { test :: Kek } deriving (Eq,Monad)"
"newtype NewMem = OldMem { test :: [Tx] }"
"newtype BlockHeaderList ssc = BHL\n { test :: ([Aoeu a], [Ssss])\n } deriving (Eq)"
)
"newtype BlockHeaderList ssc = BHL\n { test :: ([Aoeu a], [Ssss])\n } deriving (Eq)")
:not ("data Heh = Mda { sometest :: Kek, testsome :: Mem }"))
(:type "typeclass" :supports ("ag") :language "haskell"
@@ -1431,6 +1469,7 @@ or most optimal searcher."
(:language "coffeescript" :ext "coffee" :agtype "coffee" :rgtype "coffeescript")
(:language "faust" :ext "dsp" :agtype nil :rgtype nil)
(:language "faust" :ext "lib" :agtype nil :rgtype nil)
(:language "fortran" :ext "F" :agtype "fortran" :rgtype "fortran")
(:language "fortran" :ext "f" :agtype "fortran" :rgtype "fortran")
(:language "fortran" :ext "f77" :agtype "fortran" :rgtype "fortran")
(:language "fortran" :ext "f90" :agtype "fortran" :rgtype "fortran")
@@ -1480,6 +1519,7 @@ or most optimal searcher."
(:language "r" :ext "Rnw" :agtype "r" :rgtype "r")
(:language "r" :ext "Rtex" :agtype "r" :rgtype nil)
(:language "r" :ext "Rrst" :agtype "r" :rgtype nil)
(:language "racket" :ext "rkt" :agtype "racket" :rgtype "lisp")
(:language "crystal" :ext "cr" :agtype "crystal" :rgtype "crystal")
(:language "crystal" :ext "ecr" :agtype "crystal" :rgtype nil)
(:language "ruby" :ext "rb" :agtype "ruby" :rgtype "ruby")
@@ -1585,7 +1625,7 @@ a symbol then it's probably a function call"
(defcustom dumb-jump-aggressive
nil
"If `t` jump aggressively with the possiblity of a false positive.
"If `t` jump aggressively with the possibility of a false positive.
If `nil` always show list of more than 1 match."
:group 'dumb-jump
:type 'boolean)
@@ -1824,11 +1864,13 @@ This is the persistent action (\\[helm-execute-persistent-action]) for helm."
(plist-get result :line)
(s-trim (plist-get result :context))))
(defun dumb-jump-ivy-jump-to-selected (results choices proj)
"Offer CHOICES as canidates through ivy-read then execute
dumb-jump-to-selected on RESULTS CHOICES and selected choice.
Ignore PROJ"
(dumb-jump-to-selected results choices (ivy-read "Jump to: " choices)))
(defun dumb-jump-ivy-jump-to-selected (results choices _proj)
"Offer CHOICES as candidates through `ivy-read', then execute
`dumb-jump-result-follow' on the selected choice. Ignore _PROJ."
(ivy-read "Jump to: " (-zip choices results)
:action (lambda (cand)
(dumb-jump-result-follow (cdr cand)))
:caller 'dumb-jump-ivy-jump-to-selected))
(defun dumb-jump-prompt-user-for-choice (proj results)
"Put a PROJ's list of RESULTS in a 'popup-menu' (or helm/ivy)
@@ -1983,8 +2025,8 @@ to keep looking for another root."
"Return a list of results based on current file context and calling grep/ag.
CUR-FILE is the path of the current buffer.
PROJ-ROOT is that file's root project directory.
LANG is a string programming langage with CONFIG a property list
of project configuraiton."
LANG is a string programming language with CONFIG a property list
of project configuration."
(let* ((cur-line (if prompt 0 (dumb-jump-get-point-line)))
(look-for-start (when (not prompt)
(- (car (bounds-of-thing-at-point 'symbol))
@@ -2132,6 +2174,7 @@ current file."
(:comment "#" :language "python")
(:comment "%" :language "matlab")
(:comment "#" :language "r")
(:comment ";" :language "racket")
(:comment "#" :language "ruby")
(:comment "#" :language "crystal")
(:comment "#" :language "nim")

Binary file not shown.

View File

@@ -0,0 +1,53 @@
;;; edit-indirect-autoloads.el --- automatically extracted autoloads
;;
;;; Code:
(add-to-list 'load-path (directory-file-name
(or (file-name-directory #$) (car load-path))))
;;;### (autoloads nil "edit-indirect" "edit-indirect.el" (0 0 0 0))
;;; Generated autoloads from edit-indirect.el
(autoload 'edit-indirect-region "edit-indirect" "\
Edit the region BEG..END in a separate buffer.
The region is copied, without text properties, to a separate
buffer, called edit-indirect buffer, and
`edit-indirect-guess-mode-function' is called to set the major
mode.
When done, exit with `edit-indirect-commit', which will remove the
original region and replace it with the edited version; or with
`edit-indirect-abort', which will drop the modifications.
This differs from `clone-indirect-buffer' with narrowing in that
the text properties are not shared, so the parent buffer major mode
and the edit-indirect buffer major mode will not be able to tread
on each other's toes by setting up potentially conflicting text
properties, which happens surprisingly often when the font-lock
mode is used.
Edit-indirect buffers use the `edit-indirect-mode-map' keymap.
If there's already an edit-indirect buffer for BEG..END, use that.
If there's already an edit-indirect buffer active overlapping any
portion of BEG..END, an `edit-indirect-overlapping' error is
signaled.
When DISPLAY-BUFFER is non-nil or when called interactively,
display the edit-indirect buffer in some window and select it.
In any case, return the edit-indirect buffer.
\(fn BEG END &optional DISPLAY-BUFFER)" t nil)
(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "edit-indirect" '("edit-indirect-")))
;;;***
;; Local Variables:
;; version-control: never
;; no-byte-compile: t
;; no-update-autoloads: t
;; coding: utf-8
;; End:
;;; edit-indirect-autoloads.el ends here

View File

@@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "edit-indirect" "20191103.1013" "Edit regions in separate buffers" '((emacs "24.3")) :commit "935ded353b9ed3da67bc61abf245c21b58d88864" :authors '(("Fanael Linithien" . "fanael4@gmail.com")) :maintainer '("Fanael Linithien" . "fanael4@gmail.com") :url "https://github.com/Fanael/edit-indirect")

View File

@@ -0,0 +1,389 @@
;;; edit-indirect.el --- Edit regions in separate buffers -*- lexical-binding: t -*-
;; Author: Fanael Linithien <fanael4@gmail.com>
;; URL: https://github.com/Fanael/edit-indirect
;; Package-Version: 20191103.1013
;; Version: 0.1.5
;; Package-Requires: ((emacs "24.3"))
;; This file is NOT part of GNU Emacs.
;; SPDX-License-Identifier: BSD-2-clause
;;
;; Copyright (c) 2014-2017, Fanael Linithien
;; All rights reserved.
;;
;; Redistribution and use in source and binary forms, with or without
;; modification, are permitted provided that the following conditions are
;; met:
;;
;; * Redistributions of source code must retain the above copyright
;; notice, this list of conditions and the following disclaimer.
;; * Redistributions in binary form must reproduce the above copyright
;; notice, this list of conditions and the following disclaimer in the
;; documentation and/or other materials provided with the distribution.
;;
;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
;; IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
;; TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
;; PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
;; OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
;; EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
;; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
;; PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
;; LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
;; NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;;; Commentary:
;; Edit regions in separate buffers, like `org-edit-src-code' but for arbitrary
;; regions.
;;
;; See the docstring of `edit-indirect-region' for details.
;;; Code:
(defgroup edit-indirect nil
"Editing regions in separate buffers."
:group 'editing)
(defcustom edit-indirect-guess-mode-function #'edit-indirect-default-guess-mode
"The function used to guess the major mode of an edit-indirect buffer.
It's called with the edit-indirect buffer as the current buffer.
It's called with three arguments, the parent buffer, the beginning
and the end of the parent buffer region being editing.
Note that the buffer-local value from the parent buffer is used."
:type 'function
:group 'edit-indirect)
(defcustom edit-indirect-after-creation-hook nil
"Functions called after the edit-indirect buffer is created.
The functions are called with the edit-indirect buffer as the
current buffer.
Note that the buffer-local value from the parent buffer is used."
:type 'hook
:group 'edit-indirect)
(defcustom edit-indirect-before-commit-hook nil
"Functions called before the edit-indirect buffer is committed.
The functions are called with the edit-indirect buffer as the
current buffer.
Note that the buffer-local value from the edit-indirect buffer is
used."
:type 'hook
:group 'edit-indirect)
(defcustom edit-indirect-before-commit-functions nil
"Functions called before an edit-indirect buffer is committed.
The functions are called with the parent buffer as the current
buffer.
Each function is called with two arguments, the beginning and the
end of the region to be changed."
:type 'hook
:group 'edit-indirect)
(defcustom edit-indirect-after-commit-functions nil
"Functions called after an edit-indirect buffer has been committed.
The functions are called with the parent buffer as the current
buffer.
Each function is called with two arguments, the beginning and the
end of the changed region."
:type 'hook
:group 'edit-indirect)
(defgroup edit-indirect-faces nil
"Faces used in `edit-indirect'."
:group 'edit-indirect
:group 'faces
:prefix "edit-indirect")
(defface edit-indirect-edited-region
'((t :inherit secondary-selection))
"Face used to highlight an indirectly edited region."
:group 'edit-indirect-faces)
;; Emacs <= 24.3 has no `define-error'.
(let* ((user-error-conditions (get 'user-error 'error-conditions))
(define-user-error (lambda (name message)
(put name 'error-conditions
(cons name user-error-conditions))
(put name 'error-message message))))
(funcall define-user-error 'edit-indirect-overlapping
"Indirectly edited regions cannot overlap")
(funcall define-user-error 'edit-indirect-read-only
"Text is read-only, modify the edit-indirect buffer instead")
(funcall define-user-error 'edit-indirect-not-indirect
"This is not an edit-indirect buffer"))
(defvar edit-indirect--overlay)
(defvar edit-indirect--should-quit-window nil)
;;;###autoload
(defun edit-indirect-region (beg end &optional display-buffer)
"Edit the region BEG..END in a separate buffer.
The region is copied, without text properties, to a separate
buffer, called edit-indirect buffer, and
`edit-indirect-guess-mode-function' is called to set the major
mode.
When done, exit with `edit-indirect-commit', which will remove the
original region and replace it with the edited version; or with
`edit-indirect-abort', which will drop the modifications.
This differs from `clone-indirect-buffer' with narrowing in that
the text properties are not shared, so the parent buffer major mode
and the edit-indirect buffer major mode will not be able to tread
on each other's toes by setting up potentially conflicting text
properties, which happens surprisingly often when the font-lock
mode is used.
Edit-indirect buffers use the `edit-indirect-mode-map' keymap.
If there's already an edit-indirect buffer for BEG..END, use that.
If there's already an edit-indirect buffer active overlapping any
portion of BEG..END, an `edit-indirect-overlapping' error is
signaled.
When DISPLAY-BUFFER is non-nil or when called interactively,
display the edit-indirect buffer in some window and select it.
In any case, return the edit-indirect buffer."
(interactive
(if (or (use-region-p) (not transient-mark-mode))
(prog1 (list (region-beginning) (region-end) t)
(deactivate-mark))
(user-error "No region")))
(let ((buffer (edit-indirect--get-edit-indirect-buffer beg end)))
(when display-buffer
(with-current-buffer buffer
(setq-local edit-indirect--should-quit-window t))
(select-window (display-buffer buffer)))
buffer))
(defvar edit-indirect-mode-map
(let ((map (make-sparse-keymap)))
(define-key map (kbd "C-x C-s") #'edit-indirect-save)
(define-key map (kbd "C-c '") #'edit-indirect-commit)
(define-key map (kbd "C-c C-c") #'edit-indirect-commit)
(define-key map (kbd "C-c C-k") #'edit-indirect-abort)
map)
"Keymap for edit-indirect buffers.
\\{edit-indirect-mode-map}")
(defun edit-indirect-commit ()
"Commit the modifications done in an edit-indirect buffer.
That is, replace the original region in the parent buffer with the
contents of the edit-indirect buffer.
The edit-indirect buffer is then killed.
Can be called only when the current buffer is an edit-indirect
buffer."
(interactive)
(edit-indirect--barf-if-not-indirect)
(edit-indirect--commit)
(edit-indirect--clean-up))
(defun edit-indirect-save ()
"Save the modifications done in an edit-indirect buffer.
That is, replace the original region in the parent buffer with the
contents of the edit-indirect buffer.
Can be called only when the current buffer is an edit-indirect
buffer."
(interactive)
(edit-indirect--barf-if-not-indirect)
(edit-indirect--commit))
(defun edit-indirect-abort ()
"Abort indirect editing in the current buffer and kill the buffer.
Can be called only when the current buffer is an edit-indirect
buffer."
(interactive)
(edit-indirect--barf-if-not-indirect)
(edit-indirect--abort))
(defun edit-indirect-buffer-indirect-p (&optional buffer)
"Non-nil iff the BUFFER is an edit-indirect buffer.
BUFFER defaults to the current buffer."
(save-current-buffer
(when buffer
(set-buffer buffer))
;; (not (null)) so we don't leak the overlay to the outside world.
(not (null edit-indirect--overlay))))
(defun edit-indirect-default-guess-mode (_parent-buffer _beg _end)
"Guess the major mode for an edit-indirect buffer.
It's done by calling `normal-mode'."
(normal-mode))
(defvar edit-indirect--overlay nil
"The overlay spanning the region of the parent buffer being edited.
It's also used as the variable determining if we're in an
edit-indirect buffer at all.")
(make-variable-buffer-local 'edit-indirect--overlay)
(put 'edit-indirect--overlay 'permanent-local t)
;; Normally this would use `define-minor-mode', but that makes the mode function
;; interactive, which we don't want, because it's just an implementation detail.
(defun edit-indirect--mode (overlay)
"Turn the `edit-indirect--mode' \"minor mode\" on.
OVERLAY is the value to set `edit-indirect--overlay' to."
(setq edit-indirect--overlay overlay)
(add-hook 'kill-buffer-hook #'edit-indirect--abort-on-kill-buffer nil t))
(with-no-warnings
(add-minor-mode
'edit-indirect--overlay " indirect" edit-indirect-mode-map nil #'ignore))
(defun edit-indirect--get-edit-indirect-buffer (beg end)
"Return an edit-indirect buffer for the region BEG..END.
If there's already an edit-indirect buffer active overlapping any
portion of BEG..END, an `edit-indirect-overlapping' error is
signaled."
(let ((old-overlay (edit-indirect--search-for-edit-indirect beg end)))
(cond
((null old-overlay)
(let ((overlay (edit-indirect--create-overlay beg end)))
(edit-indirect--create-indirect-buffer beg end overlay)))
((and (= beg (overlay-start old-overlay))
(= end (overlay-end old-overlay)))
(overlay-get old-overlay 'edit-indirect-buffer))
(t
(signal 'edit-indirect-overlapping '())))))
(defun edit-indirect--search-for-edit-indirect (beg end)
"Return an existing edit-indirect overlay for some region inside BEG..END.
If there's no indirectly edited region inside BEG..END, return
nil."
(catch 'done
(dolist (overlay (overlays-in beg end))
(when (overlay-get overlay 'edit-indirect-buffer)
(throw 'done overlay)))
nil))
(defmacro edit-indirect--buffer-local-value (buffer variable)
"Get the BUFFER local value of VARIABLE.
VARIABLE shall be a symbol."
(unless (symbolp variable)
(signal 'wrong-type-argument (list #'symbolp variable)))
;; `with-current-buffer' is used instead of `buffer-local-value' because
;; the latter doesn't give warnings about free variables when
;; byte-compiled.
`(with-current-buffer ,buffer ,variable))
(defun edit-indirect--create-indirect-buffer (beg end overlay)
"Create an edit-indirect buffer and return it.
BEG..END is the parent buffer region to insert.
OVERLAY is the overlay, see `edit-indirect--overlay'."
(let ((buffer (generate-new-buffer (format "*edit-indirect %s*" (buffer-name))))
(parent-buffer (current-buffer)))
(overlay-put overlay 'edit-indirect-buffer buffer)
(with-current-buffer buffer
(insert-buffer-substring-no-properties parent-buffer beg end)
(set-buffer-modified-p nil)
(edit-indirect--mode overlay)
;; Use the buffer-local values from the parent buffer. Don't retrieve the
;; values before actual uses in case these variables are changed by some
;; of the many possible hooks.
(funcall (edit-indirect--buffer-local-value
parent-buffer edit-indirect-guess-mode-function)
parent-buffer beg end)
(let ((edit-indirect-after-creation-hook
(edit-indirect--buffer-local-value
parent-buffer edit-indirect-after-creation-hook)))
(run-hooks 'edit-indirect-after-creation-hook)))
buffer))
(defun edit-indirect--create-overlay (beg end)
"Create the edit-indirect overlay and return it.
BEG and END specify the region the overlay should encompass."
(let ((overlay (make-overlay beg end)))
(overlay-put overlay 'face 'edit-indirect-edited-region)
(overlay-put overlay 'modification-hooks '(edit-indirect--barf-read-only))
(overlay-put overlay 'insert-in-front-hooks '(edit-indirect--barf-read-only))
overlay))
(defvar edit-indirect--inhibit-read-only nil
"Non-nil means disregard read-only status of indirectly-edited region.")
(defun edit-indirect--barf-read-only (_ov _after _beg _end &optional _len)
"Signal an error because the text is read-only.
No error is signaled if `inhibit-read-only' or
`edit-indirect--inhibit-read-only' is non-nil."
(unless (or inhibit-read-only edit-indirect--inhibit-read-only)
(signal 'edit-indirect-read-only '())))
(defun edit-indirect--commit ()
"Commit the modifications done in an edit-indirect buffer."
(run-hooks 'edit-indirect-before-commit-hook)
(let ((beg (overlay-start edit-indirect--overlay))
(end (overlay-end edit-indirect--overlay))
(buffer (current-buffer))
(edit-indirect--inhibit-read-only t))
(with-current-buffer (overlay-buffer edit-indirect--overlay)
(save-excursion
(let ((beg-marker (copy-marker beg))
(end-marker (copy-marker end)))
(edit-indirect--run-hook-with-positions
'edit-indirect-before-commit-functions beg-marker end-marker)
(save-match-data
(set-match-data (list beg-marker end-marker))
(replace-match (with-current-buffer buffer
(buffer-substring-no-properties 1 (1+ (buffer-size))))
t t))
(edit-indirect--run-hook-with-positions
'edit-indirect-after-commit-functions beg-marker (point))
(set-marker beg-marker nil)
(set-marker end-marker nil))))))
(defun edit-indirect--run-hook-with-positions (hook beg end)
"Run HOOK with the specified positions BEG and END.
HOOK should be a symbol, a hook variable.
The functions are passed integer positions.
If a function changes the buffer contents, the next function will be
called with updated positions."
(let ((beg-marker (unless (markerp beg) (copy-marker beg)))
(end-marker (unless (markerp end) (copy-marker end))))
(run-hook-wrapped hook
(lambda (f beg end)
(funcall f (marker-position beg) (marker-position end))
nil)
(or beg-marker beg) (or end-marker end))
(when beg-marker (set-marker beg-marker nil))
(when end-marker (set-marker end-marker nil))))
(defun edit-indirect--abort ()
"Abort indirect edit."
(edit-indirect--clean-up))
(defun edit-indirect--clean-up ()
"Clean up an edit-indirect buffer."
(delete-overlay edit-indirect--overlay)
;; Kill the overlay reference so that `edit-indirect--abort-on-kill-buffer'
;; won't try to call us again.
(setq edit-indirect--overlay nil)
;; If we created a window, get rid of it. Kill the buffer we created.
(if edit-indirect--should-quit-window
(quit-window t)
(kill-buffer)))
(defun edit-indirect--abort-on-kill-buffer ()
"Abort indirect edit.
Should be called only from `kill-buffer-hook'."
(when edit-indirect--overlay
(edit-indirect--abort)))
(defun edit-indirect--barf-if-not-indirect ()
"Signal an error if the current buffer is not an edit-indirect buffer.
The error signaled is `edit-indirect-not-indirect'."
(unless edit-indirect--overlay
(signal 'edit-indirect-not-indirect '())))
(provide 'edit-indirect)
;;; edit-indirect.el ends here

Binary file not shown.

View File

@@ -1,2 +0,0 @@
;;; -*- no-byte-compile: t -*-
(define-package "f" "20190109.906" "Modern API for working with files and directories" '((s "1.7.0") (dash "2.2.0")) :commit "8191672377816a1975414cc1f116fd3b94b30bd0" :keywords '("files" "directories") :authors '(("Johan Andersson" . "johan.rejeep@gmail.com")) :maintainer '("Johan Andersson" . "johan.rejeep@gmail.com") :url "http://github.com/rejeep/f.el")

View File

@@ -0,0 +1,2 @@
;;; -*- no-byte-compile: t -*-
(define-package "f" "20191110.1357" "Modern API for working with files and directories" '((s "1.7.0") (dash "2.2.0")) :commit "1814209e2ff43cf2e6d38c4cd476218915f550fb" :keywords '("files" "directories") :authors '(("Johan Andersson" . "johan.rejeep@gmail.com")) :maintainer '("Johan Andersson" . "johan.rejeep@gmail.com") :url "http://github.com/rejeep/f.el")

View File

@@ -5,7 +5,7 @@
;; Author: Johan Andersson <johan.rejeep@gmail.com>
;; Maintainer: Johan Andersson <johan.rejeep@gmail.com>
;; Version: 0.20.0
;; Package-Version: 20190109.906
;; Package-Version: 20191110.1357
;; Keywords: files, directories
;; URL: http://github.com/rejeep/f.el
;; Package-Requires: ((s "1.7.0") (dash "2.2.0"))
@@ -609,7 +609,7 @@ returned."
(f-traverse-upwards 'f-root?))
(defmacro f-with-sandbox (path-or-paths &rest body)
"Only allow PATH-OR-PATHS and decendants to be modified in BODY."
"Only allow PATH-OR-PATHS and descendants to be modified in BODY."
(declare (indent 1))
`(let ((paths (if (listp ,path-or-paths)
,path-or-paths

View File

@@ -1,4 +1,4 @@
(define-package "flycheck" "20191027.1608" "On-the-fly syntax checking"
(define-package "flycheck" "20191126.2142" "On-the-fly syntax checking"
'((dash "2.12.1")
(pkg-info "0.4")
(let-alist "1.0.4")

View File

@@ -277,7 +277,8 @@ attention to case differences."
xml-xmlstarlet
xml-xmllint
yaml-jsyaml
yaml-ruby)
yaml-ruby
yaml-yamllint)
"Syntax checkers available for automatic selection.
A list of Flycheck syntax checkers to choose from when syntax
@@ -3939,7 +3940,7 @@ Return ERRORS, with in-place modifications."
(while (not (eobp))
(back-to-indentation)
;; If the current line starts with sufficient whitespace, delete the
;; indendation offset. Otherwise keep the line intact, as we might
;; indentation offset. Otherwise keep the line intact, as we might
;; loose valuable information
(when (>= (- (point) (line-beginning-position)) indent-offset)
(delete-char (- indent-offset)))
@@ -3954,7 +3955,7 @@ Return ERRORS, with in-place modifications."
ERRORS is a list of `flycheck-error' objects. SENTINEL-MESSAGE
is a regular expression matched against the error message to
determine whether the errror denotes errors from an included
determine whether the error denotes errors from an included
file. Alternatively, it is a function that is given an error and
shall return non-nil, if the error denotes errors from an
included file."
@@ -4162,12 +4163,12 @@ overlays."
(flycheck-filter-overlays (overlays-in beg end)))
(defun flycheck-overlay-errors-at (pos)
"Return a list of all flycheck errors overlayed at POS."
"Return a list of all flycheck errors overlaid at POS."
(seq-map (lambda (o) (overlay-get o 'flycheck-error))
(flycheck-overlays-at pos)))
(defun flycheck-overlay-errors-in (beg end)
"Return a list of all flycheck errors overlayed between BEG and END."
"Return a list of all flycheck errors overlaid between BEG and END."
(seq-map (lambda (o) (overlay-get o 'flycheck-error))
(flycheck-overlays-in beg end)))
@@ -4202,11 +4203,15 @@ overlays."
(flycheck-error-level-interesting-p (get-char-property pos 'flycheck-error)))
(defun flycheck-error-level-interesting-p (err)
"Check if ERR severity is >= `flycheck-navigation-minimum-level'."
"Check if ERR severity is >= `flycheck-navigation-minimum-level'.
ERR is also interesting (the function returns true) if there are
no errors as or more severe than `flycheck-navigation-minimum-level'."
(when (flycheck-error-p err)
(-if-let (min-level flycheck-navigation-minimum-level)
(<= (flycheck-error-level-severity min-level)
(flycheck-error-level-severity (flycheck-error-level err)))
(or (<= (flycheck-error-level-severity min-level)
(flycheck-error-level-severity (flycheck-error-level err)))
(not (flycheck-has-current-errors-p min-level)))
t)))
(defun flycheck-next-error-pos (n &optional reset)
@@ -4866,13 +4871,15 @@ In the latter case, show messages in the buffer denoted by
variable `flycheck-error-message-buffer'."
(when (and errors (flycheck-may-use-echo-area-p))
(let ((messages (seq-map #'flycheck-error-format-message-and-id errors)))
(let ((result (display-message-or-buffer (string-join messages "\n\n")
flycheck-error-message-buffer
'not-this-window)))
(when (window-live-p result)
(with-current-buffer (window-buffer result)
(unless (derived-mode-p 'flycheck-error-message-mode)
(flycheck-error-message-mode))))))))
(display-message-or-buffer (string-join messages "\n\n")
flycheck-error-message-buffer
'not-this-window)
;; We cannot rely on `display-message-or-buffer' returning the right
;; window. See URL `https://github.com/flycheck/flycheck/issues/1643'.
(-when-let ((buf (get-buffer flycheck-error-message-buffer)))
(with-current-buffer buf
(unless (derived-mode-p 'flycheck-error-message-mode)
(flycheck-error-message-mode)))))))
(defun flycheck-display-error-messages-unless-error-list (errors)
"Show messages of ERRORS unless the error list is visible.
@@ -8819,7 +8826,7 @@ See URL `https://github.com/zaach/jsonlint'."
"A JSON syntax checker using Python json.tool module.
See URL `https://docs.python.org/3.5/library/json.html#command-line-interface'."
:command ("python" "-m" "json.tool" source
:command ("python3" "-m" "json.tool" source
;; Send the pretty-printed output to the null device
null-device)
:error-patterns
@@ -9228,11 +9235,13 @@ are relative to the file being checked."
See URL `https://developers.google.com/protocol-buffers/'."
:command ("protoc" "--error_format" "gcc"
(eval (concat "--java_out=" (flycheck-temp-dir-system)))
(option-list "--proto_path=" flycheck-protoc-import-path concat)
;; Add the file directory of protobuf path to resolve import
;; directives
;; Add the current directory to resolve imports
(eval (concat "--proto_path="
(file-name-directory (buffer-file-name))))
;; Add other import paths; this needs to be after the current
;; directory to produce the right output. See URL
;; `https://github.com/flycheck/flycheck/pull/1655'
(option-list "--proto_path=" flycheck-protoc-import-path concat)
source-inplace)
:error-patterns
((info line-start (file-name) ":" line ":" column
@@ -9480,7 +9489,7 @@ Requires Flake8 3.0 or newer. See URL
`https://flake8.readthedocs.io/'."
;; Not calling flake8 directly makes it easier to switch between different
;; Python versions; see https://github.com/flycheck/flycheck/issues/1055.
:command ("python"
:command ("python3"
(eval (flycheck-python-module-args 'python-flake8 "flake8"))
"--format=default"
(config-file "--config" flycheck-flake8rc)
@@ -9488,6 +9497,8 @@ Requires Flake8 3.0 or newer. See URL
flycheck-option-int)
(option "--max-line-length" flycheck-flake8-maximum-line-length nil
flycheck-option-int)
(eval (when buffer-file-name
(concat "--stdin-display-name=" buffer-file-name)))
"-")
:standard-input t
:error-filter (lambda (errors)
@@ -9495,7 +9506,7 @@ Requires Flake8 3.0 or newer. See URL
(seq-map #'flycheck-flake8-fix-error-level errors)))
:error-patterns
((warning line-start
"stdin:" line ":" (optional column ":") " "
(file-name) ":" line ":" (optional column ":") " "
(id (one-or-more (any alpha)) (one-or-more digit)) " "
(message (one-or-more not-newline))
line-end))
@@ -9527,7 +9538,7 @@ See URL `https://www.pylint.org/'."
;; --reports=n disables the scoring report.
;; Not calling pylint directly makes it easier to switch between different
;; Python versions; see https://github.com/flycheck/flycheck/issues/1055.
:command ("python"
:command ("python3"
(eval (flycheck-python-module-args 'python-pylint "pylint"))
"--reports=n"
"--output-format=text"
@@ -9564,7 +9575,7 @@ See URL `https://www.pylint.org/'."
"A Python syntax checker using Python's builtin compiler.
See URL `https://docs.python.org/3.4/library/py_compile.html'."
:command ("python" "-m" "py_compile" source)
:command ("python3" "-m" "py_compile" source)
:error-patterns
;; Python 2.7
((error line-start " File \"" (file-name) "\", line " line "\n"
@@ -9787,7 +9798,7 @@ See URL `https://github.com/igorshubovych/markdownlint-cli'."
source)
:error-patterns
((error line-start
(file-name) ": " line ": " (id (one-or-more (not (any space))))
(file-name) ":" line " " (id (one-or-more (not (any space))))
" " (message) line-end))
:error-filter
(lambda (errors)
@@ -10996,7 +11007,7 @@ See URL `http://www.gnu.org/software/texinfo/'."
textlint "textlintrc.json"
:safe #'stringp)
;; This needs to be set because textlint plugins are installed seperately,
;; This needs to be set because textlint plugins are installed separately,
;; and there is no way to check their installation status -- textlint simply
;; prints a backtrace.
(flycheck-def-option-var flycheck-textlint-plugin-alist
@@ -11246,6 +11257,22 @@ See URL `http://www.ruby-doc.org/stdlib-2.0.0/libdoc/yaml/rdoc/YAML.html'."
:modes yaml-mode
:next-checkers ((warning . cwl)))
(flycheck-def-config-file-var flycheck-yamllintrc yaml-yamllint ".yamllint"
:safe #'stringp)
(flycheck-define-checker yaml-yamllint
"A YAML syntax checker using YAMLLint.
See URL `https://github.com/adrienverge/yamllint'."
:standard-input t
:command ("yamllint" "-f" "parsable" "-"
(config-file "-c" flycheck-yamllintrc))
:error-patterns
((error line-start
"stdin:" line ":" column ": [error] " (message) line-end)
(warning line-start
"stdin:" line ":" column ": [warning] " (message) line-end))
:modes yaml-mode)
(provide 'flycheck)
;; Local Variables:

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