]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/artist.el
* lisp/descr-text.el (describe-char-unicode-data): Fix copy/paste errors.
[gnu-emacs] / lisp / textmodes / artist.el
index 73521605436767982d3cddaf7348ff01fbd8e2d8..6342110f20beea4548e6ec87e95c5bf8f7ececff 100644 (file)
@@ -1,6 +1,6 @@
 ;;; artist.el --- draw ascii graphics with your mouse
 
-;; Copyright (C) 2000-2015 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2016 Free Software Foundation, Inc.
 
 ;; Author:       Tomas Abrahamsson <tab@lysator.liu.se>
 ;; Maintainer:   Tomas Abrahamsson <tab@lysator.liu.se>
@@ -298,7 +298,7 @@ during the flood-fill."
 (defcustom artist-ellipse-right-char ?\)
   "Character to use at the rightmost position when drawing narrow ellipses.
 
-In this figure, it is the right parenthesis (the ``)'' character):
+In this figure, it is the right parenthesis (the \")\" character):
              -----
             (     )
              -----"
@@ -309,7 +309,7 @@ In this figure, it is the right parenthesis (the ``)'' character):
 (defcustom artist-ellipse-left-char ?\(
   "Character to use at the leftmost position when drawing narrow ellipses.
 
-In this figure, it is the left parenthesis (the ``('' character):
+In this figure, it is the left parenthesis (the \"(\" character):
              -----
             (     )
              -----"
@@ -331,7 +331,7 @@ Accept this many characters cutting off a line and still treat
 it as one line.
 Example:
  If `artist-vaporize-fuzziness' is 2, then those will be recognized as
- lines from A to B (provided you start vaporizing them at the ``*''):
+ lines from A to B (provided you start vaporizing them at the \"*\"):
                          /
             A----*------/-----------B
                       \\/
@@ -342,7 +342,7 @@ Example:
                       \\/ /
             A----*----/\\/----------B
                      / /\\
- (in fact, only the left part [between the A and the leftmost ``/''
+ (in fact, only the left part [between the A and the leftmost \"/\"
  crossing the line] will be vaporized)."
   :group 'artist
   :type 'integer)
@@ -397,8 +397,8 @@ Example:
   ;; This is a defvar, not a defcustom, since the custom
   ;; package shows lists of characters as a lists of integers,
   ;; which is confusing
-  "Characters (``color'') to use when spraying.
-They should be ordered from the ``lightest'' to the ``heaviest''
+  "Characters (\"color\") to use when spraying.
+They should be ordered from the \"lightest\" to the \"heaviest\"
 since spraying replaces a light character with the next heavier one.")
 
 
@@ -1275,7 +1275,7 @@ Drawing with the mouse:
                * Cut copies, then clears the rectangle/square.
 
                * When drawing lines or poly-lines, you can set arrows.
-                 See below under ``Arrows'' for more info.
+                 See below under \"Arrows\" for more info.
 
                * The mode line shows the currently selected drawing operation.
                  In addition, if it has an asterisk (*) at the end, you
@@ -1383,8 +1383,8 @@ Variables
  artist-vaporize-fuzziness      Tolerance when recognizing lines
  artist-spray-interval          Seconds between repeated sprayings
  artist-spray-radius            Size of the spray-area
- artist-spray-chars             The spray-``color''
- artist-spray-new-chars         Initial spray-``color''
+ artist-spray-chars             The spray-\"color\"
+ artist-spray-new-chars         Initial spray-\"color\"
 
 Hooks
 
@@ -2020,7 +2020,7 @@ The replacement is used to convert tabs and new-lines to spaces."
 (defsubst artist-replace-string (string &optional see-thru)
   "Replace contents at point with STRING.
 With optional argument SEE-THRU set to non-nil, text in the buffer
-``shines thru'' blanks in the STRING."
+\"shines thru\" blanks in the STRING."
   (let ((char-list (append string nil))        ; convert the string to a list
        (overwrite-mode 'overwrite-mode-textual)
        (fill-column 32765)             ; Large :-)
@@ -2385,7 +2385,7 @@ in the coord."
 ;; Pretend we are plotting a pixel. Instead we just list it
 ;;
 (defmacro artist-put-pixel (point-list x y)
-  "In POINT-LIST, store a ``pixel'' at coord X,Y."
+  "In POINT-LIST, store a \"pixel\" at coord X,Y."
   `(setq ,point-list
         (append ,point-list (list (artist-new-coord ,x ,y)))))
 
@@ -2873,10 +2873,36 @@ Returns a list of strings."
        (error "Failed to read available fonts: %s (%d)" stderr exit-code))
     (artist-string-split stdout ".flf\n")))
 
+(defun artist-figlet-get-font-list-windows ()
+  "Read in fonts on MS-Windows by collecting output of the `figlet' program.
+Returns a list of strings."
+  (let* ((ls-cmd          "figlet -I2")
+        (result          (artist-system shell-file-name nil
+                                         (list shell-command-switch ls-cmd)))
+        (exit-code       (elt result 0))
+        (stdout          (elt result 1))
+        (stderr          (elt result 2)))
+    (if (not (= exit-code 0))
+       (error "Failed to read available fonts: %s (%d)" stderr exit-code))
+    (let ((dir-list (artist-string-split stdout "\n"))
+          result)
+      (mapc
+       (lambda (dir)
+         (let ((default-directory dir))
+           (setq result (append (file-expand-wildcards "*.flf") result))))
+       dir-list)
+      (mapcar
+       (lambda (file)
+         (replace-regexp-in-string "\.flf\\'" "" file))
+       result))))
+
 (defun artist-figlet-choose-font ()
   "Read any extra arguments for figlet."
   (interactive)
-  (let* ((avail-fonts  (artist-figlet-get-font-list))
+  (let* ((avail-fonts
+          (if (memq system-type '(windows-nt ms-dos))
+              (artist-figlet-get-font-list-windows)
+            (artist-figlet-get-font-list)))
         (font (completing-read (concat "Select font (default "
                                        artist-figlet-default-font
                                        "): ")
@@ -2928,7 +2954,7 @@ This is done by calling the function specified by
 `artist-text-renderer-function', which must return a list of strings,
 to be inserted in the buffer.
 
-Text already in the buffer ``shines thru'' blanks in the rendered text."
+Text already in the buffer \"shines thru\" blanks in the rendered text."
   (let* ((input-text (read-string "Type text to render: "))
         (rendered-text (artist-funcall artist-text-renderer-function input-text)))
     (artist-text-insert-see-thru x y rendered-text)))
@@ -4965,6 +4991,9 @@ The event, EV, is the mouse event."
        (artist-no-rb-set-point1 x1 y1))
     (unwind-protect
         (track-mouse
+          ;; We don't want flickering of mouse pointer shape while we
+          ;; drag the mouse.
+          (setq track-mouse 'dragging)
           (while (or (mouse-movement-p ev)
                      (member 'down (event-modifiers ev)))
             (setq ev-start-pos (artist-coord-win-to-buf