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

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

[elpa] externals/ascii-art-to-unicode 1e682b8 02/42: [aa2u] Make ‘aa2u’


From: Stefan Monnier
Subject: [elpa] externals/ascii-art-to-unicode 1e682b8 02/42: [aa2u] Make ‘aa2u’ region-aware.
Date: Sun, 29 Nov 2020 18:57:03 -0500 (EST)

branch: externals/ascii-art-to-unicode
commit 1e682b83be84db87e0ff48e7ca59031e6cba567d
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>

    [aa2u] Make ‘aa2u’ region-aware.
    
    * packages/ascii-art-to-unicode/ascii-art-to-unicode.el (aa2u):
    Take args BEG and END; use "r" in ‘interactive’ spec;
    don't bother w/ internal func ‘do-it!’.
---
 ascii-art-to-unicode.el | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/ascii-art-to-unicode.el b/ascii-art-to-unicode.el
index 6c691a7..9442750 100644
--- a/ascii-art-to-unicode.el
+++ b/ascii-art-to-unicode.el
@@ -228,7 +228,7 @@ Their values are STRINGIFIER and COMPONENTS, respectively."
 ;;; command
 
 ;;;###autoload
-(defun aa2u ()
+(defun aa2u (beg end)
   "Convert simple ASCII art line drawings to Unicode.
 Specifically, perform the following replacements:
 
@@ -254,20 +254,16 @@ More precisely, hyphen and vertical bar are substituted 
unconditionally,
 first, and plus is substituted with a character depending on its north,
 south, east and west neighbors.
 
-This command operates on either the active region, as per
-`use-region-p', or the accessible portion otherwise."
-  (interactive)
+This command operates on either the active region,
+or the accessible portion otherwise."
+  (interactive "r")
   (save-excursion
-    (cl-flet
-        ((do-it! () (aa2u-phase-1) (aa2u-phase-2) (aa2u-phase-3)))
-      (if (use-region-p)
-          (let ((beg (region-beginning))
-                (end (region-end)))
-            (save-restriction
-              (widen)
-              (narrow-to-region beg end)
-              (do-it!)))
-        (do-it!)))))
+    (save-restriction
+      (widen)
+      (narrow-to-region beg end)
+      (aa2u-phase-1)
+      (aa2u-phase-2)
+      (aa2u-phase-3))))
 
 ;;;---------------------------------------------------------------------------
 ;;; that's it



reply via email to

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