]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/ascii-art-to-unicode/ascii-art-to-unicode.el
[aa2u] New command: aa2u-mark-rectangle-as-text
[gnu-emacs-elpa] / packages / ascii-art-to-unicode / ascii-art-to-unicode.el
index 03f613a8d4387ec73861e42fbde560ebea3fab15..a353c9e915ff50e08a90799b37318df210a2994a 100644 (file)
@@ -81,7 +81,6 @@
 ;; `aa2u-mark-as-text'.  A prefix arg clears the property, instead.
 ;; (You can use `describe-text-properties' to check.)  For example:
 ;;
-;;
 ;;      ┌───────────────────┐
 ;;      │                   │
 ;;      │ |\/|              │
@@ -92,6 +91,8 @@
 ;;                │
 ;;            """""""""
 ;;
+;; Command `aa2u-mark-rectangle-as-text' is similar, for rectangles.
+;;
 ;;
 ;; See Also
 ;; - HACKING: <http://git.sv.gnu.org/cgit/emacs/elpa.git/tree/packages/ascii-art-to-unicode/HACKING>
 (require 'cl-lib)
 (require 'pcase)
 
+(autoload 'apply-on-rectangle "rect")
+
 (defvar aa2u-uniform-weight 'LIGHT
   "A symbol, either `LIGHT' or `HEAVY'.
 This specifies the weight of all the lines.")
@@ -308,6 +311,19 @@ Prefix arg means to remove property `aa2u-text', instead."
            start end
            '(aa2u-text t)))
 
+;;;###autoload
+(defun aa2u-mark-rectangle-as-text (start end &optional unmark)
+  "Like `aa2u-mark-as-text' on the region-rectangle.
+When called from a program the rectangle's corners
+are START (top left) and END (bottom right)."
+  (interactive "r\nP")
+  (apply-on-rectangle
+   (lambda (scol ecol unmark)
+     (let ((p (point)))
+       (aa2u-mark-as-text (+ p scol) (+ p ecol) unmark)))
+   start end
+   unmark))
+
 ;;;---------------------------------------------------------------------------
 ;;; that's it