From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Allan Gottlieb Newsgroups: gmane.emacs.help Subject: Re: trouble turning off visual line mode Date: Mon, 07 Sep 2009 10:45:32 -0400 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1252345231 11328 80.91.229.12 (7 Sep 2009 17:40:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Sep 2009 17:40:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 07 16:48:42 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MkfWK-0006IM-Dx for geh-help-gnu-emacs@m.gmane.org; Mon, 07 Sep 2009 16:48:40 +0200 Original-Received: from localhost ([127.0.0.1]:33259 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MkfWJ-0000Bi-T4 for geh-help-gnu-emacs@m.gmane.org; Mon, 07 Sep 2009 10:48:39 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MkfTV-00073F-IY for help-gnu-emacs@gnu.org; Mon, 07 Sep 2009 10:45:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MkfTQ-00070G-H0 for help-gnu-emacs@gnu.org; Mon, 07 Sep 2009 10:45:45 -0400 Original-Received: from [199.232.76.173] (port=45543 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MkfTQ-00070B-7H for help-gnu-emacs@gnu.org; Mon, 07 Sep 2009 10:45:40 -0400 Original-Received: from smtp.cs.nyu.edu ([128.122.80.33]:44518) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1MkfTP-0001oW-NK for help-gnu-emacs@gnu.org; Mon, 07 Sep 2009 10:45:39 -0400 Original-Received: from ajglap.localdomain (ool-4578da1c.dyn.optonline.net [69.120.218.28]) (authenticated bits=0) by smtp.cs.nyu.edu (8.14.3/8.13.8) with ESMTP id n87EjcUJ010925 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Mon, 7 Sep 2009 10:45:38 -0400 (EDT) Original-Received: by ajglap.localdomain (Postfix, from userid 1502) id 434B319D922; Mon, 7 Sep 2009 10:45:33 -0400 (EDT) In-Reply-To: (Xah Lee's message of "Sun, 06 Sep 2009 22:13:42 -0700 (PDT)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:67938 At Sun, 06 Sep 2009 22:13:42 -0700 (PDT) Xah Lee wrote: > On Sep 6, 2:55=C2=A0pm, Allan Gottlieb wrote: >> I have the following function in my .emacs >> >> ;; Want auto-fill and not visual-line-mode >> ;; Define the function here; add to hook via customize >> (defun ajg-html-visual-off-fill-on () >> =C2=A0 "For html, turn OFF visual-line-mode and turn-ON auto fill" >> =C2=A0 (message "ckpt 1") >> =C2=A0 (visual-line-mode -1) >> =C2=A0 (message "ckpt 2") >> =C2=A0 (auto-fill-mode 1) >> =C2=A0 (message "ckpt 3") >> =C2=A0 ) >> >> I have it put in the html-mode-hook via >> >> (custom-set-variables >> ... >> =C2=A0'(html-mode-hook (quote (ajg-alter-electric-html-tag ajg-html-visu= al-off-fill-on))) >> ... >> ) >> >> Yet when I visit an html file >> auto-fill-mode is turned on as expected but >> visual-line-mode is *not* turned off. > > for minor modes, the convention is 1 is on and 0 is off. I believe that is wrong (see below). Nonetheless, I tried changing -1 to 0 and there was no change. > i got a lesson of that recently from emacs devers too. it's in elisp > manual under the minor mode section too. Sounds like a bad lesson. The following is from section 23.3.1 of the version of the elisp manual shipped with emacs 23.1. allan * Define a command whose name is the same as the mode variable. Its job is to enable and disable the mode by setting the variable. The command should accept one optional argument. If the argument is `nil', it should toggle the mode (turn it on if it is off, and off if it is on). It should turn the mode on if the argument is a positive integer, the symbol `t', or a list whose CAR is one of those. It should turn the mode off if the argument is a negative integer or zero, the symbol `-', or a list whose CAR is a negative integer or zero. The meaning of other arguments is not specified. Here is an example taken from the definition of `transient-mark-mode'. It shows the use of `transient-mark-mode' as a variable that enables or disables the mode's behavior, and also shows the proper way to toggle, enable or disable the minor mode based on the raw prefix argument value. (setq transient-mark-mode (if (null arg) (not transient-mark-mode) (> (prefix-numeric-value arg) 0)))