Gnus development mailing list
 help / color / mirror / Atom feed
From: Romain Francoise <romain@orebokech.com>
Subject: Re: [PATCH] Hide headers using narrowing
Date: Mon, 22 Nov 2004 21:50:52 +0100	[thread overview]
Message-ID: <877jod7glv.fsf@orebokech.com> (raw)
In-Reply-To: <87brpalkm3.fsf@orebokech.com> (Romain Francoise's message of "Sun, 11 Jan 2004 13:45:24 +0100")

[-- Attachment #1: Type: text/plain, Size: 383 bytes --]

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 <romain@orebokech.com> | Every sky is blue, but not
it's a miracle -- http://orebokech.com/ | for me and you.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Hide headers using narrowing --]
[-- Type: text/x-patch, Size: 1927 bytes --]

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)

  reply	other threads:[~2004-11-22 20:50 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-11 12:45 Romain Francoise
2004-11-22 20:50 ` Romain Francoise [this message]
2004-11-23  0:18   ` Katsumi Yamaoka
2004-11-23 11:21     ` Romain Francoise
2004-11-23 12:55       ` Katsumi Yamaoka
2004-11-23 13:39         ` Romain Francoise
2004-11-23 14:49           ` Reiner Steib
2004-11-23 15:41             ` Romain Francoise
2004-11-23 16:35               ` Reiner Steib
2004-11-25  0:39                 ` Katsumi Yamaoka
2004-11-25 12:46                   ` Katsumi Yamaoka
2004-11-25 13:18                     ` Ralf Angeli
2004-11-25 13:36                       ` Romain Francoise
2004-11-25 15:33                         ` Katsumi Yamaoka
2004-11-25 23:23                           ` Katsumi Yamaoka
2004-11-25 23:47                             ` Katsumi Yamaoka
2006-04-15 12:34                       ` Lars Magne Ingebrigtsen
2004-11-25 13:32                     ` Romain Francoise
2005-01-02 18:45                       ` Romain Francoise
2005-01-02 23:33                         ` Katsumi Yamaoka

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=877jod7glv.fsf@orebokech.com \
    --to=romain@orebokech.com \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).