emacs-detubifier

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 8dbe403874234664e08e38e2516fb72c5b517a9c
parent 8b9a85c9be5b7476cf1e1fefe9955d4bb4e4d66d
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Wed, 25 Sep 2024 10:01:34 +0300

Add new function that opens URLs, with the usual suspects replaced.

Diffstat:
Mdetubifier.el | 12++++++++++++
1 file changed, 12 insertions(+), 0 deletions(-)

diff --git a/detubifier.el b/detubifier.el @@ -48,6 +48,18 @@ :type '(list (cons regexp string)) :group 'detubifier) +(defun detubifier-browse-url (url &rest args) + "Open using `browse-url', but with the usual suspects replaced as defined in `detubifier-regexp-replacement-pairs'." + + (let ((url url)) + (dolist (regexp-replacement-pairs detubifier-regexp-replacement-pairs) + (pcase regexp-replacement-pairs + (`(,current-regexp . ,current-replacement) + (setq url (replace-regexp-in-string current-regexp + current-replacement + url))))) + (browse-url url args))) + (defun detubifier-detubify-region () "Replace, in region, all occurances of the regular expressions in `detubifier-regexp-replacement-pairs' with their replacement targets."