all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@gnu.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: visual-line-mode tweaks
Date: Thu, 04 Feb 2010 10:06:12 +0900	[thread overview]
Message-ID: <87d40ldd2z.fsf@catnip.gol.com> (raw)
In-Reply-To: <jwvzl3q5rgr.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Wed, 03 Feb 2010 09:23:47 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> 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.




  parent reply	other threads:[~2010-02-04  1:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-03  7:19 visual-line-mode tweaks Miles Bader
2010-02-03 14:23 ` Stefan Monnier
2010-02-03 14:48   ` Teemu Likonen
2010-02-04  1:06   ` Miles Bader [this message]
2010-02-04  5:18     ` Teemu Likonen
2010-02-04 15:27     ` Stefan Monnier
2010-02-03 16:56 ` Davis Herring
2010-02-05 18:14 ` Andrey Paramonov

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87d40ldd2z.fsf@catnip.gol.com \
    --to=miles@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.