From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.user/14508 Path: news.gmane.org!not-for-mail From: Yuri D'Elia Newsgroups: gmane.emacs.gnus.user Subject: More on format=flowed Date: Sun, 02 Jan 2011 16:59:20 +0100 Message-ID: <87ipy72t5z.fsf@savara.sat.thregr.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1293983983 13843 80.91.229.12 (2 Jan 2011 15:59:43 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 2 Jan 2011 15:59:43 +0000 (UTC) To: info-gnus-english@gnu.org Original-X-From: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Sun Jan 02 16:59:38 2011 Return-path: Envelope-to: gegu-info-gnus-english@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 1PZQLK-00038P-As for gegu-info-gnus-english@m.gmane.org; Sun, 02 Jan 2011 16:59:38 +0100 Original-Received: from localhost ([127.0.0.1]:60927 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZQLJ-0006mL-Si for gegu-info-gnus-english@m.gmane.org; Sun, 02 Jan 2011 10:59:37 -0500 Original-Received: from [140.186.70.92] (port=60030 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZQLH-0006kd-0m for info-gnus-english@gnu.org; Sun, 02 Jan 2011 10:59:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PZQLF-0001wY-Vs for info-gnus-english@gnu.org; Sun, 02 Jan 2011 10:59:34 -0500 Original-Received: from lo.gmane.org ([80.91.229.12]:47335) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PZQLF-0001wS-KC for info-gnus-english@gnu.org; Sun, 02 Jan 2011 10:59:33 -0500 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PZQLC-00033G-W2 for info-gnus-english@gnu.org; Sun, 02 Jan 2011 16:59:30 +0100 Original-Received: from 88-149-142-246.dynamic.ngi.it ([88.149.142.246]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 02 Jan 2011 16:59:30 +0100 Original-Received: from wavexx by 88-149-142-246.dynamic.ngi.it with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sun, 02 Jan 2011 16:59:30 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 61 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 88-149-142-246.dynamic.ngi.it User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:rAB0XCwHvVXsSNDYGxyxmplEp6E= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: info-gnus-english@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Announcements and discussions for GNUS, the GNU Emacs Usenet newsreader \(in English\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Errors-To: info-gnus-english-bounces+gegu-info-gnus-english=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.gnus.user:14508 Archived-At: In my quest for format=flowed, I *think* I've come up with a workable solution by using the following: --- (defun harden-newlines () (save-excursion (goto-char (point-min)) (while (search-forward "\n" nil t) (put-text-property (1- (point)) (point) 'hard t)))) (setq fill-flowed-display-column nil) (add-hook 'message-setup-hook (lambda () (when message-this-is-mail (turn-off-auto-fill) (setq truncate-lines nil word-wrap t use-hard-newlines t)))) (add-hook 'message-send-hook (lambda () (when use-hard-newlines (harden-newlines)))) (add-hook 'gnus-article-mode-hook (lambda () (setq truncate-lines nil word-wrap t))) --- The idea behind it: - `fill-flowed-display-column' will unwrap flowed message as expected. Apparently, the current code in flow-fill.el has problems with long quoted text (not all lines are correctly unfolded, but this doesn't affect the usability of the message). - `gnus-article-mode-hook' will wrap flowed messages using word-wrap instead. This works nicely. - In `message-setup-hook' again we turn on the built-in worp-wrap, disable auto-fill and set use-hard-newlines silently. Those are set for mail messages only, though I've verified that flowed messages also work on gmane groups (gmane.test). - The magic is really done i `message-send-hook', where all newlines are replaced with hard newlines. This way the existing message, and more importantly, pasted text lacking 'hard' newlines will be preserved. All long lines will be wrapped at `fill-flowed-encode-column' since `use-hard-newlines' was already turned on earlier. That's *much* harder than calling (use-hard-newlines) to use format=flowed all around. Yet, it seems to work. Maybe. Comments?