From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: William Stevenson Newsgroups: gmane.emacs.bugs Subject: bug#10772: 24.0.93; [patch] Convert tcl-auto-fill-mode to use define-minor-mode Date: Thu, 09 Feb 2012 06:49:19 +0000 Message-ID: <87fwektsb4.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1328770207 1183 80.91.229.3 (9 Feb 2012 06:50:07 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Feb 2012 06:50:07 +0000 (UTC) To: 10772@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Feb 09 07:50:07 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RvNpW-0000t2-FX for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Feb 2012 07:50:06 +0100 Original-Received: from localhost ([::1]:38818 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvNpU-0001xS-RN for geb-bug-gnu-emacs@m.gmane.org; Thu, 09 Feb 2012 01:50:04 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:52704) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvNpQ-0001w3-Rr for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2012 01:50:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvNpM-0006Gy-UZ for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2012 01:50:00 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57785) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvNpM-0006Gu-T5 for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2012 01:49:56 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1RvNqQ-0003vu-58 for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2012 01:51:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: William Stevenson Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 09 Feb 2012 06:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 10772 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.132877024715093 (code B ref -1); Thu, 09 Feb 2012 06:51:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 Feb 2012 06:50:47 +0000 Original-Received: from localhost ([127.0.0.1]:33175 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvNq8-0003vL-5n for submit@debbugs.gnu.org; Thu, 09 Feb 2012 01:50:46 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:52590) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1RvNq3-0003v2-2s for submit@debbugs.gnu.org; Thu, 09 Feb 2012 01:50:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvNot-00067s-3s for submit@debbugs.gnu.org; Thu, 09 Feb 2012 01:49:28 -0500 Original-Received: from lists.gnu.org ([140.186.70.17]:51104) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvNot-00067n-2O for submit@debbugs.gnu.org; Thu, 09 Feb 2012 01:49:27 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:52629) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvNor-0001va-Pq for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2012 01:49:26 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RvNoq-00067F-FI for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2012 01:49:25 -0500 Original-Received: from mail-ww0-f41.google.com ([74.125.82.41]:55144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RvNoq-000670-AS for bug-gnu-emacs@gnu.org; Thu, 09 Feb 2012 01:49:24 -0500 Original-Received: by wgbdt11 with SMTP id dt11so7319495wgb.0 for ; Wed, 08 Feb 2012 22:49:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:subject:date:message-id:mime-version:content-type; bh=03KfUzbtA45TlWBZFRScaKwnwE9IGLL9k+A95tLSq+8=; b=uzUVd+I01j0aYMS7LWTc7CjdO5PZwU2BV42q7gsUXfxd0x2q6ZLPRvq12dixm6XTlZ ZAA8JKRIqdiD1plHylw8Kg/oxXxme2xd58FeeXGhJ/67vumDRJPuQ6fAE8Uy2aW0g804 VPlLEBOy+VIi6F9PAjVPWbs4B1zj/Y7igNouI= Original-Received: by 10.180.84.201 with SMTP id b9mr800715wiz.4.1328770162354; Wed, 08 Feb 2012 22:49:22 -0800 (PST) Original-Received: from localhost.yhvh.mouseabuse.co.uk (cpc10-belf9-2-0-cust411.2-1.cable.virginmedia.com. [86.24.57.156]) by mx.google.com with ESMTPS id ft8sm4615216wib.11.2012.02.08.22.49.20 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 08 Feb 2012 22:49:21 -0800 (PST) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:56711 Archived-At: In the documentation of auto-fill-mode it says: "When `auto-fill-mode' is on, the `auto-fill-function' variable is non-`nil'." Which makes the `if' redundant in this case, the THEN & ELSE bodies can be placed below the call to turn auto-fill-mode on/off. Also updated the documentation to reflect the auto generated `tcl-auto-fill-mode-hook'. === modified file 'lisp/progmodes/tcl.el' --- lisp/progmodes/tcl.el 2012-01-19 07:21:25 +0000 +++ lisp/progmodes/tcl.el 2012-02-09 06:18:32 +0000 @@ -1408,13 +1408,18 @@ tcl-application file tcl-command-switches) (if and-go (switch-to-tcl t))))))) -(defun tcl-auto-fill-mode (&optional arg) - "Like `auto-fill-mode', but sets `comment-auto-fill-only-comments'." - (interactive "P") - (auto-fill-mode arg) - (if auto-fill-function - (set (make-local-variable 'comment-auto-fill-only-comments) t) - (kill-local-variable 'comment-auto-fill-only-comments))) +(define-minor-mode tcl-auto-fill-mode + "Like `auto-fill-mode', but sets `comment-auto-fill-only-comments'. +Turning the mode on or off runs `tcl-auto-fill-mode-hook'." + :init-value nil + (cond ((null tcl-auto-fill-mode) + ;; Turn mode off + (auto-fill-mode 0) + (kill-local-variable 'comment-auto-fill-only-comments)) + (t + ;; Turn mode on + (auto-fill-mode) + (set (make-local-variable 'comment-auto-fill-only-comments) t)))) (defun tcl-electric-hash (&optional count) "Insert a `#' and quote if it does not start a real comment.