[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r107869: (artist-mode): Convert artis
From: |
Lars Magne Ingebrigtsen |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r107869: (artist-mode): Convert artist-mode to use define-minor-mode. |
Date: |
Wed, 11 Apr 2012 13:57:21 +0200 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 107869
fixes bug(s): http://debbugs.gnu.org/10760
author: William Stevenson <address@hidden>
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Wed 2012-04-11 13:57:21 +0200
message:
(artist-mode): Convert artist-mode to use define-minor-mode.
modified:
lisp/ChangeLog
lisp/textmodes/artist.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-04-11 11:39:35 +0000
+++ b/lisp/ChangeLog 2012-04-11 11:57:21 +0000
@@ -1,3 +1,8 @@
+2012-04-11 William Stevenson <address@hidden>
+
+ * textmodes/artist.el (artist-mode): Convert artist-mode to use
+ define-minor-mode (bug#10760).
+
2011-12-20 Wolfgang Jenkner <address@hidden>
* lisp/progmodes/grep.el (rgrep): Tweak the find command line so
=== modified file 'lisp/textmodes/artist.el'
--- a/lisp/textmodes/artist.el 2012-04-09 13:05:48 +0000
+++ b/lisp/textmodes/artist.el 2012-04-11 11:57:21 +0000
@@ -1197,9 +1197,9 @@
;;; ---------------------------------
;;;###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.
@@ -1388,36 +1388,24 @@
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.
@@ -1459,15 +1447,13 @@
(progn
(picture-mode)
(message "")))
- (run-hooks 'artist-mode-init-hook)
(artist-mode-line-show-curr-operation artist-key-is-drawing))
(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."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r107869: (artist-mode): Convert artist-mode to use define-minor-mode.,
Lars Magne Ingebrigtsen <=