]> code.delx.au - gnu-emacs-elpa/commitdiff
[aa2u int] Add abstraction: gsr
authorThien-Thi Nguyen <ttn@gnu.org>
Wed, 21 May 2014 08:51:17 +0000 (10:51 +0200)
committerThien-Thi Nguyen <ttn@gnu.org>
Wed, 21 May 2014 08:51:17 +0000 (10:51 +0200)
* packages/ascii-art-to-unicode/ascii-art-to-unicode.el
(aa2u-phase-1 gsr): New internal func.

packages/ascii-art-to-unicode/ascii-art-to-unicode.el

index b39753f2ce53fd581e1242297722e5486e594ca9..733413c202232808f427c53a4ff034e7267cc349 100644 (file)
@@ -131,14 +131,14 @@ Their values are STRINGIFIER and COMPONENTS, respectively."
                 'aa2u-components components)))
 
 (defun aa2u-phase-1 ()
-  (goto-char (point-min))
-  (let ((vert (aa2u-1c 'aa2u-ucs-bd-uniform-name 'VERTICAL)))
-    (while (search-forward "|" nil t)
-      (replace-match vert t t)))
-  (goto-char (point-min))
-  (let ((horz (aa2u-1c 'aa2u-ucs-bd-uniform-name 'HORIZONTAL)))
-    (while (search-forward "-" nil t)
-      (replace-match horz t t))))
+  (cl-flet
+      ((gsr (was name)
+            (goto-char (point-min))
+            (let ((now (aa2u-1c 'aa2u-ucs-bd-uniform-name name)))
+              (while (search-forward was nil t)
+                (replace-match now t t)))))
+    (gsr "|" 'VERTICAL)
+    (gsr "-" 'HORIZONTAL)))
 
 (defun aa2u-replacement (pos)
   (let ((cc (- pos (line-beginning-position))))