help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: trouble turning off visual line mode


From: Allan Gottlieb
Subject: Re: trouble turning off visual line mode
Date: Mon, 07 Sep 2009 10:45:32 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

At Sun, 06 Sep 2009 22:13:42 -0700 (PDT) Xah Lee <xahlee@gmail.com> wrote:

> On Sep 6, 2:55 pm, Allan Gottlieb <gottl...@nyu.edu> 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 ()
>>   "For html, turn OFF visual-line-mode and turn-ON auto fill"
>>   (message "ckpt 1")
>>   (visual-line-mode -1)
>>   (message "ckpt 2")
>>   (auto-fill-mode 1)
>>   (message "ckpt 3")
>>   )
>>
>> I have it put in the html-mode-hook via
>>
>> (custom-set-variables
>> ...
>>  '(html-mode-hook (quote (ajg-alter-electric-html-tag 
>> ajg-html-visual-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)))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]