]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/ascii-art-to-unicode/ascii-art-to-unicode.el
Merge commit '0b9eb2b647a49ffa3dc4e3e61cb8bd94c7fe3634' as 'packages/gnorb'
[gnu-emacs-elpa] / packages / ascii-art-to-unicode / ascii-art-to-unicode.el
index 45e5d0f6f142ed57f844a841b7551467ec8819dd..05cf38c6f7b962a523ef68856c7fd7f241518124 100644 (file)
@@ -4,8 +4,9 @@
 
 ;; Author: Thien-Thi Nguyen <ttn@gnu.org>
 ;; Maintainer: Thien-Thi Nguyen <ttn@gnu.org>
-;; Version: 1.7
+;; Version: 1.9
 ;; Keywords: ascii, unicode, box-drawing
+;; URL: http://www.gnuvola.org/software/aa2u/
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
@@ -81,7 +82,6 @@
 ;; `aa2u-mark-as-text'.  A prefix arg clears the property, instead.
 ;; (You can use `describe-text-properties' to check.)  For example:
 ;;
-;;
 ;;      ┌───────────────────┐
 ;;      │                   │
 ;;      │ |\/|              │
 ;;                │
 ;;            """""""""
 ;;
+;; 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>
-;; - Tip Jar: <http://www.gnuvola.org/software/aa2u/>
+;; Tip: For best results, you should make sure all the tab characaters
+;; are converted to spaces.  See: `untabify', `indent-tabs-mode'.
 
 ;;; Code:
 
 (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 +310,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