aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Stevenson2012-04-11 13:57:21 +0200
committerLars Magne Ingebrigtsen2012-04-11 13:57:21 +0200
commitac3cf14a977761afbd00edf753307993c00fb8fd (patch)
treec78682866bbed3fe0108e3e298ed9b94ca189c09
parent0fc59f1e602e53c96669fa0b93a99c46472af534 (diff)
downloademacs-ac3cf14a977761afbd00edf753307993c00fb8fd.tar.gz
emacs-ac3cf14a977761afbd00edf753307993c00fb8fd.zip
(artist-mode): Convert artist-mode to use define-minor-mode.
Fixes: debbugs:10760
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/textmodes/artist.el42
2 files changed, 19 insertions, 28 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index a3a633c86fe..e77cb1c8200 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12012-04-11 William Stevenson <yhvh2000@gmail.com>
2
3 * textmodes/artist.el (artist-mode): Convert artist-mode to use
4 define-minor-mode (bug#10760).
5
12011-12-20 Wolfgang Jenkner <wjenkner@inode.at> 62011-12-20 Wolfgang Jenkner <wjenkner@inode.at>
2 7
3 * lisp/progmodes/grep.el (rgrep): Tweak the find command line so 8 * lisp/progmodes/grep.el (rgrep): Tweak the find command line so
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index dedbfcbf338..76d03dd164f 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -1197,9 +1197,9 @@ PREV-OP-ARG are used when invoked recursively during the build-up."
1197;;; --------------------------------- 1197;;; ---------------------------------
1198 1198
1199;;;###autoload 1199;;;###autoload
1200(defun artist-mode (&optional state) 1200(define-minor-mode artist-mode
1201 "Toggle Artist mode. 1201 "Toggle Artist mode.
1202With argument STATE, turn Artist mode on if STATE is positive. 1202With argument ARG, turn Artist mode on if ARG is positive.
1203Artist lets you draw lines, squares, rectangles and poly-lines, 1203Artist lets you draw lines, squares, rectangles and poly-lines,
1204ellipses and circles with your mouse and/or keyboard. 1204ellipses and circles with your mouse and/or keyboard.
1205 1205
@@ -1388,36 +1388,24 @@ Variables
1388 1388
1389Hooks 1389Hooks
1390 1390
1391 When entering artist-mode, the hook `artist-mode-init-hook' is called. 1391 Turning the mode on or off runs `artist-mode-hook'.
1392 When quitting artist-mode, the hook `artist-mode-exit-hook' is called.
1393 1392
1394 1393
1395Keymap summary 1394Keymap summary
1396 1395
1397\\{artist-mode-map}" 1396\\{artist-mode-map}"
1398 (interactive) 1397 :init-value nil :group 'artist :lighter artist-mode-name
1399 (if (setq artist-mode 1398 :keymap artist-mode-map
1400 (if (null state) (not artist-mode) 1399 (cond ((null artist-mode)
1401 (> (prefix-numeric-value state) 0))) 1400 ;; Turn mode off
1402 (artist-mode-init) 1401 (artist-mode-exit))
1403 (artist-mode-exit))) 1402 (t
1404 1403 ;; Turn mode on
1405;; insert our minor mode string 1404 (artist-mode-init))))
1406(or (assq 'artist-mode minor-mode-alist)
1407 (setq minor-mode-alist
1408 (cons '(artist-mode artist-mode-name)
1409 minor-mode-alist)))
1410
1411;; insert our minor mode keymap
1412(or (assq 'artist-mode minor-mode-map-alist)
1413 (setq minor-mode-map-alist
1414 (cons (cons 'artist-mode artist-mode-map)
1415 minor-mode-map-alist)))
1416
1417 1405
1418;; Init and exit 1406;; Init and exit
1419(defun artist-mode-init () 1407(defun artist-mode-init ()
1420 "Init Artist mode. This will call the hook `artist-mode-init-hook'." 1408 "Init Artist mode. This will call the hook `artist-mode-hook'."
1421 ;; Set up a conversion table for mapping tabs and new-lines to spaces. 1409 ;; Set up a conversion table for mapping tabs and new-lines to spaces.
1422 ;; the last case, 0, is for the last position in buffer/region, where 1410 ;; the last case, 0, is for the last position in buffer/region, where
1423 ;; the `following-char' function returns 0. 1411 ;; the `following-char' function returns 0.
@@ -1459,15 +1447,13 @@ Keymap summary
1459 (progn 1447 (progn
1460 (picture-mode) 1448 (picture-mode)
1461 (message ""))) 1449 (message "")))
1462 (run-hooks 'artist-mode-init-hook)
1463 (artist-mode-line-show-curr-operation artist-key-is-drawing)) 1450 (artist-mode-line-show-curr-operation artist-key-is-drawing))
1464 1451
1465(defun artist-mode-exit () 1452(defun artist-mode-exit ()
1466 "Exit Artist mode. This will call the hook `artist-mode-exit-hook'." 1453 "Exit Artist mode. This will call the hook `artist-mode-hook'."
1467 (if (and artist-picture-compatibility (eq major-mode 'picture-mode)) 1454 (if (and artist-picture-compatibility (eq major-mode 'picture-mode))
1468 (picture-mode-exit)) 1455 (picture-mode-exit))
1469 (kill-local-variable 'next-line-add-newlines) 1456 (kill-local-variable 'next-line-add-newlines))
1470 (run-hooks 'artist-mode-exit-hook))
1471 1457
1472(defun artist-mode-off () 1458(defun artist-mode-off ()
1473 "Turn Artist mode off." 1459 "Turn Artist mode off."