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

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

[elpa] externals/embark bc460d9 08/10: Add action to decode a URL


From: ELPA Syncer
Subject: [elpa] externals/embark bc460d9 08/10: Add action to decode a URL
Date: Sat, 11 Dec 2021 19:57:18 -0500 (EST)

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

    Add action to decode a URL
---
 embark.el | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/embark.el b/embark.el
index 87bf37b..c294773 100644
--- a/embark.el
+++ b/embark.el
@@ -3500,13 +3500,20 @@ ALGORITHM is the hash algorithm symbol understood by 
`secure-hash'."
 (embark--define-hash sha384)
 (embark--define-hash sha512)
 
-(defun embark-encode-url (start end)    ;w
+(defun embark-encode-url (start end)
   "Properly URI-encode the region between START and END in current buffer."
   (interactive "r")
   (let ((encoded (url-encode-url (buffer-substring-no-properties start end))))
     (delete-region start end)
     (insert encoded)))
 
+(defun embark-decode-url (start end)
+  "Decode the URI-encoded region between START and END in current buffer."
+  (interactive "r")
+  (let ((decoded (url-unhex-string (buffer-substring-no-properties start 
end))))
+    (delete-region start end)
+    (insert decoded)))
+
 ;;; Setup and pre-action hooks
 
 (defun embark--restart (&rest _)
@@ -3610,7 +3617,8 @@ and leaves the point to the left of it."
   ("5" embark-hash-sha512)
   ("f" format-encode-region)
   ("F" format-decode-region)
-  ("u" embark-encode-url))
+  ("u" embark-encode-url)
+  ("U" embark-decode-url))
 
 (fset 'embark-encode-map embark-encode-map)
 



reply via email to

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