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 9b97434 22/42: [aa2u] New command:


From: Stefan Monnier
Subject: [elpa] externals/ascii-art-to-unicode 9b97434 22/42: [aa2u] New command: aa2u-mark-rectangle-as-text
Date: Sun, 29 Nov 2020 18:57:06 -0500 (EST)

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

    [aa2u] New command: aa2u-mark-rectangle-as-text
    
    * packages/ascii-art-to-unicode/ascii-art-to-unicode.el:
    Arrange to autoload "rect" for ‘apply-on-rectangle’.
    (aa2u-mark-rectangle-as-text): New command, w/ autoload cookie.
---
 NEWS                    |  3 +++
 ascii-art-to-unicode.el | 18 +++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 6978fe5..58aa282 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ NEWS for ascii-art-to-unicode.el
 See the end for copying conditions.
 
 
+- 1.9 | NOT YET RELEASED
+  - new command: ‘aa2u-mark-rectangle-as-text’
+
 - 1.8 | 2014-05-21
   - new command: ‘aa2u-mark-as-text’
   - package keywords added (to help discovery)
diff --git a/ascii-art-to-unicode.el b/ascii-art-to-unicode.el
index 03f613a..a353c9e 100644
--- a/ascii-art-to-unicode.el
+++ b/ascii-art-to-unicode.el
@@ -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>
@@ -102,6 +103,8 @@
 (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
 



reply via email to

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