emacs-devel
[Top][All Lists]
Advanced

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

Re: visual-line-mode tweaks


From: Miles Bader
Subject: Re: visual-line-mode tweaks
Date: Thu, 04 Feb 2010 10:06:12 +0900

Stefan Monnier <address@hidden> writes:
>> (1) Maybe visual-line-mode should turn off auto-fill-mode -- it's
>> annoying to have your lines truncated physically when editing a file
>> that intentionally uses a line-per-paragraph, and it's very common for
>> auto-fill mode to be turned on by default.
>
>> [I turn on auto-fill mode for text-mode, text-mode is my default
>> major-mode -- but if i visit a file which uses line-per-paragraph, I do
>> M-x visual-line-mode...]
>
> I'm not completely opposed to it, but I'm not sure how we could do it in
> a way that wouldn't be annoying in one case or another.  So if you
> propose a patch, maybe I would accept it.

Hmm, Teemu also made a good point about minor modes not turning off
other minor modes.

I think it's fine if minor modes _interact_ in some way that helps the
user, but I think such interaction should be dynamic (so for instance,
if I turn visual-line-mode off again, auto-filling should once again be
enabled; one could do this by saving previous state or whatever, but
that gets messy and flaky).

How about having auto-fill-mode be a nop when visual-line-mode is
enabled (so the change would be to auto-fill-mode instead of
visual-line-mode)?

Here's a change to `do-auto-fill' that does it:

diff --git a/lisp/simple.el b/lisp/simple.el
index cce793f..e6b9ee3 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -5006,7 +5006,8 @@ If optional arg REALLY-WORD is non-nil, it finds just a 
word."
                 (<= (current-column) fc))
            (and auto-fill-inhibit-regexp
                 (save-excursion (beginning-of-line)
-                                (looking-at auto-fill-inhibit-regexp))))
+                                (looking-at auto-fill-inhibit-regexp)))
+           visual-line-mode)
        nil ;; Auto-filling not required
       (if (memq justify '(full center right))
          (save-excursion (unjustify-current-line)))

I'm not sure if do-auto-fill would be the right place though; wouldn't
the place that _calls_ it be better, so alternative auto-filling
functions would also be suppressed?  [Also it would be nice if the
"Fill" in the mode-line were omitted or altered when auto-filling is
suppressed...]

-Miles

-- 
Yo mama's so fat when she gets on an elevator it HAS to go down.




reply via email to

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