From unknown Thu Sep 11 09:18:24 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#10760 <10760@debbugs.gnu.org> To: bug#10760 <10760@debbugs.gnu.org> Subject: Status: 24.0.93; [patch] Convert artist-mode to use define-minor-mode Reply-To: bug#10760 <10760@debbugs.gnu.org> Date: Thu, 11 Sep 2025 16:18:24 +0000 retitle 10760 24.0.93; [patch] Convert artist-mode to use define-minor-mode reassign 10760 emacs submitter 10760 William Stevenson severity 10760 minor tag 10760 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 08 02:14:14 2012 Received: (at submit) by debbugs.gnu.org; 8 Feb 2012 07:14:14 +0000 Received: from localhost ([127.0.0.1]:59846 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rv1jI-0007h5-Ur for submit@debbugs.gnu.org; Wed, 08 Feb 2012 02:14:14 -0500 Received: from eggs.gnu.org ([140.186.70.92]:35309) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rv1jB-0007gO-AJ for submit@debbugs.gnu.org; Wed, 08 Feb 2012 02:14:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rv1i5-0001R2-Jk for submit@debbugs.gnu.org; Wed, 08 Feb 2012 02:12:59 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:43660) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rv1i5-0001Qy-ID for submit@debbugs.gnu.org; Wed, 08 Feb 2012 02:12:57 -0500 Received: from eggs.gnu.org ([140.186.70.92]:46334) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rv1i3-0003hB-Oi for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2012 02:12:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rv1i1-0001QZ-KJ for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2012 02:12:55 -0500 Received: from plane.gmane.org ([80.91.229.3]:48677) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rv1i1-0001QJ-79 for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2012 02:12:53 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Rv1hy-0005rJ-9E for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2012 08:12:50 +0100 Received: from cpc10-belf9-2-0-cust411.2-1.cable.virginmedia.com ([86.24.57.156]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Feb 2012 08:12:50 +0100 Received: from yhvh2000 by cpc10-belf9-2-0-cust411.2-1.cable.virginmedia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Feb 2012 08:12:50 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: William Stevenson Subject: 24.0.93; [patch] Convert artist-mode to use define-minor-mode Date: Wed, 08 Feb 2012 07:12:38 +0000 Lines: 364 Message-ID: <87fwelztll.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cpc10-belf9-2-0-cust411.2-1.cable.virginmedia.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) Cancel-Lock: sha1:XIVOFNB7URz3DZrBVjATyTMvTCg= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit Cc: tab@lysator.liu.se X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) This is my first patch concerning the item in etc/TODO: ** Check what minor modes don't use define-minor-mode and convert them to use it. Please look carefully at the change I made to the last item in the mode-map. The original code was: (define-key map [menu-bar artist] (cons "Artist" artist-menu-map)) I found I needed to change this to: ([menu-bar artist] . artist-menu-map)) This works the same, but I'm unsure as to any wider effects it may have. Also consider removing as redundant the function artist-mode-off, the keymap for this and the mention in the documentation. After the changes artist-mode-name was only referred to in artist-mode-line-show-curr-operation, and it seemed sensible to replace it with the string, as in this case it is just concat'ed to "/". I have cc'ed the maintainer Tomas Abrahamsson this message. === modified file 'lisp/textmodes/artist.el' *** lisp/textmodes/artist.el 2012-01-19 07:21:25 +0000 --- lisp/textmodes/artist.el 2012-02-08 07:09:41 +0000 *************** *** 415,427 **** ;; Internal variables ;; - (defvar artist-mode nil - "Non-nil to enable `artist-mode' and nil to disable.") - (make-variable-buffer-local 'artist-mode) - - (defvar artist-mode-name " Artist" - "Name of Artist mode beginning with a space (appears in the mode-line).") - (defvar artist-curr-go 'pen-line "Current selected graphics operation.") (make-variable-buffer-local 'artist-curr-go) --- 415,420 ---- *************** *** 545,606 **** :button (:radio . (eq artist-curr-go ',(nth 2 op)))))) map)) - (defvar artist-mode-map - (let ((map (make-sparse-keymap))) - (setq artist-mode-map (make-sparse-keymap)) - (define-key map [down-mouse-1] 'artist-down-mouse-1) - (define-key map [S-down-mouse-1] 'artist-down-mouse-1) - (define-key map [down-mouse-2] 'artist-mouse-choose-operation) - (define-key map [S-down-mouse-2] 'artist-mouse-choose-operation) - (define-key map [down-mouse-3] 'artist-down-mouse-3) - (define-key map [S-down-mouse-3] 'artist-down-mouse-3) - (define-key map [C-mouse-4] 'artist-select-prev-op-in-list) - (define-key map [C-mouse-5] 'artist-select-next-op-in-list) - (define-key map "\r" 'artist-key-set-point) ; return - (define-key map [up] 'artist-previous-line) - (define-key map "\C-p" 'artist-previous-line) - (define-key map [down] 'artist-next-line) - (define-key map "\C-n" 'artist-next-line) - (define-key map [left] 'artist-backward-char) - (define-key map "\C-b" 'artist-backward-char) - (define-key map [right] 'artist-forward-char) - (define-key map "\C-f" 'artist-forward-char) - (define-key map "<" 'artist-toggle-first-arrow) - (define-key map ">" 'artist-toggle-second-arrow) - (define-key map "\C-c\C-a\C-e" 'artist-select-erase-char) - (define-key map "\C-c\C-a\C-f" 'artist-select-fill-char) - (define-key map "\C-c\C-a\C-l" 'artist-select-line-char) - (define-key map "\C-c\C-a\C-o" 'artist-select-operation) - (define-key map "\C-c\C-a\C-r" 'artist-toggle-rubber-banding) - (define-key map "\C-c\C-a\C-t" 'artist-toggle-trim-line-endings) - (define-key map "\C-c\C-a\C-s" 'artist-toggle-borderless-shapes) - (define-key map "\C-c\C-c" 'artist-mode-off) - (define-key map "\C-c\C-al" 'artist-select-op-line) - (define-key map "\C-c\C-aL" 'artist-select-op-straight-line) - (define-key map "\C-c\C-ar" 'artist-select-op-rectangle) - (define-key map "\C-c\C-aR" 'artist-select-op-square) - (define-key map "\C-c\C-as" 'artist-select-op-square) - (define-key map "\C-c\C-ap" 'artist-select-op-poly-line) - (define-key map "\C-c\C-aP" 'artist-select-op-straight-poly-line) - (define-key map "\C-c\C-ae" 'artist-select-op-ellipse) - (define-key map "\C-c\C-ac" 'artist-select-op-circle) - (define-key map "\C-c\C-at" 'artist-select-op-text-see-thru) - (define-key map "\C-c\C-aT" 'artist-select-op-text-overwrite) - (define-key map "\C-c\C-aS" 'artist-select-op-spray-can) - (define-key map "\C-c\C-az" 'artist-select-op-spray-set-size) - (define-key map "\C-c\C-a\C-d" 'artist-select-op-erase-char) - (define-key map "\C-c\C-aE" 'artist-select-op-erase-rectangle) - (define-key map "\C-c\C-av" 'artist-select-op-vaporize-line) - (define-key map "\C-c\C-aV" 'artist-select-op-vaporize-lines) - (define-key map "\C-c\C-a\C-k" 'artist-select-op-cut-rectangle) - (define-key map "\C-c\C-a\M-w" 'artist-select-op-copy-rectangle) - (define-key map "\C-c\C-a\C-y" 'artist-select-op-paste) - (define-key map "\C-c\C-af" 'artist-select-op-flood-fill) - (define-key map "\C-c\C-a\C-b" 'artist-submit-bug-report) - (define-key map [menu-bar artist] (cons "Artist" artist-menu-map)) - map) - "Keymap for `artist-minor-mode'.") - (defvar artist-replacement-table (make-vector 256 0) "Replacement table for `artist-replace-char'.") --- 538,543 ---- *************** *** 1196,1204 **** ;;; --------------------------------- ;;;###autoload ! (defun artist-mode (&optional state) "Toggle Artist mode. ! With argument STATE, turn Artist mode on if STATE is positive. Artist lets you draw lines, squares, rectangles and poly-lines, ellipses and circles with your mouse and/or keyboard. --- 1133,1141 ---- ;;; --------------------------------- ;;;###autoload ! (define-minor-mode artist-mode "Toggle Artist mode. ! 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. *************** *** 1227,1233 **** -------------------------------------------------------------- Pen fill-char at point line from last point to new point ! -------------------------------------------------------------- Line Line in any direction Straight line -------------------------------------------------------------- Rectangle Rectangle Square --- 1164,1170 ---- -------------------------------------------------------------- Pen fill-char at point line from last point to new point ! -------------------------------------------------------------- Line Line in any direction Straight line -------------------------------------------------------------- Rectangle Rectangle Square *************** *** 1387,1472 **** 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. 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 and exit ! (defun artist-mode-init () ! "Init Artist mode. This will call the hook `artist-mode-init-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. ! (let ((i 0)) ! (while (< i 256) ! (aset artist-replacement-table i i) ! (setq i (1+ i)))) ! (aset artist-replacement-table ?\n ?\s) ! (aset artist-replacement-table ?\t ?\s) ! (aset artist-replacement-table 0 ?\s) ! ;; More setup ! (make-local-variable 'artist-key-is-drawing) ! (make-local-variable 'artist-key-endpoint1) ! (make-local-variable 'artist-key-poly-point-list) ! (make-local-variable 'artist-key-shape) ! (make-local-variable 'artist-key-draw-how) ! (make-local-variable 'artist-popup-menu-table) ! (make-local-variable 'artist-key-compl-table) ! (make-local-variable 'artist-prev-next-op-alist) ! (make-local-variable 'artist-rb-save-data) ! (make-local-variable 'artist-arrow-point-1) ! (make-local-variable 'artist-arrow-point-2) ! (setq artist-key-is-drawing nil) ! (setq artist-key-endpoint1 nil) ! (setq artist-key-poly-point-list nil) ! (setq artist-key-shape nil) ! (setq artist-popup-menu-table (artist-compute-popup-menu-table artist-mt)) ! (setq artist-key-compl-table (artist-compute-key-compl-table artist-mt)) ! (setq artist-prev-next-op-alist ! (artist-make-prev-next-op-alist artist-key-compl-table)) ! (setq artist-rb-save-data (make-vector 7 0)) ! (setq artist-arrow-point-1 nil) ! (setq artist-arrow-point-2 nil) ! (make-local-variable 'next-line-add-newlines) ! (setq next-line-add-newlines t) ! (setq artist-key-draw-how ! (artist-go-get-draw-how-from-symbol artist-curr-go)) ! (if (and artist-picture-compatibility (not (eq major-mode 'picture-mode))) ! (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'." ! (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)) (defun artist-mode-off () "Turn Artist mode off." --- 1324,1438 ---- Hooks ! Turning the mode on or off runs `artist-mode-hook'. Keymap summary \\{artist-mode-map}" ! :init-value nil :group 'artist :lighter " Artist" ! :keymap ! '(([down-mouse-1] . artist-down-mouse-1) ! ([S-down-mouse-1] . artist-down-mouse-1) ! ([down-mouse-2] . artist-mouse-choose-operation) ! ([S-down-mouse-2] . artist-mouse-choose-operation) ! ([down-mouse-3] . artist-down-mouse-3) ! ([S-down-mouse-3] . artist-down-mouse-3) ! ([C-mouse-4] . artist-select-prev-op-in-list) ! ([C-mouse-5] . artist-select-next-op-in-list) ! ("\r" . artist-key-set-point) ; return ! ([up] . artist-previous-line) ! ("\C-p" . artist-previous-line) ! ([down] . artist-next-line) ! ("\C-n" . artist-next-line) ! ([left] . artist-backward-char) ! ("\C-b" . artist-backward-char) ! ([right] . artist-forward-char) ! ("\C-f" . artist-forward-char) ! ("<" . artist-toggle-first-arrow) ! (">" . artist-toggle-second-arrow) ! ("\C-c\C-a\C-e" . artist-select-erase-char) ! ("\C-c\C-a\C-f" . artist-select-fill-char) ! ("\C-c\C-a\C-l" . artist-select-line-char) ! ("\C-c\C-a\C-o" . artist-select-operation) ! ("\C-c\C-a\C-r" . artist-toggle-rubber-banding) ! ("\C-c\C-a\C-t" . artist-toggle-trim-line-endings) ! ("\C-c\C-a\C-s" . artist-toggle-borderless-shapes) ! ("\C-c\C-c" . artist-mode-off) ! ("\C-c\C-al" . artist-select-op-line) ! ("\C-c\C-aL" . artist-select-op-straight-line) ! ("\C-c\C-ar" . artist-select-op-rectangle) ! ("\C-c\C-aR" . artist-select-op-square) ! ("\C-c\C-as" . artist-select-op-square) ! ("\C-c\C-ap" . artist-select-op-poly-line) ! ("\C-c\C-aP" . artist-select-op-straight-poly-line) ! ("\C-c\C-ae" . artist-select-op-ellipse) ! ("\C-c\C-ac" . artist-select-op-circle) ! ("\C-c\C-at" . artist-select-op-text-see-thru) ! ("\C-c\C-aT" . artist-select-op-text-overwrite) ! ("\C-c\C-aS" . artist-select-op-spray-can) ! ("\C-c\C-az" . artist-select-op-spray-set-size) ! ("\C-c\C-a\C-d" . artist-select-op-erase-char) ! ("\C-c\C-aE" . artist-select-op-erase-rectangle) ! ("\C-c\C-av" . artist-select-op-vaporize-line) ! ("\C-c\C-aV" . artist-select-op-vaporize-lines) ! ("\C-c\C-a\C-k" . artist-select-op-cut-rectangle) ! ("\C-c\C-a\M-w" . artist-select-op-copy-rectangle) ! ("\C-c\C-a\C-y" . artist-select-op-paste) ! ("\C-c\C-af" . artist-select-op-flood-fill) ! ("\C-c\C-a\C-b" . artist-submit-bug-report) ! ([menu-bar artist] . artist-menu-map)) ! (cond ((null artist-mode) ! ;; Turn mode off ! (if (and artist-picture-compatibility (eq major-mode 'picture-mode)) ! (picture-mode-exit)) ! (kill-local-variable 'next-line-add-newlines)) ! ! (t ! ;; Turn mode on ! ;; 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. ! (let ((i 0)) ! (while (< i 256) ! (aset artist-replacement-table i i) ! (setq i (1+ i)))) ! (aset artist-replacement-table ?\n ?\s) ! (aset artist-replacement-table ?\t ?\s) ! (aset artist-replacement-table 0 ?\s) ! ;; More setup ! (make-local-variable 'artist-key-is-drawing) ! (make-local-variable 'artist-key-endpoint1) ! (make-local-variable 'artist-key-poly-point-list) ! (make-local-variable 'artist-key-shape) ! (make-local-variable 'artist-key-draw-how) ! (make-local-variable 'artist-popup-menu-table) ! (make-local-variable 'artist-key-compl-table) ! (make-local-variable 'artist-prev-next-op-alist) ! (make-local-variable 'artist-rb-save-data) ! (make-local-variable 'artist-arrow-point-1) ! (make-local-variable 'artist-arrow-point-2) ! (setq artist-key-is-drawing nil) ! (setq artist-key-endpoint1 nil) ! (setq artist-key-poly-point-list nil) ! (setq artist-key-shape nil) ! (setq artist-popup-menu-table (artist-compute-popup-menu-table artist-mt)) ! (setq artist-key-compl-table (artist-compute-key-compl-table artist-mt)) ! (setq artist-prev-next-op-alist ! (artist-make-prev-next-op-alist artist-key-compl-table)) ! (setq artist-rb-save-data (make-vector 7 0)) ! (setq artist-arrow-point-1 nil) ! (setq artist-arrow-point-2 nil) ! (make-local-variable 'next-line-add-newlines) ! (setq next-line-add-newlines t) ! (setq artist-key-draw-how ! (artist-go-get-draw-how-from-symbol artist-curr-go)) ! (if (and artist-picture-compatibility (not (eq major-mode 'picture-mode))) ! (progn ! (picture-mode) ! (message ""))) ! (artist-mode-line-show-curr-operation artist-key-is-drawing)))) ! (defun artist-mode-off () "Turn Artist mode off." *************** *** 1484,1490 **** (defun artist-mode-line-show-curr-operation (is-drawing) "Show current operation in mode-line. If IS-DRAWING, show that." ! (let ((mtext (concat artist-mode-name "/" (artist-go-get-mode-line-from-symbol artist-curr-go) (if is-drawing "/*" "")))) (setcdr (assq 'artist-mode minor-mode-alist) (list mtext))) --- 1450,1456 ---- (defun artist-mode-line-show-curr-operation (is-drawing) "Show current operation in mode-line. If IS-DRAWING, show that." ! (let ((mtext (concat " Artist/" (artist-go-get-mode-line-from-symbol artist-curr-go) (if is-drawing "/*" "")))) (setcdr (assq 'artist-mode minor-mode-alist) (list mtext))) From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 08 02:36:23 2012 Received: (at submit) by debbugs.gnu.org; 8 Feb 2012 07:36:23 +0000 Received: from localhost ([127.0.0.1]:59853 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rv24j-0008CW-VN for submit@debbugs.gnu.org; Wed, 08 Feb 2012 02:36:22 -0500 Received: from eggs.gnu.org ([140.186.70.92]:37051) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rv24S-0008Bo-Pj for submit@debbugs.gnu.org; Wed, 08 Feb 2012 02:36:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rv23N-0005OR-K5 for submit@debbugs.gnu.org; Wed, 08 Feb 2012 02:34:59 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:39968) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rv23N-0005ON-IV for submit@debbugs.gnu.org; Wed, 08 Feb 2012 02:34:57 -0500 Received: from eggs.gnu.org ([140.186.70.92]:49324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rv23L-0008T8-QK for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2012 02:34:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rv23J-0005O6-M5 for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2012 02:34:55 -0500 Received: from plane.gmane.org ([80.91.229.3]:44763) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rv23J-0005O1-9Q for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2012 02:34:53 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Rv23G-00063d-PC for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2012 08:34:50 +0100 Received: from cpc10-belf9-2-0-cust411.2-1.cable.virginmedia.com ([86.24.57.156]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Feb 2012 08:34:50 +0100 Received: from yhvh2000 by cpc10-belf9-2-0-cust411.2-1.cable.virginmedia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 08 Feb 2012 08:34:50 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: William Stevenson Subject: Re: bug#10760: 24.0.93; [patch] Convert artist-mode to use define-minor-mode Date: Wed, 08 Feb 2012 07:34:37 +0000 Lines: 331 Message-ID: <877gzxzsky.fsf@gmail.com> References: <87fwelztll.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cpc10-belf9-2-0-cust411.2-1.cable.virginmedia.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) Cancel-Lock: sha1:QmLuG+tvquTcH2NOu4qVcSrNhLM= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) Apologies, an error snuck in to that last diff, a line in the doc was changed uselessly. === modified file 'lisp/textmodes/artist.el' *** lisp/textmodes/artist.el 2012-01-19 07:21:25 +0000 --- lisp/textmodes/artist.el 2012-02-08 07:28:48 +0000 *************** *** 415,427 **** ;; Internal variables ;; - (defvar artist-mode nil - "Non-nil to enable `artist-mode' and nil to disable.") - (make-variable-buffer-local 'artist-mode) - - (defvar artist-mode-name " Artist" - "Name of Artist mode beginning with a space (appears in the mode-line).") - (defvar artist-curr-go 'pen-line "Current selected graphics operation.") (make-variable-buffer-local 'artist-curr-go) --- 415,420 ---- *************** *** 545,606 **** :button (:radio . (eq artist-curr-go ',(nth 2 op)))))) map)) - (defvar artist-mode-map - (let ((map (make-sparse-keymap))) - (setq artist-mode-map (make-sparse-keymap)) - (define-key map [down-mouse-1] 'artist-down-mouse-1) - (define-key map [S-down-mouse-1] 'artist-down-mouse-1) - (define-key map [down-mouse-2] 'artist-mouse-choose-operation) - (define-key map [S-down-mouse-2] 'artist-mouse-choose-operation) - (define-key map [down-mouse-3] 'artist-down-mouse-3) - (define-key map [S-down-mouse-3] 'artist-down-mouse-3) - (define-key map [C-mouse-4] 'artist-select-prev-op-in-list) - (define-key map [C-mouse-5] 'artist-select-next-op-in-list) - (define-key map "\r" 'artist-key-set-point) ; return - (define-key map [up] 'artist-previous-line) - (define-key map "\C-p" 'artist-previous-line) - (define-key map [down] 'artist-next-line) - (define-key map "\C-n" 'artist-next-line) - (define-key map [left] 'artist-backward-char) - (define-key map "\C-b" 'artist-backward-char) - (define-key map [right] 'artist-forward-char) - (define-key map "\C-f" 'artist-forward-char) - (define-key map "<" 'artist-toggle-first-arrow) - (define-key map ">" 'artist-toggle-second-arrow) - (define-key map "\C-c\C-a\C-e" 'artist-select-erase-char) - (define-key map "\C-c\C-a\C-f" 'artist-select-fill-char) - (define-key map "\C-c\C-a\C-l" 'artist-select-line-char) - (define-key map "\C-c\C-a\C-o" 'artist-select-operation) - (define-key map "\C-c\C-a\C-r" 'artist-toggle-rubber-banding) - (define-key map "\C-c\C-a\C-t" 'artist-toggle-trim-line-endings) - (define-key map "\C-c\C-a\C-s" 'artist-toggle-borderless-shapes) - (define-key map "\C-c\C-c" 'artist-mode-off) - (define-key map "\C-c\C-al" 'artist-select-op-line) - (define-key map "\C-c\C-aL" 'artist-select-op-straight-line) - (define-key map "\C-c\C-ar" 'artist-select-op-rectangle) - (define-key map "\C-c\C-aR" 'artist-select-op-square) - (define-key map "\C-c\C-as" 'artist-select-op-square) - (define-key map "\C-c\C-ap" 'artist-select-op-poly-line) - (define-key map "\C-c\C-aP" 'artist-select-op-straight-poly-line) - (define-key map "\C-c\C-ae" 'artist-select-op-ellipse) - (define-key map "\C-c\C-ac" 'artist-select-op-circle) - (define-key map "\C-c\C-at" 'artist-select-op-text-see-thru) - (define-key map "\C-c\C-aT" 'artist-select-op-text-overwrite) - (define-key map "\C-c\C-aS" 'artist-select-op-spray-can) - (define-key map "\C-c\C-az" 'artist-select-op-spray-set-size) - (define-key map "\C-c\C-a\C-d" 'artist-select-op-erase-char) - (define-key map "\C-c\C-aE" 'artist-select-op-erase-rectangle) - (define-key map "\C-c\C-av" 'artist-select-op-vaporize-line) - (define-key map "\C-c\C-aV" 'artist-select-op-vaporize-lines) - (define-key map "\C-c\C-a\C-k" 'artist-select-op-cut-rectangle) - (define-key map "\C-c\C-a\M-w" 'artist-select-op-copy-rectangle) - (define-key map "\C-c\C-a\C-y" 'artist-select-op-paste) - (define-key map "\C-c\C-af" 'artist-select-op-flood-fill) - (define-key map "\C-c\C-a\C-b" 'artist-submit-bug-report) - (define-key map [menu-bar artist] (cons "Artist" artist-menu-map)) - map) - "Keymap for `artist-minor-mode'.") - (defvar artist-replacement-table (make-vector 256 0) "Replacement table for `artist-replace-char'.") --- 538,543 ---- *************** *** 1196,1204 **** ;;; --------------------------------- ;;;###autoload ! (defun artist-mode (&optional state) "Toggle Artist mode. ! With argument STATE, turn Artist mode on if STATE is positive. Artist lets you draw lines, squares, rectangles and poly-lines, ellipses and circles with your mouse and/or keyboard. --- 1133,1141 ---- ;;; --------------------------------- ;;;###autoload ! (define-minor-mode artist-mode "Toggle Artist mode. ! 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,1472 **** 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. 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 and exit ! (defun artist-mode-init () ! "Init Artist mode. This will call the hook `artist-mode-init-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. ! (let ((i 0)) ! (while (< i 256) ! (aset artist-replacement-table i i) ! (setq i (1+ i)))) ! (aset artist-replacement-table ?\n ?\s) ! (aset artist-replacement-table ?\t ?\s) ! (aset artist-replacement-table 0 ?\s) ! ;; More setup ! (make-local-variable 'artist-key-is-drawing) ! (make-local-variable 'artist-key-endpoint1) ! (make-local-variable 'artist-key-poly-point-list) ! (make-local-variable 'artist-key-shape) ! (make-local-variable 'artist-key-draw-how) ! (make-local-variable 'artist-popup-menu-table) ! (make-local-variable 'artist-key-compl-table) ! (make-local-variable 'artist-prev-next-op-alist) ! (make-local-variable 'artist-rb-save-data) ! (make-local-variable 'artist-arrow-point-1) ! (make-local-variable 'artist-arrow-point-2) ! (setq artist-key-is-drawing nil) ! (setq artist-key-endpoint1 nil) ! (setq artist-key-poly-point-list nil) ! (setq artist-key-shape nil) ! (setq artist-popup-menu-table (artist-compute-popup-menu-table artist-mt)) ! (setq artist-key-compl-table (artist-compute-key-compl-table artist-mt)) ! (setq artist-prev-next-op-alist ! (artist-make-prev-next-op-alist artist-key-compl-table)) ! (setq artist-rb-save-data (make-vector 7 0)) ! (setq artist-arrow-point-1 nil) ! (setq artist-arrow-point-2 nil) ! (make-local-variable 'next-line-add-newlines) ! (setq next-line-add-newlines t) ! (setq artist-key-draw-how ! (artist-go-get-draw-how-from-symbol artist-curr-go)) ! (if (and artist-picture-compatibility (not (eq major-mode 'picture-mode))) ! (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'." ! (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)) (defun artist-mode-off () "Turn Artist mode off." --- 1324,1438 ---- Hooks ! Turning the mode on or off runs `artist-mode-hook'. Keymap summary \\{artist-mode-map}" ! :init-value nil :group 'artist :lighter " Artist" ! :keymap ! '(([down-mouse-1] . artist-down-mouse-1) ! ([S-down-mouse-1] . artist-down-mouse-1) ! ([down-mouse-2] . artist-mouse-choose-operation) ! ([S-down-mouse-2] . artist-mouse-choose-operation) ! ([down-mouse-3] . artist-down-mouse-3) ! ([S-down-mouse-3] . artist-down-mouse-3) ! ([C-mouse-4] . artist-select-prev-op-in-list) ! ([C-mouse-5] . artist-select-next-op-in-list) ! ("\r" . artist-key-set-point) ; return ! ([up] . artist-previous-line) ! ("\C-p" . artist-previous-line) ! ([down] . artist-next-line) ! ("\C-n" . artist-next-line) ! ([left] . artist-backward-char) ! ("\C-b" . artist-backward-char) ! ([right] . artist-forward-char) ! ("\C-f" . artist-forward-char) ! ("<" . artist-toggle-first-arrow) ! (">" . artist-toggle-second-arrow) ! ("\C-c\C-a\C-e" . artist-select-erase-char) ! ("\C-c\C-a\C-f" . artist-select-fill-char) ! ("\C-c\C-a\C-l" . artist-select-line-char) ! ("\C-c\C-a\C-o" . artist-select-operation) ! ("\C-c\C-a\C-r" . artist-toggle-rubber-banding) ! ("\C-c\C-a\C-t" . artist-toggle-trim-line-endings) ! ("\C-c\C-a\C-s" . artist-toggle-borderless-shapes) ! ("\C-c\C-c" . artist-mode-off) ! ("\C-c\C-al" . artist-select-op-line) ! ("\C-c\C-aL" . artist-select-op-straight-line) ! ("\C-c\C-ar" . artist-select-op-rectangle) ! ("\C-c\C-aR" . artist-select-op-square) ! ("\C-c\C-as" . artist-select-op-square) ! ("\C-c\C-ap" . artist-select-op-poly-line) ! ("\C-c\C-aP" . artist-select-op-straight-poly-line) ! ("\C-c\C-ae" . artist-select-op-ellipse) ! ("\C-c\C-ac" . artist-select-op-circle) ! ("\C-c\C-at" . artist-select-op-text-see-thru) ! ("\C-c\C-aT" . artist-select-op-text-overwrite) ! ("\C-c\C-aS" . artist-select-op-spray-can) ! ("\C-c\C-az" . artist-select-op-spray-set-size) ! ("\C-c\C-a\C-d" . artist-select-op-erase-char) ! ("\C-c\C-aE" . artist-select-op-erase-rectangle) ! ("\C-c\C-av" . artist-select-op-vaporize-line) ! ("\C-c\C-aV" . artist-select-op-vaporize-lines) ! ("\C-c\C-a\C-k" . artist-select-op-cut-rectangle) ! ("\C-c\C-a\M-w" . artist-select-op-copy-rectangle) ! ("\C-c\C-a\C-y" . artist-select-op-paste) ! ("\C-c\C-af" . artist-select-op-flood-fill) ! ("\C-c\C-a\C-b" . artist-submit-bug-report) ! ([menu-bar artist] . artist-menu-map)) ! (cond ((null artist-mode) ! ;; Turn mode off ! (if (and artist-picture-compatibility (eq major-mode 'picture-mode)) ! (picture-mode-exit)) ! (kill-local-variable 'next-line-add-newlines)) ! ! (t ! ;; Turn mode on ! ;; 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. ! (let ((i 0)) ! (while (< i 256) ! (aset artist-replacement-table i i) ! (setq i (1+ i)))) ! (aset artist-replacement-table ?\n ?\s) ! (aset artist-replacement-table ?\t ?\s) ! (aset artist-replacement-table 0 ?\s) ! ;; More setup ! (make-local-variable 'artist-key-is-drawing) ! (make-local-variable 'artist-key-endpoint1) ! (make-local-variable 'artist-key-poly-point-list) ! (make-local-variable 'artist-key-shape) ! (make-local-variable 'artist-key-draw-how) ! (make-local-variable 'artist-popup-menu-table) ! (make-local-variable 'artist-key-compl-table) ! (make-local-variable 'artist-prev-next-op-alist) ! (make-local-variable 'artist-rb-save-data) ! (make-local-variable 'artist-arrow-point-1) ! (make-local-variable 'artist-arrow-point-2) ! (setq artist-key-is-drawing nil) ! (setq artist-key-endpoint1 nil) ! (setq artist-key-poly-point-list nil) ! (setq artist-key-shape nil) ! (setq artist-popup-menu-table (artist-compute-popup-menu-table artist-mt)) ! (setq artist-key-compl-table (artist-compute-key-compl-table artist-mt)) ! (setq artist-prev-next-op-alist ! (artist-make-prev-next-op-alist artist-key-compl-table)) ! (setq artist-rb-save-data (make-vector 7 0)) ! (setq artist-arrow-point-1 nil) ! (setq artist-arrow-point-2 nil) ! (make-local-variable 'next-line-add-newlines) ! (setq next-line-add-newlines t) ! (setq artist-key-draw-how ! (artist-go-get-draw-how-from-symbol artist-curr-go)) ! (if (and artist-picture-compatibility (not (eq major-mode 'picture-mode))) ! (progn ! (picture-mode) ! (message ""))) ! (artist-mode-line-show-curr-operation artist-key-is-drawing)))) ! (defun artist-mode-off () "Turn Artist mode off." *************** *** 1484,1490 **** (defun artist-mode-line-show-curr-operation (is-drawing) "Show current operation in mode-line. If IS-DRAWING, show that." ! (let ((mtext (concat artist-mode-name "/" (artist-go-get-mode-line-from-symbol artist-curr-go) (if is-drawing "/*" "")))) (setcdr (assq 'artist-mode minor-mode-alist) (list mtext))) --- 1450,1456 ---- (defun artist-mode-line-show-curr-operation (is-drawing) "Show current operation in mode-line. If IS-DRAWING, show that." ! (let ((mtext (concat " Artist/" (artist-go-get-mode-line-from-symbol artist-curr-go) (if is-drawing "/*" "")))) (setcdr (assq 'artist-mode minor-mode-alist) (list mtext))) From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 08 14:26:33 2012 Received: (at 10760) by debbugs.gnu.org; 8 Feb 2012 19:26:33 +0000 Received: from localhost ([127.0.0.1]:60958 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvDA0-0001El-Or for submit@debbugs.gnu.org; Wed, 08 Feb 2012 14:26:32 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:4522) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvD9y-0001EV-BS; Wed, 08 Feb 2012 14:26:31 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AioFALjLMk9MCqD0/2dsb2JhbABDrF6CKoEIgXMBBVYjEAsOJhIUGA0kwVaLdRICAgMGAgQCAQQCAgwGCgMBhB0BBAQegzoEiEabCIRa X-IronPort-AV: E=Sophos;i="4.73,385,1325480400"; d="scan'208";a="162157495" Received: from 76-10-160-244.dsl.teksavvy.com (HELO pastel.home) ([76.10.160.244]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 08 Feb 2012 14:25:21 -0500 Received: by pastel.home (Postfix, from userid 20848) id CA17159047; Wed, 8 Feb 2012 14:25:20 -0500 (EST) From: Stefan Monnier To: William Stevenson Subject: Re: bug#10760: 24.0.93; [patch] Convert artist-mode to use define-minor-mode Message-ID: References: <87fwelztll.fsf@gmail.com> Date: Wed, 08 Feb 2012 14:25:20 -0500 In-Reply-To: <87fwelztll.fsf@gmail.com> (William Stevenson's message of "Wed, 08 Feb 2012 07:12:38 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10760 Cc: tab@lysator.liu.se, 10760@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Thank you. > - (defvar artist-mode-map The keymap does not have to be defined within the call to define-minor-mode (actually I recommend you don't do that in general), so you can leave the (defvar artist-mode-map ...) untouched. > ! (defun artist-mode-init () [...] > ! (defun artist-mode-exit () You can also keep these functions. This will significantly reduce the size of your patch and will make it much easier to figure out what is really changed (and hence, whether or not the change is safe). > ! :init-value nil :group 'artist :lighter " Artist" You should use artist-mode-name here. Stefan "who actually prefers `diff -u' format" From debbugs-submit-bounces@debbugs.gnu.org Wed Feb 08 23:16:46 2012 Received: (at submit) by debbugs.gnu.org; 9 Feb 2012 04:16:46 +0000 Received: from localhost ([127.0.0.1]:33080 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvLR8-0007uS-2b for submit@debbugs.gnu.org; Wed, 08 Feb 2012 23:16:46 -0500 Received: from eggs.gnu.org ([140.186.70.92]:35204) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvLR5-0007uF-2p for submit@debbugs.gnu.org; Wed, 08 Feb 2012 23:16:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvLPv-0002jK-97 for submit@debbugs.gnu.org; Wed, 08 Feb 2012 23:15:32 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:53765) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvLPv-0002jG-7c for submit@debbugs.gnu.org; Wed, 08 Feb 2012 23:15:31 -0500 Received: from eggs.gnu.org ([140.186.70.92]:37265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvLPu-0005qo-3x for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2012 23:15:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvLPs-0002iv-NC for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2012 23:15:30 -0500 Received: from plane.gmane.org ([80.91.229.3]:52798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvLPs-0002ip-GE for bug-gnu-emacs@gnu.org; Wed, 08 Feb 2012 23:15:28 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1RvLPq-0008Ht-Sn for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2012 05:15:26 +0100 Received: from cpc10-belf9-2-0-cust411.2-1.cable.virginmedia.com ([86.24.57.156]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Feb 2012 05:15:26 +0100 Received: from yhvh2000 by cpc10-belf9-2-0-cust411.2-1.cable.virginmedia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 09 Feb 2012 05:15:26 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: William Stevenson Subject: Re: bug#10760: 24.0.93; [patch] Convert artist-mode to use define-minor-mode Date: Thu, 09 Feb 2012 04:15:15 +0000 Lines: 119 Message-ID: <87lioctzfw.fsf@gmail.com> References: <87fwelztll.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cpc10-belf9-2-0-cust411.2-1.cable.virginmedia.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) Cancel-Lock: sha1:82bBUHHGJ6xOjnQJAaPZf2BTHw0= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) Stefan Monnier writes: >> - (defvar artist-mode-map > > The keymap does not have to be defined within the call to > define-minor-mode (actually I recommend you don't do that in general), > so you can leave the (defvar artist-mode-map ...) untouched. I did :keymap artist-mode-map. >> ! (defun artist-mode-init () > [...] >> ! (defun artist-mode-exit () > > You can also keep these functions. This will significantly reduce the > size of your patch and will make it much easier to figure out what is > really changed (and hence, whether or not the change is safe). Done. >> ! :init-value nil :group 'artist :lighter " Artist" > > You should use artist-mode-name here. Done. > > Stefan "who actually prefers `diff -u' format" Me too, serves me right for reading the manual :B In summary: Updated artist-mode to use define-minor-mode. As a consequence, artist-mode-init-hook and artist-mode-exit-hook were removed from artist-mode-init and artist-mode-exit, because d-m-m creates artist-mode-hook, and runs it when the mode is turned on or off. Documentation was updated to reflect this. === modified file 'lisp/textmodes/artist.el' --- lisp/textmodes/artist.el 2012-01-19 07:21:25 +0000 +++ lisp/textmodes/artist.el 2012-02-09 03:00:37 +0000 @@ -1196,9 +1196,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. @@ -1387,36 +1387,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. @@ -1458,15 +1446,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." From debbugs-submit-bounces@debbugs.gnu.org Thu Feb 09 17:02:56 2012 Received: (at 10760) by debbugs.gnu.org; 9 Feb 2012 22:02:56 +0000 Received: from localhost ([127.0.0.1]:34128 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rvc4u-0003GW-5m for submit@debbugs.gnu.org; Thu, 09 Feb 2012 17:02:56 -0500 Received: from chene.dit.umontreal.ca ([132.204.246.20]:55448) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rvc4q-0003GM-Tg for 10760@debbugs.gnu.org; Thu, 09 Feb 2012 17:02:54 -0500 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q19M1gYb030597; Thu, 9 Feb 2012 17:01:42 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 936A3130009; Thu, 9 Feb 2012 17:01:42 -0500 (EST) From: Stefan Monnier To: William Stevenson Subject: Re: bug#10760: 24.0.93; [patch] Convert artist-mode to use define-minor-mode Message-ID: References: <87fwelztll.fsf@gmail.com> <87lioctzfw.fsf@gmail.com> Date: Thu, 09 Feb 2012 17:01:42 -0500 In-Reply-To: <87lioctzfw.fsf@gmail.com> (William Stevenson's message of "Thu, 09 Feb 2012 04:15:15 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4127=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4127> : streams <727188> : uri <1062795> X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 10760 Cc: 10760@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) >> Stefan "who actually prefers `diff -u' format" > Me too, serves me right for reading the manual :B > In summary: > Updated artist-mode to use define-minor-mode. > As a consequence, artist-mode-init-hook and artist-mode-exit-hook were > removed from artist-mode-init and artist-mode-exit, because d-m-m creates > artist-mode-hook, and runs it when the mode is turned on or off. > Documentation was updated to reflect this. Looks good, please install, and thank you, Stefan > === modified file 'lisp/textmodes/artist.el' > --- lisp/textmodes/artist.el 2012-01-19 07:21:25 +0000 > +++ lisp/textmodes/artist.el 2012-02-09 03:00:37 +0000 > @@ -1196,9 +1196,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. > @@ -1387,36 +1387,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. > @@ -1458,15 +1446,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." From debbugs-submit-bounces@debbugs.gnu.org Fri Feb 10 21:24:24 2012 Received: (at submit) by debbugs.gnu.org; 11 Feb 2012 02:24:24 +0000 Received: from localhost ([127.0.0.1]:35477 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rw2dT-0005uO-U3 for submit@debbugs.gnu.org; Fri, 10 Feb 2012 21:24:24 -0500 Received: from eggs.gnu.org ([140.186.70.92]:51657) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rw2dR-0005u6-3w for submit@debbugs.gnu.org; Fri, 10 Feb 2012 21:24:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rw2c6-0002QB-Rk for submit@debbugs.gnu.org; Fri, 10 Feb 2012 21:22:59 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_RP_MATCHES_RCVD autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([140.186.70.17]:54907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rw2c6-0002Q7-PO for submit@debbugs.gnu.org; Fri, 10 Feb 2012 21:22:58 -0500 Received: from eggs.gnu.org ([140.186.70.92]:59652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rw2c5-00041g-PA for bug-gnu-emacs@gnu.org; Fri, 10 Feb 2012 21:22:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rw2c4-0002Ps-3t for bug-gnu-emacs@gnu.org; Fri, 10 Feb 2012 21:22:57 -0500 Received: from plane.gmane.org ([80.91.229.3]:40479) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rw2c3-0002Pi-Pl for bug-gnu-emacs@gnu.org; Fri, 10 Feb 2012 21:22:56 -0500 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Rw2c0-000583-EX for bug-gnu-emacs@gnu.org; Sat, 11 Feb 2012 03:22:52 +0100 Received: from cpc10-belf9-2-0-cust411.2-1.cable.virginmedia.com ([86.24.57.156]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 11 Feb 2012 03:22:52 +0100 Received: from yhvh2000 by cpc10-belf9-2-0-cust411.2-1.cable.virginmedia.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 11 Feb 2012 03:22:52 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@gnu.org From: William Stevenson Subject: Re: bug#10760: 24.0.93; [patch] Convert artist-mode to use define-minor-mode Date: Sat, 11 Feb 2012 02:22:41 +0000 Lines: 16 Message-ID: <8762fet8ge.fsf@gmail.com> References: <87fwelztll.fsf@gmail.com> <87lioctzfw.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: cpc10-belf9-2-0-cust411.2-1.cable.virginmedia.com User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (gnu/linux) Cancel-Lock: sha1:gmFo0SBhlxL+U+QAoxv6sHD78Fw= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.17 X-Spam-Score: -4.2 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -4.2 (----) Stefan Monnier writes: >> In summary: >> Updated artist-mode to use define-minor-mode. >> As a consequence, artist-mode-init-hook and artist-mode-exit-hook were >> removed from artist-mode-init and artist-mode-exit, because d-m-m creates >> artist-mode-hook, and runs it when the mode is turned on or off. >> Documentation was updated to reflect this. > > Looks good, please install, and thank you, I don't have write access atm, although I have signed the FSF papers and have contributed to emacs before (adwaita-theme.el). I have created an account on savannah and will request formal inclusion if given the go-ahead. From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 13 15:59:20 2012 Received: (at 10760) by debbugs.gnu.org; 13 Feb 2012 20:59:20 +0000 Received: from localhost ([127.0.0.1]:39287 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rx2zY-0000OY-7l for submit@debbugs.gnu.org; Mon, 13 Feb 2012 15:59:20 -0500 Received: from chene.dit.umontreal.ca ([132.204.246.20]:36790) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Rx2zW-0000OR-9C for 10760@debbugs.gnu.org; Mon, 13 Feb 2012 15:59:19 -0500 Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q1DKvirQ027493; Mon, 13 Feb 2012 15:57:44 -0500 Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id A7AC3130009; Mon, 13 Feb 2012 15:57:44 -0500 (EST) From: Stefan Monnier To: William Stevenson Subject: Re: bug#10760: 24.0.93; [patch] Convert artist-mode to use define-minor-mode Message-ID: References: <87fwelztll.fsf@gmail.com> <87lioctzfw.fsf@gmail.com> <8762fet8ge.fsf@gmail.com> Date: Mon, 13 Feb 2012 15:57:44 -0500 In-Reply-To: <8762fet8ge.fsf@gmail.com> (William Stevenson's message of "Sat, 11 Feb 2012 02:22:41 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.92 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4131=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4131> : streams <728323> : uri <1064800> X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 10760 Cc: 10760@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) >>> In summary: >>> Updated artist-mode to use define-minor-mode. >>> As a consequence, artist-mode-init-hook and artist-mode-exit-hook were >>> removed from artist-mode-init and artist-mode-exit, because d-m-m creates >>> artist-mode-hook, and runs it when the mode is turned on or off. >>> Documentation was updated to reflect this. >> Looks good, please install, and thank you, > I don't have write access atm, although I have signed the FSF papers and > have contributed to emacs before (adwaita-theme.el). > I have created an account on savannah and will request formal inclusion > if given the go-ahead. Actually, I wasn't thinking: while your patch is fine, it can't be installed now because we're in feature freeze and this is not really bug-fix. Please bring it up again in a couple months when we open the trunk for development again (hopefully soonish). Stefan From debbugs-submit-bounces@debbugs.gnu.org Wed Apr 11 07:59:11 2012 Received: (at 10760) by debbugs.gnu.org; 11 Apr 2012 11:59:11 +0000 Received: from localhost ([127.0.0.1]:50517 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SHwCc-0006RL-UH for submit@debbugs.gnu.org; Wed, 11 Apr 2012 07:59:11 -0400 Received: from hermes.netfonds.no ([80.91.224.195]:42439) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SHwCa-0006RE-S3 for 10760@debbugs.gnu.org; Wed, 11 Apr 2012 07:59:09 -0400 Received: from cm-84.215.51.58.getinternet.no ([84.215.51.58] helo=stories.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1SHwBN-0001Mt-S3; Wed, 11 Apr 2012 13:57:53 +0200 From: Lars Magne Ingebrigtsen To: William Stevenson Subject: Re: bug#10760: 24.0.93; [patch] Convert artist-mode to use define-minor-mode References: <87fwelztll.fsf@gmail.com> <87lioctzfw.fsf@gmail.com> X-Now-Playing: Various's _Fuck Your Dreams, This Is Heaven_: "Winston Tong - Last Night" Date: Wed, 11 Apr 2012 13:57:53 +0200 In-Reply-To: <87lioctzfw.fsf@gmail.com> (William Stevenson's message of "Thu, 09 Feb 2012 04:15:15 +0000") Message-ID: User-Agent: Gnus/5.130004 (Ma Gnus v0.4) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-MailScanner-ID: 1SHwBN-0001Mt-S3 X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1334750273.93453@loPnkVLYO7WhuTxTaJMOyw X-Spam-Status: No X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 10760 Cc: 10760@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) William Stevenson writes: > In summary: > Updated artist-mode to use define-minor-mode. I've now applied this patch to the Emacs trunk. -- (domestic pets only, the antidote for overdose, milk.) bloggy blog http://lars.ingebrigtsen.no/ From debbugs-submit-bounces@debbugs.gnu.org Thu Apr 12 19:34:19 2012 Received: (at control) by debbugs.gnu.org; 12 Apr 2012 23:34:19 +0000 Received: from localhost ([127.0.0.1]:55106 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SITWt-0001L4-Eg for submit@debbugs.gnu.org; Thu, 12 Apr 2012 19:34:19 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:55828) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SITWr-0001Kx-0m for control@debbugs.gnu.org; Thu, 12 Apr 2012 19:34:17 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1SITVd-0005uG-At for control@debbugs.gnu.org; Thu, 12 Apr 2012 19:33:01 -0400 Date: Thu, 12 Apr 2012 19:33:01 -0400 Message-Id: Subject: control message for bug 10760 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) close 10760 24.2 From unknown Thu Sep 11 09:18:24 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Fri, 11 May 2012 11:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator