From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Miles Bader Newsgroups: gmane.emacs.devel Subject: Re: visual-line-mode tweaks Date: Thu, 04 Feb 2010 10:06:12 +0900 Message-ID: <87d40ldd2z.fsf@catnip.gol.com> References: Reply-To: Miles Bader NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1265245599 22452 80.91.229.12 (4 Feb 2010 01:06:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 4 Feb 2010 01:06:39 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 04 02:06:36 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1NcqB0-0001z3-AR for ged-emacs-devel@m.gmane.org; Thu, 04 Feb 2010 02:06:34 +0100 Original-Received: from localhost ([127.0.0.1]:45883 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NcqAy-00062e-W7 for ged-emacs-devel@m.gmane.org; Wed, 03 Feb 2010 20:06:33 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NcqAm-0005zS-A8 for emacs-devel@gnu.org; Wed, 03 Feb 2010 20:06:20 -0500 Original-Received: from [199.232.76.173] (port=50907 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NcqAl-0005zC-MA for emacs-devel@gnu.org; Wed, 03 Feb 2010 20:06:19 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NcqAk-0004ic-1F for emacs-devel@gnu.org; Wed, 03 Feb 2010 20:06:19 -0500 Original-Received: from smtp12.dentaku.gol.com ([203.216.5.74]:39931) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NcqAj-0004iS-GQ; Wed, 03 Feb 2010 20:06:17 -0500 Original-Received: from 218.231.148.164.eo.eaccess.ne.jp ([218.231.148.164] helo=catnip.gol.com) by smtp12.dentaku.gol.com with esmtpa (Dentaku) id 1NcqAf-0001fI-UK; Thu, 04 Feb 2010 10:06:14 +0900 Original-Received: by catnip.gol.com (Postfix, from userid 1000) id 0F401DF8E; Thu, 4 Feb 2010 10:06:13 +0900 (JST) System-Type: x86_64-unknown-linux-gnu In-Reply-To: (Stefan Monnier's message of "Wed, 03 Feb 2010 09:23:47 -0500") Original-Lines: 54 X-Virus-Scanned: ClamAV GOL (outbound) X-Abuse-Complaints: abuse@gol.com X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:120877 Archived-At: Stefan Monnier 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.