Gnus development mailing list
 help / color / mirror / Atom feed
* Documentation of `message-position-on-field'
@ 2002-09-20 12:41 Micha Wiedenmann
  2002-09-20 12:44 ` Kai Großjohann
  0 siblings, 1 reply; 2+ messages in thread
From: Micha Wiedenmann @ 2002-09-20 12:41 UTC (permalink / 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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Documentation of `message-position-on-field'
  2002-09-20 12:41 Documentation of `message-position-on-field' Micha Wiedenmann
@ 2002-09-20 12:44 ` Kai Großjohann
  0 siblings, 0 replies; 2+ messages in thread
From: Kai Großjohann @ 2002-09-20 12:44 UTC (permalink / raw)
  Cc: ding

Micha Wiedenmann <mw-u1@gmx.de> writes:

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

Without narrow-to-region, it would find lines that look like headers
but are in the body.

kai
-- 
~/.signature is: umop 3p!sdn    (Frank Nobis)



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-09-20 12:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-20 12:41 Documentation of `message-position-on-field' Micha Wiedenmann
2002-09-20 12:44 ` Kai Großjohann

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).