Gnus development mailing list
 help / color / mirror / Atom feed
From: Micha Wiedenmann <mw-u1@gmx.de>
Subject: Documentation of `message-position-on-field'
Date: 20 Sep 2002 14:41:15 +0200	[thread overview]
Message-ID: <87bs6sdgcy.fsf@ID-56226.news.dfncis.de> (raw)

Hi,

could explain the use of `narrow-to-region' in
`message-position-on-field'. I think it doesn't do anything.

What about a Docstring:
  "Move point to HEADER. Insert HEADER after first matching AFTERS if
HEADER does not exits."

,----
| (defun message-position-on-field (header &rest afters)
|   (let ((case-fold-search t))
|     (save-restriction
|       (narrow-to-region
|        (goto-char (point-min))
|        (progn
| 	 (re-search-forward
| 	  (concat "^" (regexp-quote mail-header-separator) "$"))
| 	 (match-beginning 0)))
|       (goto-char (point-min))
|       (if (re-search-forward (concat "^" (regexp-quote header) ":") nil t)
| 	  (progn
| 	    (re-search-forward "^[^ \t]" nil 'move)
| 	    (beginning-of-line)
| 	    (skip-chars-backward "\n")
| 	    t)
| 	(while (and afters
| 		    (not (re-search-forward
| 			  (concat "^" (regexp-quote (car afters)) ":")
| 			  nil t)))
| 	  (pop afters))
| 	(when afters
| 	  (re-search-forward "^[^ \t]" nil 'move)
| 	  (beginning-of-line))
| 	(insert header ": \n")
| 	(forward-char -1)
| 	nil))))
`----

TIA, Micha
-- 
Bus error -- driver executed.



             reply	other threads:[~2002-09-20 12:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-20 12:41 Micha Wiedenmann [this message]
2002-09-20 12:44 ` Kai Großjohann

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=87bs6sdgcy.fsf@ID-56226.news.dfncis.de \
    --to=mw-u1@gmx.de \
    --cc=mw-r1@gmx.de \
    /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).