emacs-detubifier

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

commit 7f02cd786b75471ee04fe3ea5cca9a3155ff82da
parent f16608913a26aad63ed006634dadd818291c0b98
Author: Yuval Langer <yuval.langer@gmail.com>
Date:   Fri, 27 Sep 2024 08:03:11 +0300

Fix docstring documentation and missing narrowing bug.

Diffstat:
Mdetubifier.el | 9+++++++--
1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/detubifier.el b/detubifier.el @@ -100,16 +100,21 @@ TODO: What are args in `browse-url'?" ;;;###autoload (defun detubifier-custom-detubify-region (&optional beg end) - "Replace the usual suspect URLs in string STR. + "Replace the usual suspect URLs in region. + +Region is defined either by (region-beginning) and (region-end), +or, if provided, between between BEG and END. Use custom variable `detubifier-regexp-replacement-pairs' to do so." (interactive) (save-excursion - (save-restriction + (save-restriction ;; Save narrowing setting and revert to it when finishing. (let ((beg (if beg beg (region-beginning))) (end (if end end (region-end)))) + (narrow-to-region beg end) + (goto-char (point-min)) (dolist (regexp-replacement-pairs detubifier-regexp-replacement-pairs) (pcase regexp-replacement-pairs (`(,current-regexp . ,current-replacement)