]> code.delx.au - gnu-emacs/blobdiff - lisp/textmodes/artist.el
Update copyright year to 2015
[gnu-emacs] / lisp / textmodes / artist.el
index 2e90a4bf241b20765be9a36991cc415666c11bff..8a2383c12ffbcd6e83dc822594d8214209c1b6a9 100644 (file)
@@ -1,6 +1,6 @@
 ;;; artist.el --- draw ascii graphics with your mouse
 
-;; Copyright (C) 2000-201 Free Software Foundation, Inc.
+;; Copyright (C) 2000-2015 Free Software Foundation, Inc.
 
 ;; Author:       Tomas Abrahamsson <tab@lysator.liu.se>
 ;; Maintainer:   Tomas Abrahamsson <tab@lysator.liu.se>
 ;; Variables
 
 (defconst artist-version "1.2.6")
-(defconst artist-maintainer-address "tab@lysator.liu.se")
+(defconst artist-maintainer-address "tab@lysator.liu.se, bug-gnu-emacs@gnu.org")
 
 (defvar x-pointer-crosshair)
 
@@ -349,7 +349,7 @@ Example:
 
 
 (defvar artist-pointer-shape (if (eq window-system 'x) x-pointer-crosshair nil)
-  "*If in X Windows, use this pointer shape while drawing with the mouse.")
+  "If in X Windows, use this pointer shape while drawing with the mouse.")
 
 
 (defcustom artist-text-renderer-function 'artist-figlet
@@ -397,13 +397,13 @@ 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.
+  "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.")
 
 
 (defvar artist-spray-new-char ?.
-  "*Initial character to use when spraying.
+  "Initial character to use when spraying.
 This character is used if spraying upon a character that is not in
 `artist-spray-chars'.  The character defined by this variable should
 be in `artist-spray-chars', or spraying will behave strangely.")
@@ -535,7 +535,8 @@ This variable is initialized by the `artist-make-prev-next-op-alist' function.")
                  ("Text" artist-select-op-text-overwrite text-ovwrt)
                  ("Ellipse" artist-select-op-circle circle)
                  ("Poly-line" artist-select-op-straight-poly-line spolyline)
-                 ("Rectangle" artist-select-op-square square)
+                 ("Square" artist-select-op-square square)
+                 ("Rectangle" artist-select-op-rectangle rectangle)
                  ("Line" artist-select-op-straight-line s-line)
                  ("Pen" artist-select-op-pen-line pen-line)))
       (define-key map (vector (nth 2 op))
@@ -1196,9 +1197,9 @@ PREV-OP-ARG are used when invoked recursively during the build-up."
 ;;; ---------------------------------
 
 ;;;###autoload
-(defun artist-mode (&optional state)
+(define-minor-mode artist-mode
   "Toggle Artist mode.
-With argument STATE, turn Artist mode on if STATE is positive.
+With argument ARG, turn Artist mode on if ARG is positive.
 Artist lets you draw lines, squares, rectangles and poly-lines,
 ellipses and circles with your mouse and/or keyboard.
 
@@ -1387,36 +1388,24 @@ Variables
 
 Hooks
 
- When entering artist-mode, the hook `artist-mode-init-hook' is called.
- When quitting artist-mode, the hook `artist-mode-exit-hook' is called.
+ Turning the mode on or off runs `artist-mode-hook'.
 
 
 Keymap summary
 
 \\{artist-mode-map}"
-  (interactive)
-  (if (setq artist-mode
-           (if (null state) (not artist-mode)
-             (> (prefix-numeric-value state) 0)))
-      (artist-mode-init)
-    (artist-mode-exit)))
-
-;; insert our minor mode string
-(or (assq 'artist-mode minor-mode-alist)
-    (setq minor-mode-alist
-         (cons '(artist-mode artist-mode-name)
-               minor-mode-alist)))
-
-;; insert our minor mode keymap
-(or (assq 'artist-mode minor-mode-map-alist)
-    (setq minor-mode-map-alist
-         (cons (cons 'artist-mode artist-mode-map)
-               minor-mode-map-alist)))
-
+  :init-value nil :group 'artist :lighter artist-mode-name
+  :keymap artist-mode-map
+  (cond ((null artist-mode)
+        ;; Turn mode off
+        (artist-mode-exit))
+       (t
+        ;; Turn mode on
+        (artist-mode-init))))
 
 ;; Init and exit
 (defun artist-mode-init ()
-  "Init Artist mode.  This will call the hook `artist-mode-init-hook'."
+  "Init Artist mode.  This will call the hook `artist-mode-hook'."
   ;; Set up a conversion table for mapping tabs and new-lines to spaces.
   ;; the last case, 0, is for the last position in buffer/region, where
   ;; the `following-char' function returns 0.
@@ -1458,15 +1447,15 @@ Keymap summary
       (progn
        (picture-mode)
        (message "")))
-  (run-hooks 'artist-mode-init-hook)
   (artist-mode-line-show-curr-operation artist-key-is-drawing))
 
+(declare-function picture-mode-exit "picture" (&optional nostrip))
+
 (defun artist-mode-exit ()
-  "Exit Artist mode.  This will call the hook `artist-mode-exit-hook'."
+  "Exit Artist mode.  This will call the hook `artist-mode-hook'."
   (if (and artist-picture-compatibility (eq major-mode 'picture-mode))
       (picture-mode-exit))
-  (kill-local-variable 'next-line-add-newlines)
-  (run-hooks 'artist-mode-exit-hook))
+  (kill-local-variable 'next-line-add-newlines))
 
 (defun artist-mode-off ()
   "Turn Artist mode off."
@@ -1803,7 +1792,7 @@ info-variant-part."
 ;;
 (defmacro artist-funcall (fn &rest args)
   "Call function FN with ARGS, if FN is not nil."
-  (list 'if fn (cons 'funcall (cons fn args))))
+  `(if ,fn (funcall ,fn ,@args)))
 
 (defun artist-uniq (l)
   "Remove consecutive duplicates in list L.  Comparison is done with `equal'."
@@ -2397,8 +2386,8 @@ in the coord."
 ;;
 (defmacro artist-put-pixel (point-list x y)
   "In POINT-LIST, store a ``pixel'' at coord X,Y."
-  (list 'setq point-list
-       (list 'append point-list (list 'list (list 'artist-new-coord x y)))))
+  `(setq ,point-list
+        (append ,point-list (list (artist-new-coord ,x ,y)))))
 
 ;; Calculate list of points using eight point algorithm
 ;; return a list of coords