[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/ascii-art-to-unicode 1dd85cc 10/42: [aa2u] Make weight
From: |
Stefan Monnier |
Subject: |
[elpa] externals/ascii-art-to-unicode 1dd85cc 10/42: [aa2u] Make weight dynamically customizable. |
Date: |
Sun, 29 Nov 2020 18:57:04 -0500 (EST) |
branch: externals/ascii-art-to-unicode
commit 1dd85cc4c85ec2cc316ed1f1201d03231de0755d
Author: Thien-Thi Nguyen <ttn@gnu.org>
Commit: Thien-Thi Nguyen <ttn@gnu.org>
[aa2u] Make weight dynamically customizable.
* packages/ascii-art-to-unicode/ascii-art-to-unicode.el
(aa2u-uniform-weight): New defvar.
(aa2u-ucs-bd-uniform-name): Don't take arg WEIGHT;
instead, consult ‘aa2u-uniform-weight’.
(aa2u-phase-1, aa2u-replacement):
Update calls to ‘aa2u-ucs-bd-uniform-name’.
(aa2u): Mention new var in docstring.
---
ascii-art-to-unicode.el | 41 +++++++++++++++++++++++++++++------------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/ascii-art-to-unicode.el b/ascii-art-to-unicode.el
index 3ebe951..89bcb92 100644
--- a/ascii-art-to-unicode.el
+++ b/ascii-art-to-unicode.el
@@ -58,6 +58,21 @@
;;
;; Much easier on the eyes now!
;;
+;; Normally, lines are drawn with the `LIGHT' weight. If you set var
+;; `aa2u-uniform-weight' to symbol `HEAVY', you will see, instead:
+;;
+;; ┏━━━━━━━━━━━━━━━┓
+;; ┃ ┃
+;; ┃ ┏━━━━━━━╋━━┓
+;; ┃ ┃ ┃ ┃
+;; ┃ ┃ ┃ ┃
+;; ┃ ┃ ┃ ┃
+;; ┗━━━━━━━╋━━━━━━━┛ ┃
+;; ┃ ┃
+;; ┃ ┃
+;; ┃ ┃
+;; ┗━━━━━━━━━━┛
+;;
;;
;; See Also
;; - HACKING:
<http://git.sv.gnu.org/cgit/emacs/elpa.git/tree/packages/ascii-art-to-unicode/HACKING>
@@ -68,18 +83,18 @@
(require 'cl-lib)
(require 'pcase)
+(defvar aa2u-uniform-weight 'HEAVY
+ "A symbol, either `LIGHT' or `HEAVY'.
+This specifies the weight of all the lines.")
+
;;;---------------------------------------------------------------------------
;;; support
-(defun aa2u-ucs-bd-uniform-name (weight &rest components)
+(defun aa2u-ucs-bd-uniform-name (&rest components)
"Return a string naming UCS char w/ WEIGHT and COMPONENTS.
-The string begins with \"BOX DRAWINGS\"; followed by WEIGHT,
-a symbol from the set:
-
- HEAVY
- LIGHT
-
-followed by COMPONENTS, a list of one or two symbols from the set:
+The string begins with \"BOX DRAWINGS\"; followed by the weight
+as per variable `aa2u-uniform-weight', followed by COMPONENTS,
+a list of one or two symbols from the set:
VERTICAL
HORIZONTAL
@@ -94,7 +109,7 @@ string includes \"AND\" between the elements of COMPONENTS.
Lastly, all words are separated by space (U+20)."
(format "BOX DRAWINGS %s %s"
- weight
+ aa2u-uniform-weight
(mapconcat 'symbol-name components
" AND ")))
@@ -114,11 +129,11 @@ Their values are STRINGIFIER and COMPONENTS,
respectively."
(defun aa2u-phase-1 ()
(goto-char (point-min))
- (let ((vert (aa2u-1c 'aa2u-ucs-bd-uniform-name 'LIGHT 'VERTICAL)))
+ (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 'LIGHT 'HORIZONTAL)))
+ (let ((horz (aa2u-1c 'aa2u-ucs-bd-uniform-name 'HORIZONTAL)))
(while (search-forward "-" nil t)
(replace-match horz t t))))
@@ -155,7 +170,6 @@ Their values are STRINGIFIER and COMPONENTS, respectively."
(just (&rest args) (delq nil args)))
(apply 'aa2u-1c
'aa2u-ucs-bd-uniform-name
- 'LIGHT
(just (pcase (just (v 'UP 0)
(v 'DOWN 2))
((pred two-p) 'VERTICAL)
@@ -221,6 +235,9 @@ More precisely, hyphen and vertical bar are substituted
unconditionally,
first, and plus is substituted with a character depending on its north,
south, east and west neighbors.
+NB: Actually, `aa2u' can also use \"HEAVY\" instead of \"LIGHT\",
+depending on the value of variable `aa2u-uniform-weight'.
+
This command operates on either the active region,
or the accessible portion otherwise."
(interactive "r\np")
- [elpa] externals/ascii-art-to-unicode 1a107c7 06/42: [aa2u maint] Extract NEWS and HACKING to separate files; nfc., (continued)
- [elpa] externals/ascii-art-to-unicode 1a107c7 06/42: [aa2u maint] Extract NEWS and HACKING to separate files; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode 80b9003 08/42: [aa2u int] Don't use ‘cl-labels’ when ‘cl-flet*’ will do., Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode 6b628eb 14/42: [aa2u] New command: aa2u-rectangle, Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode 45094de 11/42: [aa2u maint] Update HACKING; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode 119855b 15/42: [aa2u] Release: 1.7, Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode dfc56c7 18/42: [aa2u int] Add abstraction: gsr, Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode c25476c 19/42: [aa2u] New command: aa2u-mark-as-text, Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode b9fcf21 21/42: [aa2u maint] Mention TAB infelicity in HACKING; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode 01635f7 07/42: [aa2u int] Add "Tip Jar" URL in Commentary; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode 1de2351 09/42: [aa2u int] Compute vertical/horizontal components separately., Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode 1dd85cc 10/42: [aa2u] Make weight dynamically customizable.,
Stefan Monnier <=
- [elpa] externals/ascii-art-to-unicode 9ab9dbc 03/42: [aa2u] Release: 1.5, Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode c6fac9c 12/42: fixup! [aa2u] Make weight dynamically customizable., Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode 770d0eb 13/42: ascii-art-to-unicode.el (aa2u-replacement): Use cl-case instead of case., Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode 5e2eb49 16/42: [aa2u maint] Add ‘Maintainer’ header per top-level README; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode 9b97434 22/42: [aa2u] New command: aa2u-mark-rectangle-as-text, Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode 507bf63 29/42: [aa2u slog] Handle ‘ucs-names’ that returns a hash table., Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode 461be39 31/42: [aa2u slog] Fix botched bifurcation., Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode c6c696d 33/42: [aa2u maint] Add Kaushal Modi to THANKS; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode 6990a31 35/42: [aa2u maint] Update years in copyright notice; nfc., Stefan Monnier, 2020/11/29
- [elpa] externals/ascii-art-to-unicode 9ad8a5f 37/42: [aa2u] Mention ‘DOUBLE’ in ‘aa2u-uniform-weight’ docstring., Stefan Monnier, 2020/11/29