GNU bug report logs -
#4366
23.1; Can't turn off visual-line-mode via html-mode-hook
Previous Next
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.
Full log
View this message in rfc822 format
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
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.