From: Lennart Borgman <lennart.borgman@gmail.com>
To: Juanma Barranquero <lekktu@gmail.com>, 4366@debbugs.gnu.org
Cc: Allan Gottlieb <gottlieb@nyu.edu>
Subject: bug#4366: 23.1; Can't turn off visual-line-mode via html-mode-hook
Date: Fri, 8 Jan 2010 08:04:34 +0100 [thread overview]
Message-ID: <e01d8a51001072304k1d03a4f7p778e9cb72f5d876@mail.gmail.com> (raw)
In-Reply-To: <f7ccd24b1001072012p218c188ax3412813a62ed8196@mail.gmail.com>
On Fri, Jan 8, 2010 at 5:12 AM, Juanma Barranquero <lekktu@gmail.com> wrote:
> On Mon, Sep 7, 2009 at 16:14, Allan Gottlieb <gottlieb@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.
next prev parent reply other threads:[~2010-01-08 7:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <f7ccd24b1001080130v1b32901fu663da50659140c2b@mail.gmail.com>
2009-09-07 15:14 ` bug#4366: 23.1; Can't turn off visual-line-mode via html-mode-hook Allan Gottlieb
2010-01-08 4:12 ` Juanma Barranquero
2010-01-08 7:04 ` Lennart Borgman [this message]
2010-01-08 17:34 ` Stefan Monnier
2010-01-08 17:45 ` Juanma Barranquero
2010-01-09 11:17 ` Lennart Borgman
2010-01-10 3:05 ` bug#4366: 23.1; Can't turn off visual-line-mode via Stefan Monnier
2010-01-08 9:31 ` bug#4366: marked as done (23.1; Can't turn off visual-line-mode via html-mode-hook) Emacs bug Tracking System
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e01d8a51001072304k1d03a4f7p778e9cb72f5d876@mail.gmail.com \
--to=lennart.borgman@gmail.com \
--cc=4366@debbugs.gnu.org \
--cc=gottlieb@nyu.edu \
--cc=lekktu@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).