]> code.delx.au - gnu-emacs-elpa/blobdiff - packages/ascii-art-to-unicode/ascii-art-to-unicode.el
[aa2u int] Add "Tip Jar" URL in Commentary; nfc.
[gnu-emacs-elpa] / packages / ascii-art-to-unicode / ascii-art-to-unicode.el
index 894187e30f14853c96c97aa9f132f5cdc3c52c14..7d03a9d72e8883dd634728002b4e0097b52cd115 100644 (file)
@@ -3,7 +3,7 @@
 ;; Copyright (C) 2014  Free Software Foundation, Inc.
 
 ;; Author: Thien-Thi Nguyen <ttn@gnu.org>
-;; Version: 1.5
+;; Version: 1.6
 
 ;; 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
 ;;           │          │
 ;;           └──────────┘
 ;;
-;; TODO:
-;; - Add phase 0, to grok and lock label (as opposed to line) text.
-;; - Add interactive mode, to choose per-line light vs heavy.
-;; - Improve neighbor-determining heuristic.
-;; - Choose plus-replacement by composing "VERTICAL", "LEFT", etc.
-
-;;; News:
-
-;; - 1.5 | 2014-04-03
-;;   - ‘aa2u’ takes args BEG and END
-;;
-;; - 1.4 | 2014-01-14
-;;   - move to ELPA (from <http://www.gnuvola.org/software/j/aa2u/>)
-;;   - change copyright to FSF
-;;   - require 'cl-lib instead of 'cl
-;;   - use ‘cl-flet’ and ‘cl-labels’
-;;   - comment munging
-;;     - add ‘lexical-binding: t’
-;;     - remove huge list at EOF
-;;     - add Author and News headers
-;;
-;; - 1.3 | 2013-09-21
-;;   - bug fixed: ‘?+’ neighbor valuation polarity flipped
-;;   - new support for BOX DRAWINGS LIGHT {UP,DOWN,LEFT,RIGHT} (singleton)
-;;
-;; - 1.2 | 2012-11-05
-;;   - refer to Unicode characters by name, not number
+;; Much easier on the eyes now!
 ;;
-;; - 1.1 | 2012-04-17
-;;   - TAB agnostic
-;;   - ‘aa2u’ operates on active region if ‘use-region-p’
-;;   - example use case also demonstrates transformation
 ;;
-;; - 1.0 | 2012-04-07
-;;   - initial release
+;; 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/>
 
 ;;; Code:
 
@@ -231,7 +202,7 @@ Their values are STRINGIFIER and COMPONENTS, respectively."
 ;;; command
 
 ;;;###autoload
-(defun aa2u (beg end)
+(defun aa2u (beg end &optional interactive)
   "Convert simple ASCII art line drawings to Unicode.
 Specifically, perform the following replacements:
 
@@ -259,7 +230,15 @@ south, east and west neighbors.
 
 This command operates on either the active region,
 or the accessible portion otherwise."
-  (interactive "r")
+  (interactive "r\np")
+  ;; This weirdness, along w/ the undocumented "p" in the ‘interactive’
+  ;; form, is to allow ‘M-x aa2u’ (interactive invocation) w/ no region
+  ;; selected to default to the accessible portion (as documented), which
+  ;; was the norm in ascii-art-to-unicode.el prior to 1.5.  A bugfix,
+  ;; essentially.  This is ugly, unfortunately -- is there a better way?!
+  (when (and interactive (not (region-active-p)))
+    (setq beg (point-min)
+          end (point-max)))
   (save-excursion
     (save-restriction
       (widen)