GNU bug report logs - #4366
23.1; Can't turn off visual-line-mode via html-mode-hook

Previous Next

Package: emacs;

Reported by: Allan Gottlieb <gottlieb <at> nyu.edu>

Date: Mon, 7 Sep 2009 15:20:04 UTC

Severity: normal

Tags: notabug

Done: Juanma Barranquero <lekktu <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 4366 in the body.
You can then email your comments to 4366 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#4366; Package emacs. (Mon, 07 Sep 2009 15:20:04 GMT) Full text and rfc822 format available.

Acknowledgement sent to Allan Gottlieb <gottlieb <at> nyu.edu>:
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 07 Sep 2009 15:20:05 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Allan Gottlieb <gottlieb <at> nyu.edu>
To: bug-gnu-emacs <at> gnu.org
Subject: 23.1; Can't turn off visual-line-mode via html-mode-hook
Date: Mon, 07 Sep 2009 11:14:45 -0400
Please write in English if possible, because the Emacs maintainers
usually do not have translators to read other languages for them.

Your bug report will be posted to the bug-gnu-emacs <at> gnu.org mailing list,
and to the gnu.emacs.bug news group.

Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

Have /tmp/fun.el contain
(defun visual-off-fill-on ()
  "For html, turn OFF visual-line-mode and turn-ON auto fill"
  (visual-line-mode 0)
  (auto-fill-mode 1))

Start emacs -Q
(load-file "/tmp/fun.el")
(global-visual-line-mode)
(add-hook 'html-mode-hook 'visual-off-fill-on)
(find-file "/tmp/x.html")   ; non-existent file

mode line shows fill as expected, but also shows wrap, the bug.

However, if one does instead

Start emacs -Q
(load-file "/tmp/fun.el")
(global-visual-line-mode)
(find-file "/tmp/x.html")   ; non-existent file
(visual-off-fill-on)

then all is well (mode line shows fill and not wrap).

thanks for emacs,
allan

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/share/emacs/23.1/etc/DEBUG for instructions.


In GNU Emacs 23.1.1 (i686-pc-linux-gnu, GTK+ Version 2.14.7)
 of 2009-08-17 on ajglap
Windowing system distributor `The X.Org Foundation', version 11.0.10503000
configured using `configure  '--prefix=/usr' '--build=i686-pc-linux-gnu' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--program-suffix=-emacs-23' '--infodir=/usr/share/info/emacs-23' '--with-sound' '--with-x' '--with-toolkit-scroll-bars' '--with-gif' '--with-jpeg' '--with-png' '--without-rsvg' '--with-tiff' '--with-xpm' '--with-xft' '--without-libotf' '--without-m17n-flt' '--with-x-toolkit=gtk' '--without-hesiod' '--without-kerberos' '--without-kerberos5' '--with-gpm' '--with-dbus' 'build_alias=i686-pc-linux-gnu' 'host_alias=i686-pc-linux-gnu' 'CFLAGS=-O2 -march=prescott -pipe' 'LDFLAGS=-Wl,-O1''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: t

Major mode: Summary

Minor modes in effect:
  gnus-mailing-list-mode: t
  iswitchb-mode: t
  delete-selection-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
. <return> <return> I SPC p l a n SPC o n SPC s u b 
<backspace> <backspace> <backspace> f i l l <backspace> 
i n g SPC a SPC b u g SPC r e p o r t SPC u n l e s 
s SPC s o m e o n e SPC e x p l a i n s SPC <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> . <return> 
<return> <help-echo> <down-mouse-1> <mouse-1> <double-down-mouse-1> 
<double-mouse-1> <triple-down-mouse-1> <mouse-movement> 
<mouse-movement> <triple-drag-mouse-1> <help-echo> 
<down-mouse-1> <mouse-1> a l l a n <return> C-c C-c 
<help-echo> <help-echo> M-x r e p o r t - e m a c s 
- u <backspace> b u g <return> c a n t <backspace> 
' t SPC t u r n SPC v i s u a l - l i n e - m o d e 
SPC o f f SPC v i a SPC h t m l - m o d e - h o o k 
<help-echo> <select-window> <down-mouse-1> <mouse-1> 
C-x b <help-echo> C-x o C-x o C-x b i n f o <return> 
u u <up> <up> <up> <return> <down> <down> <down> <down> 
<down> <down> <down> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <return> C-s h t m l C-g <next> 
<next> <next> <next> <next> <next> <next> <next> <next> 
<next> q <select-window> <help-echo> <select-window> 
<help-echo> <select-window> <help-echo> <select-window> 
M-x r e p o r t - e m a c s - b u g <return> C-g C-x 
b C-s b u C-g M-x r e p o r t - e m a c s - b u g 
<return>

Recent messages:
Auto-saving...done
Sending...
Sending via mail...
Wrote /home/gottlieb/Mail/MAIL/320979
Sending...done
byte-code: Command attempted to use minibuffer while in minibuffer
bunzip2ing elisp-4.info.bz2...done
bunzip2ing elisp-10.info.bz2...done
Mark saved where search started
Quit
Quit




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4366; Package emacs. (Fri, 08 Jan 2010 04:13:02 GMT) Full text and rfc822 format available.

Message #8 received at 4366 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Allan Gottlieb <gottlieb <at> nyu.edu>
Cc: 4366 <at> debbugs.gnu.org
Subject: Re: bug#4366: 23.1; Can't turn off visual-line-mode via 
	html-mode-hook
Date: Fri, 8 Jan 2010 05:12:16 +0100
On Mon, Sep 7, 2009 at 16:14, Allan Gottlieb <gottlieb <at> nyu.edu> wrote:

> Start emacs -Q
> (load-file "/tmp/fun.el")
> (global-visual-line-mode)
> (add-hook 'html-mode-hook 'visual-off-fill-on)
> (find-file "/tmp/x.html")   ; non-existent file
>
> mode line shows fill as expected, but also shows wrap, the bug.
>
> However, if one does instead
>
> Start emacs -Q
> (load-file "/tmp/fun.el")
> (global-visual-line-mode)
> (find-file "/tmp/x.html")   ; non-existent file
> (visual-off-fill-on)
>
> then all is well (mode line shows fill and not wrap).

That is not a bug. When you do (global-visual-line-mode)  [which
should better be (global-visual-line-mode 1), BTW], the function adds
code to several hooks to check for new buffers (find-file-hook, etc.).

In your first case, the global mode is active (so the hooks are
active); when you run find-file, it creates the buffer, runs
html-mode-hook (disabling visual-line-mode), and finally a hook is run
which activates the mode.

In the second case, you activate the global mode, run find-file (and
the hooks check that visual mode is active, so do nothing), and
finally run visual-off-fill-on, deactivating the visual-line mode.

If you want to deactivate the mode automatically after find-file,
there are several ways, like an `after' advice for find-file, or
adding code to the relevant hooks, etc.

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4366; Package emacs. (Fri, 08 Jan 2010 07:06:02 GMT) Full text and rfc822 format available.

Message #11 received at 4366 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Juanma Barranquero <lekktu <at> gmail.com>, 4366 <at> debbugs.gnu.org
Cc: Allan Gottlieb <gottlieb <at> nyu.edu>
Subject: Re: bug#4366: 23.1; Can't turn off visual-line-mode via 
	html-mode-hook
Date: Fri, 8 Jan 2010 08:04:34 +0100
On Fri, Jan 8, 2010 at 5:12 AM, Juanma Barranquero <lekktu <at> gmail.com> wrote:
> On Mon, Sep 7, 2009 at 16:14, Allan Gottlieb <gottlieb <at> nyu.edu> wrote:
>
>> Start emacs -Q
>> (load-file "/tmp/fun.el")
>> (global-visual-line-mode)
>> (add-hook 'html-mode-hook 'visual-off-fill-on)
>> (find-file "/tmp/x.html")   ; non-existent file
>>
>> mode line shows fill as expected, but also shows wrap, the bug.
>>
>> However, if one does instead
>>
>> Start emacs -Q
>> (load-file "/tmp/fun.el")
>> (global-visual-line-mode)
>> (find-file "/tmp/x.html")   ; non-existent file
>> (visual-off-fill-on)
>>
>> then all is well (mode line shows fill and not wrap).
>
> That is not a bug. When you do (global-visual-line-mode)  [which
> should better be (global-visual-line-mode 1), BTW], the function adds
> code to several hooks to check for new buffers (find-file-hook, etc.).
>
> In your first case, the global mode is active (so the hooks are
> active); when you run find-file, it creates the buffer, runs
> html-mode-hook (disabling visual-line-mode), and finally a hook is run
> which activates the mode.
>
> In the second case, you activate the global mode, run find-file (and
> the hooks check that visual mode is active, so do nothing), and
> finally run visual-off-fill-on, deactivating the visual-line mode.
>
> If you want to deactivate the mode automatically after find-file,
> there are several ways, like an `after' advice for find-file, or
> adding code to the relevant hooks, etc.


Hm, maybe someone wants to make a picture that quickly describes the
order of the hooks. That would be useful IMO.




Added tag(s) notabug. Request was from Juanma Barranquero <lekktu <at> gmail.com> to control <at> debbugs.gnu.org. (Fri, 08 Jan 2010 09:31:01 GMT) Full text and rfc822 format available.

Reply sent to Juanma Barranquero <lekktu <at> gmail.com>:
You have taken responsibility. (Fri, 08 Jan 2010 09:31:02 GMT) Full text and rfc822 format available.

Notification sent to Allan Gottlieb <gottlieb <at> nyu.edu>:
bug acknowledged by developer. (Fri, 08 Jan 2010 09:31:02 GMT) Full text and rfc822 format available.

Message #18 received at 4366-done <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 4366-done <at> debbugs.gnu.org, Allan Gottlieb <gottlieb <at> nyu.edu>
Subject: Re: bug#4366: 23.1; Can't turn off visual-line-mode via 
	html-mode-hook
Date: Fri, 8 Jan 2010 10:30:22 +0100
tags 4366  + notabug
quit

On Fri, Jan 8, 2010 at 08:04, Lennart Borgman <lennart.borgman <at> gmail.com> wrote:

> Hm, maybe someone wants to make a picture that quickly describes the
> order of the hooks. That would be useful IMO.

All hooks? That's quite a task.

    Juanma




Message #19 received at 4366-done <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 4366-done <at> debbugs.gnu.org, Allan Gottlieb <gottlieb <at> nyu.edu>
Subject: Re: bug#4366: 23.1; Can't turn off visual-line-mode via 
	html-mode-hook
Date: Fri, 8 Jan 2010 10:51:00 +0100
On Fri, Jan 8, 2010 at 10:30 AM, Juanma Barranquero <lekktu <at> gmail.com> wrote:
> tags 4366  + notabug
> quit
>
> On Fri, Jan 8, 2010 at 08:04, Lennart Borgman <lennart.borgman <at> gmail.com> wrote:
>
>> Hm, maybe someone wants to make a picture that quickly describes the
>> order of the hooks. That would be useful IMO.
>
> All hooks? That's quite a task.


Yes, but now a lot of people is doing a bit of that for themselves. Cooperation.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4366; Package emacs. (Fri, 08 Jan 2010 17:35:02 GMT) Full text and rfc822 format available.

Message #22 received at 4366 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 4366 <at> debbugs.gnu.org
Subject: Re: bug#4366: 23.1;
	Can't turn off visual-line-mode via  html-mode-hook
Date: Fri, 08 Jan 2010 12:34:31 -0500
> That is not a bug.

Well, that's debatable.  It's clearly not a feature, but admittedly,
I do not know how to implement such global minor modes in a way that
doesn't suffer from this problem.


        Stefan




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4366; Package emacs. (Fri, 08 Jan 2010 17:48:02 GMT) Full text and rfc822 format available.

Message #25 received at 4366 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 4366 <at> debbugs.gnu.org
Subject: Re: bug#4366: 23.1; Can't turn off visual-line-mode via 
	html-mode-hook
Date: Fri, 8 Jan 2010 18:45:09 +0100
> Well, that's debatable.  It's clearly not a feature, but admittedly,
> I do not know how to implement such global minor modes in a way that
> doesn't suffer from this problem.

We agree, I think: it's not a feature, nor a bug. It's an
epiphenomenon of the current implementation of global minor modes.

    Juanma




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4366; Package emacs. (Sat, 09 Jan 2010 11:18:02 GMT) Full text and rfc822 format available.

Message #28 received at 4366 <at> debbugs.gnu.org (full text, mbox):

From: Lennart Borgman <lennart.borgman <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>, 4366 <at> debbugs.gnu.org
Cc: Juanma Barranquero <lekktu <at> gmail.com>
Subject: Re: bug#4366: 23.1; Can't turn off visual-line-mode via 
	html-mode-hook
Date: Sat, 9 Jan 2010 12:17:18 +0100
On Fri, Jan 8, 2010 at 6:34 PM, Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:
>> That is not a bug.
>
> Well, that's debatable.  It's clearly not a feature, but admittedly,
> I do not know how to implement such global minor modes in a way that
> doesn't suffer from this problem.


Couldn't it be handled better for derived modes at least?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#4366; Package emacs. (Sun, 10 Jan 2010 03:06:02 GMT) Full text and rfc822 format available.

Message #31 received at 4366 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Lennart Borgman <lennart.borgman <at> gmail.com>
Cc: 4366 <at> debbugs.gnu.org, Juanma Barranquero <lekktu <at> gmail.com>
Subject: Re: bug#4366: 23.1; Can't turn off visual-line-mode via
Date: Sat, 09 Jan 2010 22:05:33 -0500
>>> That is not a bug.
>> Well, that's debatable.  It's clearly not a feature, but admittedly,
>> I do not know how to implement such global minor modes in a way that
>> doesn't suffer from this problem.
> Couldn't it be handled better for derived modes at least?

You mean for major modes which follow a particular convention
(convention which could be automatically enforced by
define-derived-mode)?

That would be good, yes,


        Stefan




bug archived. Request was from Debbugs Internal Request <bug-gnu-emacs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 07 Feb 2010 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 219 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.