From b5003c2e75c76aeae60a3cbc61fbcd116db1d236 Mon Sep 17 00:00:00 2001 From: Andreas Gerler Date: Tue, 28 Aug 2018 20:02:25 +0200 Subject: [PATCH] Update async to 20180527.1730 Signed-off-by: Andreas Gerler --- bba.org | 2 +- .../async-autoloads.el | 59 ++++++++++++-- .../async-bytecomp.el | 44 ++++++++++- .../async-pkg.el | 2 +- .../async.el | 79 ++++++++++++++----- .../dired-async.el | 39 ++++++++- .../smtpmail-async.el | 0 elpa/async-readme.txt | 1 - 8 files changed, 193 insertions(+), 33 deletions(-) rename elpa/{async-20170916.2256 => async-20180527.1730}/async-autoloads.el (70%) rename elpa/{async-20170916.2256 => async-20180527.1730}/async-bytecomp.el (79%) rename elpa/{async-20170916.2256 => async-20180527.1730}/async-pkg.el (68%) rename elpa/{async-20170916.2256 => async-20180527.1730}/async.el (82%) rename elpa/{async-20170916.2256 => async-20180527.1730}/dired-async.el (92%) rename elpa/{async-20170916.2256 => async-20180527.1730}/smtpmail-async.el (100%) diff --git a/bba.org b/bba.org index 158f1134..8b7bb9a1 100644 --- a/bba.org +++ b/bba.org @@ -245,7 +245,7 @@ Keep track of your important stuff! #+BEGIN_SRC emacs-lisp :tangle yes (if (>= emacs-major-version 24) (progn - (add-to-list 'load-path "~/.emacs.d/elpa/async-20161103.1036") + (add-to-list 'load-path "~/.emacs.d/elpa/async-20180527.1730") (require 'async) ) ) diff --git a/elpa/async-20170916.2256/async-autoloads.el b/elpa/async-20180527.1730/async-autoloads.el similarity index 70% rename from elpa/async-20170916.2256/async-autoloads.el rename to elpa/async-20180527.1730/async-autoloads.el index ff846532..addfab1a 100644 --- a/elpa/async-20170916.2256/async-autoloads.el +++ b/elpa/async-20180527.1730/async-autoloads.el @@ -1,9 +1,12 @@ ;;; async-autoloads.el --- automatically extracted autoloads ;; ;;; Code: -(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path)))) + +(add-to-list 'load-path (directory-file-name + (or (file-name-directory #$) (car load-path)))) + -;;;### (autoloads nil "async" "async.el" (22975 34388 0 0)) +;;;### (autoloads nil "async" "async.el" (0 0 0 0)) ;;; Generated autoloads from async.el (autoload 'async-start-process "async" "\ @@ -66,10 +69,12 @@ returns nil. It can still be useful, however, as an argument to \(fn START-FUNC &optional FINISH-FUNC)" nil nil) +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "async" '("async-"))) + ;;;*** -;;;### (autoloads nil "async-bytecomp" "async-bytecomp.el" (22975 -;;;;;; 34388 0 0)) +;;;### (autoloads nil "async-bytecomp" "async-bytecomp.el" (0 0 0 +;;;;;; 0)) ;;; Generated autoloads from async-bytecomp.el (autoload 'async-byte-recompile-directory "async-bytecomp" "\ @@ -95,10 +100,18 @@ Async compilation of packages can be controlled by \(fn &optional ARG)" t nil) +(autoload 'async-byte-compile-file "async-bytecomp" "\ +Byte compile Lisp code FILE asynchronously. + +Same as `byte-compile-file' but asynchronous. + +\(fn FILE)" t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "async-bytecomp" '("async-byte"))) + ;;;*** -;;;### (autoloads nil "dired-async" "dired-async.el" (22975 34388 -;;;;;; 0 0)) +;;;### (autoloads nil "dired-async" "dired-async.el" (0 0 0 0)) ;;; Generated autoloads from dired-async.el (defvar dired-async-mode nil "\ @@ -116,10 +129,39 @@ Do dired actions asynchronously. \(fn &optional ARG)" t nil) +(autoload 'dired-async-do-copy "dired-async" "\ +Run ‘dired-do-copy’ asynchronously. + +\(fn &optional ARG)" t nil) + +(autoload 'dired-async-do-symlink "dired-async" "\ +Run ‘dired-do-symlink’ asynchronously. + +\(fn &optional ARG)" t nil) + +(autoload 'dired-async-do-hardlink "dired-async" "\ +Run ‘dired-do-hardlink’ asynchronously. + +\(fn &optional ARG)" t nil) + +(autoload 'dired-async-do-rename "dired-async" "\ +Run ‘dired-do-rename’ asynchronously. + +\(fn &optional ARG)" t nil) + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "dired-async" '("dired-async-"))) + +;;;*** + +;;;### (autoloads nil "smtpmail-async" "smtpmail-async.el" (0 0 0 +;;;;;; 0)) +;;; Generated autoloads from smtpmail-async.el + +(if (fboundp 'register-definition-prefixes) (register-definition-prefixes "smtpmail-async" '("async-smtpmail-"))) + ;;;*** -;;;### (autoloads nil nil ("async-pkg.el" "smtpmail-async.el") (22975 -;;;;;; 34388 0 0)) +;;;### (autoloads nil nil ("async-pkg.el") (0 0 0 0)) ;;;*** @@ -127,5 +169,6 @@ Do dired actions asynchronously. ;; version-control: never ;; no-byte-compile: t ;; no-update-autoloads: t +;; coding: utf-8 ;; End: ;;; async-autoloads.el ends here diff --git a/elpa/async-20170916.2256/async-bytecomp.el b/elpa/async-20180527.1730/async-bytecomp.el similarity index 79% rename from elpa/async-20170916.2256/async-bytecomp.el rename to elpa/async-20180527.1730/async-bytecomp.el index 2c96da0a..7bb2d46a 100644 --- a/elpa/async-20170916.2256/async-bytecomp.el +++ b/elpa/async-20180527.1730/async-bytecomp.el @@ -51,7 +51,8 @@ the symbol `all', in this case packages are always compiled asynchronously." :group 'async :type '(repeat (choice symbol))) -(defvar async-byte-compile-log-file "~/.emacs.d/async-bytecomp.log") +(defvar async-byte-compile-log-file + (concat user-emacs-directory "async-bytecomp.log")) ;;;###autoload (defun async-byte-recompile-directory (directory &optional quiet) @@ -172,6 +173,47 @@ Async compilation of packages can be controlled by (ad-activate 'package--compile) (ad-deactivate 'package--compile))) +;;;###autoload +(defun async-byte-compile-file (file) + "Byte compile Lisp code FILE asynchronously. + +Same as `byte-compile-file' but asynchronous." + (interactive "fFile: ") + (let ((call-back + (lambda (&optional _ignore) + (let ((bn (file-name-nondirectory file))) + (if (file-exists-p async-byte-compile-log-file) + (let ((buf (get-buffer-create byte-compile-log-buffer)) + start) + (with-current-buffer buf + (goto-char (setq start (point-max))) + (let ((inhibit-read-only t)) + (insert-file-contents async-byte-compile-log-file) + (compilation-mode)) + (display-buffer buf) + (delete-file async-byte-compile-log-file) + (save-excursion + (goto-char start) + (if (re-search-forward "^.*:Error:" nil t) + (message "Failed to compile `%s'" bn) + (message "`%s' compiled asynchronously with warnings" bn))))) + (message "`%s' compiled asynchronously with success" bn)))))) + (async-start + `(lambda () + (require 'bytecomp) + ,(async-inject-variables "\\`load-path\\'") + (let ((default-directory ,(file-name-directory file))) + (add-to-list 'load-path default-directory) + (byte-compile-file ,file) + (when (get-buffer byte-compile-log-buffer) + (setq error-data (with-current-buffer byte-compile-log-buffer + (buffer-substring-no-properties (point-min) (point-max)))) + (unless (string= error-data "") + (with-temp-file ,async-byte-compile-log-file + (erase-buffer) + (insert error-data)))))) + call-back))) + (provide 'async-bytecomp) ;;; async-bytecomp.el ends here diff --git a/elpa/async-20170916.2256/async-pkg.el b/elpa/async-20180527.1730/async-pkg.el similarity index 68% rename from elpa/async-20170916.2256/async-pkg.el rename to elpa/async-20180527.1730/async-pkg.el index 70f61053..507e0666 100644 --- a/elpa/async-20170916.2256/async-pkg.el +++ b/elpa/async-20180527.1730/async-pkg.el @@ -1,4 +1,4 @@ -(define-package "async" "20170916.2256" "Asynchronous processing in Emacs" 'nil :keywords +(define-package "async" "20180527.1730" "Asynchronous processing in Emacs" 'nil :keywords '("async") :url "https://github.com/jwiegley/emacs-async") ;; Local Variables: diff --git a/elpa/async-20170916.2256/async.el b/elpa/async-20180527.1730/async.el similarity index 82% rename from elpa/async-20170916.2256/async.el rename to elpa/async-20180527.1730/async.el index c1fb40bf..771e6410 100644 --- a/elpa/async-20170916.2256/async.el +++ b/elpa/async-20180527.1730/async.el @@ -4,7 +4,7 @@ ;; Author: John Wiegley ;; Created: 18 Jun 2012 -;; Version: 1.9.2 +;; Version: 1.9.3 ;; Keywords: async ;; X-URL: https://github.com/jwiegley/emacs-async @@ -31,10 +31,17 @@ ;;; Code: +(eval-when-compile (require 'cl-lib)) + (defgroup async nil "Simple asynchronous processing in Emacs" :group 'emacs) +(defcustom async-variables-noprops-function #'async-variables-noprops + "Default function to remove text properties in variables." + :group 'async + :type 'function) + (defvar async-debug nil) (defvar async-send-over-pipe t) (defvar async-in-child-emacs nil) @@ -45,13 +52,36 @@ (defvar async-current-process nil) (defvar async--procvar nil) +(defun async-variables-noprops (sequence) + "Remove text properties in SEQUENCE. + +Argument SEQUENCE may be a list or a string, if anything else it +is returned unmodified. + +Note that this is a naive function that doesn't remove text properties +in SEQUENCE recursively, only at the first level which suffice in most +cases." + (cond ((stringp sequence) + (substring-no-properties sequence)) + ((listp sequence) + (cl-loop for elm in sequence + if (stringp elm) + collect (substring-no-properties elm) + else collect elm)) + (t sequence))) + (defun async-inject-variables - (include-regexp &optional predicate exclude-regexp) + (include-regexp &optional predicate exclude-regexp noprops) "Return a `setq' form that replicates part of the calling environment. + It sets the value for every variable matching INCLUDE-REGEXP and also PREDICATE. It will not perform injection for any variable -matching EXCLUDE-REGEXP (if present). It is intended to be used -as follows: +matching EXCLUDE-REGEXP (if present) or representing a syntax-table +i.e. ending by \"-syntax-table\". +When NOPROPS is non nil it tries to strip out text properties of each +variable's value with `async-variables-noprops-function'. + +It is intended to be used as follows: (async-start `(lambda () @@ -66,17 +96,26 @@ as follows: ,@(let (bindings) (mapatoms (lambda (sym) - (if (and (boundp sym) - (or (null include-regexp) - (string-match include-regexp (symbol-name sym))) - (not (string-match - (or exclude-regexp "-syntax-table\\'") - (symbol-name sym)))) - (let ((value (symbol-value sym))) - (when (or (null predicate) - (funcall predicate sym)) - (setq bindings (cons `(quote ,value) bindings) - bindings (cons sym bindings))))))) + (let* ((sname (and (boundp sym) (symbol-name sym))) + (value (and sname (symbol-value sym)))) + (when (and sname + (or (null include-regexp) + (string-match include-regexp sname)) + (or (null exclude-regexp) + (not (string-match exclude-regexp sname))) + (not (string-match "-syntax-table\\'" sname))) + (unless (or (stringp value) + (memq value '(nil t)) + (numberp value) + (vectorp value)) + (setq value `(quote ,value))) + (when noprops + (setq value (funcall async-variables-noprops-function + value))) + (when (or (null predicate) + (funcall predicate sym)) + (setq bindings (cons value bindings) + bindings (cons sym bindings))))))) bindings))) (defalias 'async-inject-environment 'async-inject-variables) @@ -121,9 +160,9 @@ as follows: (defun async--receive-sexp (&optional stream) (let ((sexp (decode-coding-string (base64-decode-string - (read stream)) 'utf-8-unix)) + (read stream)) 'utf-8-auto)) ;; Parent expects UTF-8 encoded text. - (coding-system-for-write 'utf-8-unix)) + (coding-system-for-write 'utf-8-auto)) (if async-debug (message "Received sexp {{{%s}}}" (pp-to-string sexp))) (setq sexp (read sexp)) @@ -138,7 +177,7 @@ as follows: (print-circle t)) (prin1 sexp (current-buffer)) ;; Just in case the string we're sending might contain EOF - (encode-coding-region (point-min) (point-max) 'utf-8-unix) + (encode-coding-region (point-min) (point-max) 'utf-8-auto) (base64-encode-region (point-min) (point-max) t) (goto-char (point-min)) (insert ?\") (goto-char (point-max)) (insert ?\" ?\n))) @@ -154,7 +193,7 @@ as follows: "Called from the child Emacs process' command-line." ;; Make sure 'message' and 'prin1' encode stuff in UTF-8, as parent ;; process expects. - (let ((coding-system-for-write 'utf-8-unix)) + (let ((coding-system-for-write 'utf-8-auto)) (setq async-in-child-emacs t debug-on-error async-debug) (if debug-on-error @@ -287,7 +326,7 @@ returns nil. It can still be useful, however, as an argument to `async-ready' or `async-wait'." (let ((sexp start-func) ;; Subordinate Emacs will send text encoded in UTF-8. - (coding-system-for-read 'utf-8-unix)) + (coding-system-for-read 'utf-8-auto)) (setq async--procvar (async-start-process "emacs" (file-truename diff --git a/elpa/async-20170916.2256/dired-async.el b/elpa/async-20180527.1730/dired-async.el similarity index 92% rename from elpa/async-20170916.2256/dired-async.el rename to elpa/async-20180527.1730/dired-async.el index 485786c9..bc406b39 100644 --- a/elpa/async-20170916.2256/dired-async.el +++ b/elpa/async-20180527.1730/dired-async.el @@ -159,6 +159,10 @@ Should take same args as `message'." 'dired-async-failures (car operation) (length skipped) total (dired-plural-s total)))) + (when dired-buffers + (cl-loop for (_f . b) in dired-buffers + when (buffer-live-p b) + do (with-current-buffer b (revert-buffer nil t)))) ;; Finally send the success message. (funcall dired-async-message-function "Asynchronous %s of %s on %s file%s done" @@ -246,7 +250,7 @@ ESC or `q' to not overwrite any of the remaining files, (setq async-quiet-switch (if (and (boundp 'tramp-cache-read-persistent-data) async-fn-list - (cl-loop for (from . to) in async-fn-list + (cl-loop for (_from . to) in async-fn-list thereis (file-remote-p to))) "-q" "-Q")) ;; When failures have been printed to dired log add the date at bob. @@ -362,6 +366,39 @@ ESC or `q' to not overwrite any of the remaining files, (ad-deactivate 'dired-create-files) (ad-deactivate 'wdired-do-renames)))) +(defmacro dired-async--with-async-create-files (&rest body) + "Evaluate BODY with ‘dired-create-files’ set to ‘dired-async-create-files’." + (declare (indent 0)) + `(cl-letf (((symbol-function 'dired-create-files) #'dired-async-create-files)) + ,@body)) + +;;;###autoload +(defun dired-async-do-copy (&optional arg) + "Run ‘dired-do-copy’ asynchronously." + (interactive "P") + (dired-async--with-async-create-files + (dired-do-copy arg))) + +;;;###autoload +(defun dired-async-do-symlink (&optional arg) + "Run ‘dired-do-symlink’ asynchronously." + (interactive "P") + (dired-async--with-async-create-files + (dired-do-symlink arg))) + +;;;###autoload +(defun dired-async-do-hardlink (&optional arg) + "Run ‘dired-do-hardlink’ asynchronously." + (interactive "P") + (dired-async--with-async-create-files + (dired-do-hardlink arg))) + +;;;###autoload +(defun dired-async-do-rename (&optional arg) + "Run ‘dired-do-rename’ asynchronously." + (interactive "P") + (dired-async--with-async-create-files + (dired-do-rename arg))) (provide 'dired-async) diff --git a/elpa/async-20170916.2256/smtpmail-async.el b/elpa/async-20180527.1730/smtpmail-async.el similarity index 100% rename from elpa/async-20170916.2256/smtpmail-async.el rename to elpa/async-20180527.1730/smtpmail-async.el diff --git a/elpa/async-readme.txt b/elpa/async-readme.txt index 3e6a4fef..ac103499 100644 --- a/elpa/async-readme.txt +++ b/elpa/async-readme.txt @@ -1,3 +1,2 @@ Adds the ability to call asynchronous functions and process with ease. See the documentation for `async-start' and `async-start-process'. - -- 2.47.3