branch: elpa commit a1bd2ac49c881fd7525cc37ab7cf1a283411f748 Author: conao3 <con...@gmail.com> Commit: conao3 <con...@gmail.com>
untabify and indent-buffer --- async-bytecomp.el | 12 +-- async.el | 44 +++++----- dired-async.el | 248 +++++++++++++++++++++++++++--------------------------- 3 files changed, 152 insertions(+), 152 deletions(-) diff --git a/async-bytecomp.el b/async-bytecomp.el index 5c8704b..1198497 100644 --- a/async-bytecomp.el +++ b/async-bytecomp.el @@ -91,9 +91,9 @@ All *.elc files are systematically deleted before proceeding." (cl-incf n))) (if (> n 0) (message "Failed to compile %d files in directory `%s'" n directory) - (message "Directory `%s' compiled asynchronously with warnings" directory))))) - (unless quiet - (message "Directory `%s' compiled asynchronously with success" directory)))))) + (message "Directory `%s' compiled asynchronously with warnings" directory))))) + (unless quiet + (message "Directory `%s' compiled asynchronously with success" directory)))))) (async-start `(lambda () (require 'bytecomp) @@ -151,18 +151,18 @@ All *.elc files are systematically deleted before proceeding." ;; `async-byte-recompile-directory' will add directory ;; as needed to `load-path'. (async-byte-recompile-directory (package-desc-dir pkg-desc) t)) - ad-do-it))) + ad-do-it))) ;;;###autoload (define-minor-mode async-bytecomp-package-mode - "Byte compile asynchronously packages installed with package.el. + "Byte compile asynchronously packages installed with package.el. Async compilation of packages can be controlled by `async-bytecomp-allowed-packages'." :group 'async :global t (if async-bytecomp-package-mode (ad-activate 'package--compile) - (ad-deactivate 'package--compile))) + (ad-deactivate 'package--compile))) ;;;###autoload (defun async-byte-compile-file (file) diff --git a/async.el b/async.el index 375b47f..6437a30 100644 --- a/async.el +++ b/async.el @@ -87,7 +87,7 @@ is returned unmodified." (t object))) (defun async-inject-variables - (include-regexp &optional predicate exclude-regexp noprops) + (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 @@ -177,8 +177,8 @@ It is intended to be used as follows: (defun async--receive-sexp (&optional stream) (let ((sexp (decode-coding-string (base64-decode-string (read stream)) 'utf-8-auto)) - ;; Parent expects UTF-8 encoded text. - (coding-system-for-write 'utf-8-auto)) + ;; Parent expects UTF-8 encoded text. + (coding-system-for-write 'utf-8-auto)) (if async-debug (message "Received sexp {{{%s}}}" (pp-to-string sexp))) (setq sexp (read sexp)) @@ -188,9 +188,9 @@ It is intended to be used as follows: (defun async--insert-sexp (sexp) (let (print-level - print-length - (print-escape-nonascii t) - (print-circle t)) + print-length + (print-escape-nonascii t) + (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-auto) @@ -211,17 +211,17 @@ It is intended to be used as follows: ;; process expects. (let ((coding-system-for-write 'utf-8-auto)) (setq async-in-child-emacs t - debug-on-error async-debug) + debug-on-error async-debug) (if debug-on-error - (prin1 (funcall - (async--receive-sexp (unless async-send-over-pipe - command-line-args-left)))) + (prin1 (funcall + (async--receive-sexp (unless async-send-over-pipe + command-line-args-left)))) (condition-case err - (prin1 (funcall - (async--receive-sexp (unless async-send-over-pipe - command-line-args-left)))) - (error - (prin1 (list 'async-signal err))))))) + (prin1 (funcall + (async--receive-sexp (unless async-send-over-pipe + command-line-args-left)))) + (error + (prin1 (list 'async-signal err))))))) (defun async-ready (future) "Query a FUTURE to see if it is ready. @@ -233,7 +233,7 @@ would result from a call to `async-get' on that FUTURE." (if (buffer-live-p buf) (with-current-buffer buf async-callback-value-set) - t)))) + t)))) (defun async-wait (future) "Wait for FUTURE to become ready." @@ -341,8 +341,8 @@ passed to FINISH-FUNC). Call `async-get' on such a future always 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-auto)) + ;; Subordinate Emacs will send text encoded in UTF-8. + (coding-system-for-read 'utf-8-auto)) (setq async--procvar (async-start-process "emacs" (file-truename @@ -356,9 +356,9 @@ returns nil. It can still be useful, however, as an argument to "-batch" "-f" "async-batch-invoke" (if async-send-over-pipe "<none>" - (with-temp-buffer - (async--insert-sexp (list 'quote sexp)) - (buffer-string))))) + (with-temp-buffer + (async--insert-sexp (list 'quote sexp)) + (buffer-string))))) (if async-send-over-pipe (async--transmit-sexp async--procvar (list 'quote sexp))) async--procvar)) @@ -373,7 +373,7 @@ returns nil. It can still be useful, however, as an argument to (setq res (funcall fn res (if (listp binding) binding - (list binding))))) + (list binding))))) res)) (defmacro async-let (bindings &rest forms) diff --git a/dired-async.el b/dired-async.el index 677c169..1dba956 100644 --- a/dired-async.el +++ b/dired-async.el @@ -75,22 +75,22 @@ Should take same args as `message'." :type 'sexp) (defface dired-async-message - '((t (:foreground "yellow"))) + '((t (:foreground "yellow"))) "Face used for mode-line message." :group 'dired-async) (defface dired-async-failures - '((t (:foreground "red"))) + '((t (:foreground "red"))) "Face used for mode-line message." :group 'dired-async) (defface dired-async-mode-message - '((t (:foreground "Gold"))) + '((t (:foreground "Gold"))) "Face used for `dired-async--modeline-mode' lighter." :group 'dired-async) (define-minor-mode dired-async--modeline-mode - "Notify mode-line that an async process run." + "Notify mode-line that an async process run." :group 'dired-async :global t :lighter (:eval (propertize (format " [%s Async job(s) running]" @@ -106,7 +106,7 @@ Should take same args as `message'." " " (propertize (if args (apply #'format text args) - text) + text) 'face face)))) (force-mode-line-update) (sit-for 3) @@ -143,35 +143,35 @@ Should take same args as `message'." (special-mode) (shrink-window-if-larger-than-buffer) (delete-file dired-async-log-file)) - (run-with-timer - 0.1 nil - (lambda () - ;; First send error messages. - (cond (failures - (funcall dired-async-message-function - "%s failed for %d of %d file%s -- See *Dired log* buffer" - 'dired-async-failures - (car operation) (length failures) - total (dired-plural-s total))) - (skipped - (funcall dired-async-message-function - "%s: %d of %d file%s skipped -- See *Dired log* buffer" - '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 + (run-with-timer + 0.1 nil + (lambda () + ;; First send error messages. + (cond (failures + (funcall dired-async-message-function + "%s failed for %d of %d file%s -- See *Dired log* buffer" + 'dired-async-failures + (car operation) (length failures) + total (dired-plural-s total))) + (skipped + (funcall dired-async-message-function + "%s: %d of %d file%s skipped -- See *Dired log* buffer" + '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 (when (and (not (file-remote-p default-directory nil t)) (file-exists-p default-directory)) - (revert-buffer nil t))))) - ;; Finally send the success message. - (funcall dired-async-message-function - "Asynchronous %s of %s on %s file%s done" - 'dired-async-message - (car operation) (cadr operation) - total (dired-plural-s total))))))) + (revert-buffer nil t))))) + ;; Finally send the success message. + (funcall dired-async-message-function + "Asynchronous %s of %s on %s file%s done" + 'dired-async-message + (car operation) (cadr operation) + total (dired-plural-s total))))))) (defun dired-async-maybe-kill-ftp () "Return a form to kill ftp process in child emacs." @@ -186,7 +186,7 @@ Should take same args as `message'." (defvar overwrite-query) (defun dired-async-create-files (file-creator operation fn-list name-constructor - &optional _marker-char) + &optional _marker-char) "Same as `dired-create-files' but asynchronous. See `dired-create-files' for the behavior of arguments." @@ -205,50 +205,50 @@ See `dired-create-files' for the behavior of arguments." (downcase operation) from))) (if (not to) (setq skipped (cons (dired-make-relative from) skipped)) - (let* ((overwrite (and (null (eq file-creator 'backup-file)) - (file-exists-p to))) - (dired-overwrite-confirmed ; for dired-handle-overwrite - (and overwrite - (let ((help-form `(format "\ + (let* ((overwrite (and (null (eq file-creator 'backup-file)) + (file-exists-p to))) + (dired-overwrite-confirmed ; for dired-handle-overwrite + (and overwrite + (let ((help-form `(format "\ Type SPC or `y' to overwrite file `%s', DEL or `n' to skip to next, ESC or `q' to not overwrite any of the remaining files, `!' to overwrite all remaining files with no more questions." ,to))) - (dired-query 'overwrite-query "Overwrite `%s'?" to))))) - ;; Handle the `dired-copy-file' file-creator specially - ;; When copying a directory to another directory or - ;; possibly to itself or one of its subdirectories. - ;; e.g "~/foo/" => "~/test/" - ;; or "~/foo/" =>"~/foo/" - ;; or "~/foo/ => ~/foo/bar/") - ;; In this case the 'name-constructor' have set the destination - ;; TO to "~/test/foo" because the old emacs23 behavior - ;; of `copy-directory' was to not create the subdirectory - ;; and instead copy the contents. - ;; With the new behavior of `copy-directory' - ;; (similar to the `cp' shell command) we don't - ;; need such a construction of the target directory, - ;; so modify the destination TO to "~/test/" instead of "~/test/foo/". - (let ((destname (file-name-directory to))) - (when (and (file-directory-p from) - (file-directory-p to) - (eq file-creator 'dired-copy-file)) - (setq to destname)) - ;; If DESTNAME is a subdirectory of FROM, not a symlink, - ;; and the method in use is copying, signal an error. - (and (eq t (car (file-attributes destname))) - (eq file-creator 'dired-copy-file) - (file-in-directory-p destname from) - (error "Cannot copy `%s' into its subdirectory `%s'" - from to))) - (if overwrite - (or (and dired-overwrite-confirmed - (push (cons from to) async-fn-list)) - (progn - (push (dired-make-relative from) failures) - (dired-log "%s `%s' to `%s' failed\n" - operation from to))) - (push (cons from to) async-fn-list))))) + (dired-query 'overwrite-query "Overwrite `%s'?" to))))) + ;; Handle the `dired-copy-file' file-creator specially + ;; When copying a directory to another directory or + ;; possibly to itself or one of its subdirectories. + ;; e.g "~/foo/" => "~/test/" + ;; or "~/foo/" =>"~/foo/" + ;; or "~/foo/ => ~/foo/bar/") + ;; In this case the 'name-constructor' have set the destination + ;; TO to "~/test/foo" because the old emacs23 behavior + ;; of `copy-directory' was to not create the subdirectory + ;; and instead copy the contents. + ;; With the new behavior of `copy-directory' + ;; (similar to the `cp' shell command) we don't + ;; need such a construction of the target directory, + ;; so modify the destination TO to "~/test/" instead of "~/test/foo/". + (let ((destname (file-name-directory to))) + (when (and (file-directory-p from) + (file-directory-p to) + (eq file-creator 'dired-copy-file)) + (setq to destname)) + ;; If DESTNAME is a subdirectory of FROM, not a symlink, + ;; and the method in use is copying, signal an error. + (and (eq t (car (file-attributes destname))) + (eq file-creator 'dired-copy-file) + (file-in-directory-p destname from) + (error "Cannot copy `%s' into its subdirectory `%s'" + from to))) + (if overwrite + (or (and dired-overwrite-confirmed + (push (cons from to) async-fn-list)) + (progn + (push (dired-make-relative from) failures) + (dired-log "%s `%s' to `%s' failed\n" + operation from to))) + (push (cons from to) async-fn-list))))) ;; Fix tramp issue #80 with emacs-26, use "-q" only when needed. (setq async-quiet-switch (if (and (boundp 'tramp-cache-read-persistent-data) @@ -278,56 +278,56 @@ ESC or `q' to not overwrite any of the remaining files, ;; Setup callback. (setq callback (lambda (&optional _ignore) - (dired-async-after-file-create - total (list operation (length async-fn-list)) failures skipped) - (when (string= (downcase operation) "rename") - (cl-loop for (file . to) in async-fn-list - for bf = (get-file-buffer file) - for destp = (file-exists-p to) - do (and bf destp - (with-current-buffer bf - (set-visited-file-name to t t)))))))) + (dired-async-after-file-create + total (list operation (length async-fn-list)) failures skipped) + (when (string= (downcase operation) "rename") + (cl-loop for (file . to) in async-fn-list + for bf = (get-file-buffer file) + for destp = (file-exists-p to) + do (and bf destp + (with-current-buffer bf + (set-visited-file-name to t t)))))))) ;; Start async process. (when async-fn-list (async-start `(lambda () (require 'cl-lib) (require 'dired-aux) (require 'dired-x) ,(async-inject-variables dired-async-env-variables-regexp) - (let ((dired-recursive-copies (quote always)) - (dired-copy-preserve-time - ,dired-copy-preserve-time)) - (setq overwrite-backup-query nil) - ;; Inline `backup-file' as long as it is not - ;; available in emacs. - (defalias 'backup-file - ;; Same feature as "cp -f --backup=numbered from to" - ;; Symlinks are copied as file from source unlike - ;; `dired-copy-file' which is same as cp -d. - ;; Directories are omitted. - (lambda (from to ok) - (cond ((file-directory-p from) (ignore)) - (t (let ((count 0)) - (while (let ((attrs (file-attributes to))) - (and attrs (null (nth 0 attrs)))) - (cl-incf count) - (setq to (concat (file-name-sans-versions to) - (format ".~%s~" count))))) - (condition-case err - (copy-file from to ok dired-copy-preserve-time) - (file-date-error - (dired-log "Can't set date on %s:\n%s\n" from err))))))) - ;; Now run the FILE-CREATOR function on files. - (cl-loop with fn = (quote ,file-creator) - for (from . dest) in (quote ,async-fn-list) - do (condition-case err - (funcall fn from dest t) - (file-error - (dired-log "%s: %s\n" (car err) (cdr err))) - nil)) + (let ((dired-recursive-copies (quote always)) + (dired-copy-preserve-time + ,dired-copy-preserve-time)) + (setq overwrite-backup-query nil) + ;; Inline `backup-file' as long as it is not + ;; available in emacs. + (defalias 'backup-file + ;; Same feature as "cp -f --backup=numbered from to" + ;; Symlinks are copied as file from source unlike + ;; `dired-copy-file' which is same as cp -d. + ;; Directories are omitted. + (lambda (from to ok) + (cond ((file-directory-p from) (ignore)) + (t (let ((count 0)) + (while (let ((attrs (file-attributes to))) + (and attrs (null (nth 0 attrs)))) + (cl-incf count) + (setq to (concat (file-name-sans-versions to) + (format ".~%s~" count))))) + (condition-case err + (copy-file from to ok dired-copy-preserve-time) + (file-date-error + (dired-log "Can't set date on %s:\n%s\n" from err))))))) + ;; Now run the FILE-CREATOR function on files. + (cl-loop with fn = (quote ,file-creator) + for (from . dest) in (quote ,async-fn-list) + do (condition-case err + (funcall fn from dest t) + (file-error + (dired-log "%s: %s\n" (car err) (cdr err))) + nil)) (when (get-buffer dired-log-buffer) (dired-log t) (with-current-buffer dired-log-buffer - (write-region (point-min) (point-max) - ,dired-async-log-file)))) + (write-region (point-min) (point-max) + ,dired-async-log-file)))) ,(dired-async-maybe-kill-ftp)) callback) ;; Run mode-line notifications while process running. @@ -363,11 +363,11 @@ ESC or `q' to not overwrite any of the remaining files, (advice-add 'wdired-do-renames :around #'dired-async-wdired-do-renames)) (ad-activate 'dired-create-files) (ad-activate 'wdired-do-renames)) - (if (fboundp 'advice-remove) - (progn (advice-remove 'dired-create-files #'dired-async-create-files) - (advice-remove 'wdired-do-renames #'dired-async-wdired-do-renames)) - (ad-deactivate 'dired-create-files) - (ad-deactivate 'wdired-do-renames)))) + (if (fboundp 'advice-remove) + (progn (advice-remove 'dired-create-files #'dired-async-create-files) + (advice-remove 'wdired-do-renames #'dired-async-wdired-do-renames)) + (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’." @@ -380,28 +380,28 @@ ESC or `q' to not overwrite any of the remaining files, "Run ‘dired-do-copy’ asynchronously." (interactive "P") (dired-async--with-async-create-files - (dired-do-copy arg))) + (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))) + (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))) + (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))) + (dired-do-rename arg))) (provide 'dired-async)