emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/embark 1ddc2cad61: Add download actions for URLs


From: ELPA Syncer
Subject: [elpa] externals/embark 1ddc2cad61: Add download actions for URLs
Date: Sat, 29 Jan 2022 14:57:28 -0500 (EST)

branch: externals/embark
commit 1ddc2cad61293c9369c1009fff42c21f1f6c13df
Author: Omar Antolín <omar.antolin@gmail.com>
Commit: Omar Antolín <omar.antolin@gmail.com>

    Add download actions for URLs
---
 embark.el | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/embark.el b/embark.el
index 302de0ae7d..f036ee2590 100644
--- a/embark.el
+++ b/embark.el
@@ -3319,7 +3319,7 @@ Return the category metadatum as the type of the target."
   (add-hook 'embark-target-finders #'embark--ivy-selected)
   (add-hook 'embark-candidate-collectors #'embark--ivy-candidates))
 
-;;; Custom actions open-line open-line
+;;; Custom actions 
 
 (defun embark-keymap-help ()
   "Prompt for an action to perform or command to become and run it."
@@ -3581,6 +3581,7 @@ The search respects symbol boundaries."
   (compose-mail address))
 
 (autoload 'pp-display-expression "pp")
+
 (defun embark-pp-eval-defun (edebug)
   "Run `eval-defun' and pretty print the result.
 With a prefix argument EDEBUG, instrument the code for debugging."
@@ -3649,6 +3650,17 @@ ALGORITHM is the hash algorithm symbol understood by 
`secure-hash'."
   (let ((epa-replace-original-text t))
     (epa-decrypt-region start end)))
 
+(defvar eww-download-directory)
+(autoload 'eww-download-callback "eww")
+
+(defun embark-download-url (url)
+  "Download URL to `eww-download-directory'."
+  (interactive "sDownload URL: ")
+  (let ((dir eww-download-directory))
+    (when (functionp dir) (setq dir (funcall dir)))
+    (access-file dir "Download failed")
+    (url-retrieve url #'eww-download-callback (list url dir))))
+
 ;;; Setup and pre-action hooks
 
 (defun embark--restart (&rest _)
@@ -3892,6 +3904,7 @@ The advice is self-removing so it only affects ACTION 
once."
   "Keymap for Embark url actions."
   ("RET" browse-url)
   ("b" browse-url)
+  ("d" embark-download-url)
   ("e" eww))
 
 (embark-define-keymap embark-email-map



reply via email to

[Prev in Thread] Current Thread [Next in Thread]