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

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

[elpa] 01/01: [aa2u] New command: aa2u-rectangle


From: Thien-Thi Nguyen
Subject: [elpa] 01/01: [aa2u] New command: aa2u-rectangle
Date: Sun, 11 May 2014 11:36:45 +0000

ttn pushed a commit to branch master
in repository elpa.

commit 90819824596633b8684f220524298138003718df
Author: Thien-Thi Nguyen <address@hidden>
Date:   Sun May 11 13:32:42 2014 +0200

    [aa2u] New command: aa2u-rectangle
    
    * packages/ascii-art-to-unicode/ascii-art-to-unicode.el (aa2u-rectangle): 
New command.
---
 packages/ascii-art-to-unicode/NEWS                 |    1 +
 .../ascii-art-to-unicode/ascii-art-to-unicode.el   |   17 ++++++++++++++++-
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/packages/ascii-art-to-unicode/NEWS 
b/packages/ascii-art-to-unicode/NEWS
index ae86a66..3c1452e 100644
--- a/packages/ascii-art-to-unicode/NEWS
+++ b/packages/ascii-art-to-unicode/NEWS
@@ -4,6 +4,7 @@ See the end for copying conditions.
 
 - 1.7 | NOT YET RELEASED
   - new var: ‘aa2u-uniform-weight’
+  - new command: ‘aa2u-rectangle’
 
 - 1.6 | 2014-05-09
   - fix regression for interactive invocation w/o active region
diff --git a/packages/ascii-art-to-unicode/ascii-art-to-unicode.el 
b/packages/ascii-art-to-unicode/ascii-art-to-unicode.el
index a4cdf6d..ea7ea86 100644
--- a/packages/ascii-art-to-unicode/ascii-art-to-unicode.el
+++ b/packages/ascii-art-to-unicode/ascii-art-to-unicode.el
@@ -22,6 +22,7 @@
 
 ;; The command `aa2u' converts simple ASCII art line drawings in
 ;; the {active,accessible} region of the current buffer to Unicode.
+;; Command `aa2u-rectangle' is like `aa2u', but works on rectangles.
 ;;
 ;; Example use case:
 ;; - M-x artist-mode RET
@@ -206,7 +207,7 @@ Their values are STRINGIFIER and COMPONENTS, respectively."
                                 'aa2u-components nil)))
 
 ;;;---------------------------------------------------------------------------
-;;; command
+;;; commands
 
 ;;;###autoload
 (defun aa2u (beg end &optional interactive)
@@ -257,6 +258,20 @@ or the accessible portion otherwise."
       (aa2u-phase-2)
       (aa2u-phase-3))))
 
+;;;###autoload
+(defun aa2u-rectangle (start end)
+  "Like `aa2u' on the region-rectangle.
+When called from a program the rectangle's corners
+are START (top left) and END (bottom right)."
+  (interactive "r")
+  (let* ((was (delete-extract-rectangle start end))
+         (now (with-temp-buffer
+                (insert-rectangle was)
+                (aa2u (point) (mark))
+                (extract-rectangle (point-min) (point-max)))))
+    (goto-char (min start end))
+    (insert-rectangle now)))
+
 ;;;---------------------------------------------------------------------------
 ;;; that's it
 



reply via email to

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