From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/59251 Path: main.gmane.org!not-for-mail From: Romain Francoise Newsgroups: gmane.emacs.gnus.general Subject: Re: [PATCH] Hide headers using narrowing Date: Mon, 22 Nov 2004 21:50:52 +0100 Organization: orebokech dot com Message-ID: <877jod7glv.fsf@orebokech.com> References: <87brpalkm3.fsf@orebokech.com> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1101156669 30547 80.91.229.6 (22 Nov 2004 20:51:09 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 22 Nov 2004 20:51:09 +0000 (UTC) Original-X-From: ding-owner+M7791=ding+2Daccount=gmane.org@lists.math.uh.edu Mon Nov 22 21:51:02 2004 Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13] ident=mail) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CWL9K-0002jh-00 for ; Mon, 22 Nov 2004 21:51:02 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu ident=lists) by malifon.math.uh.edu with smtp (Exim 3.20 #1) id 1CWL9K-0001QN-04 for ding-account@gmane.org; Mon, 22 Nov 2004 14:51:02 -0600 Original-Received: from util2.math.uh.edu ([129.7.128.23]) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 1CWL9F-0001QF-00 for ding@lists.math.uh.edu; Mon, 22 Nov 2004 14:50:57 -0600 Original-Received: from justine.libertine.org ([66.139.78.221] ident=postfix) by util2.math.uh.edu with esmtp (Exim 4.30) id 1CWL9D-00086o-5j for ding@lists.math.uh.edu; Mon, 22 Nov 2004 14:50:55 -0600 Original-Received: from yeast.orebokech.com (yeast.orebokech.com [82.67.41.165]) by justine.libertine.org (Postfix) with ESMTP id 436243A00B1 for ; Mon, 22 Nov 2004 14:50:52 -0600 (CST) Original-Received: from pacem.orebokech.com (pacem.orebokech.com [192.168.1.3]) by yeast.orebokech.com (Postfix) with ESMTP id 4B3EB12D04 for ; Mon, 22 Nov 2004 21:50:51 +0100 (CET) Original-Received: by pacem.orebokech.com (Postfix, from userid 1000) id D0DAFB2FCA; Mon, 22 Nov 2004 21:50:52 +0100 (CET) Original-To: ding@gnus.org Mail-Copies-To: nobody Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAKlBMVEWrAAD5q1mnIxLFOBu/ CASwAwKQAAChAAD/AADoZC69AACmAACkGAqpDwUpeJUAAAACZUlEQVQ4jXWTwWsTQRTG51AhmNNk PbhHUwjk2LQHA550W9aI0EMM0l5CYqYhNichEU/GTPFN8LJdkR3w4GEDy548lCh4U5B6D1X/G9+b 3SSbUD9IdnZ++817b99bJkidCFAqgES1+JAxA15FkFUtnqbgprsB4gScxGv7IBegE/0HbJxE4NCA LcWvdTyPgAdZ4CSgvwcwur3hyCN4oTO1pY7pFwRKw4ac+MmQiR6uRmsGia8EQXcTSDwpnwJ1HfiK a88Ad3nS9BsGhxTIMAwdF6TS8tON/HECtEked13X45y/P559NsAkPAkVGkectDc8Yk1yBNKFOFIe 17hra25LYD0DaiHEOQ2Kc1/793f4LWGAsuIYphFm4PHz7yXRKvMr5ioDQpi4BtyjPpzyD2xZnFSU t10i0OYWaybAgQmGAq/wk0BL20wCgengaJajaAUzNeJvwAAezWtDbKPoRStQthnIwdMa9VeciGY0 tosiOQsd++6EZot+kUqCC3GXRfB4PkluCFit6keB0GV1aNQXQEQPrTI/b+HqD7uUwpFL8MvasSu0 6rLL12JLDlLg3rE8v0RhXrL5lbjQ2j8wALxK1RhEjp3iYOG79n/TreKlYpJWl0a0TV3zHZRXSPcT 0N8logNsR6VsCiwlgOp+gG0LRrxYLWYcprZ6ldteYbtY6ps8IkaXzowiac/WGKLfEO3d/S6jqrv0 9wyHaCxM7JbnXzAI4xr2yXFoDmUKtjX1YyX9VqTZ/tBrYCxWYmtfRniwAlpn0bssWH5pCl+mEGkP mL1wmOsbYaYfGuhQAT6ZKoBGN3ns7B9scAM82+9zrwAAAABJRU5ErkJggg== In-Reply-To: <87brpalkm3.fsf@orebokech.com> (Romain Francoise's message of "Sun, 11 Jan 2004 13:45:24 +0100") User-Agent: Gnus/5.110003 (No Gnus v0.3) Emacs/21.3.50 (gnu/linux) Precedence: bulk Original-Sender: ding-owner@lists.math.uh.edu Xref: main.gmane.org gmane.emacs.gnus.general:59251 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:59251 --=-=-= Although nobody picked up my patch 45 weeks ago when I first sent it, I'm attaching an updated version which applies cleanly against current CVS since people asked for it. Who knows, when Larsi comes back at Christmas he might feel like applying it. -- Romain Francoise | Every sky is blue, but not it's a miracle -- http://orebokech.com/ | for me and you. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=hidden-headers.patch Content-Description: Hide headers using narrowing Index: message.el =================================================================== RCS file: /usr/local/cvsroot/gnus/lisp/message.el,v retrieving revision 7.59 diff -u -r7.59 message.el --- message.el 14 Nov 2004 14:27:44 -0000 7.59 +++ message.el 16 Nov 2004 22:19:15 -0000 @@ -1548,7 +1548,8 @@ "Alist of header names/filler functions.") (defvar message-header-format-alist - `((Newsgroups) + `((From) + (Newsgroups) (To) (Cc) (Subject) @@ -3580,9 +3582,9 @@ (unless (bolp) (insert "\n")) ;; Make the hidden headers visible. - (dolist (from-to (message-text-with-property 'message-hidden)) - (add-text-properties (car from-to) (cdr from-to) - '(invisible nil intangible nil))) + (widen) + ;; Sort headers before sending the message. + (message-sort-headers) ;; Make invisible text visible. ;; It doesn't seem as if this is useful, since the invisible property ;; is clobbered by an after-change hook anyhow. @@ -6914,7 +6921,8 @@ (list message-hidden-headers) message-hidden-headers)) (inhibit-point-motion-hooks t) - (after-change-functions nil)) + (after-change-functions nil) + (end-of-headers 0)) (when regexps (save-excursion (save-restriction @@ -6923,11 +6931,17 @@ (while (not (eobp)) (if (not (message-hide-header-p regexps)) (message-next-header) - (let ((begin (point))) + (let ((begin (point)) + header header-len) (message-next-header) - (add-text-properties - begin (point) - '(invisible t message-hidden t)))))))))) + (setq header (buffer-substring begin (point)) + header-len (- (point) begin)) + (delete-region begin (point)) + (goto-char (1+ end-of-headers)) + (insert header) + (setq end-of-headers + (+ end-of-headers header-len)))))))) + (narrow-to-region (1+ end-of-headers) (point-max)))) (defun message-hide-header-p (regexps) (let ((result nil) --=-=-=--