comparison lisp/mail/mail-hist.el @ 11249:19442fbb6972

Use $ at end when searching for mail-header-separator.
author Richard M. Stallman <rms@gnu.org>
date Fri, 07 Apr 1995 06:36:45 +0000
parents 7d0509b6f039
children 2de0b88cc028
comparison
equal deleted inserted replaced
11248:23dc83e963f6 11249:19442fbb6972
1 ;;; mail-hist.el --- Headers and message body history for outgoing mail. 1 ;;; mail-hist.el --- Headers and message body history for outgoing mail.
2 ;; Copyright (C) 1994 Free Software Foundation, Inc. 2 ;; Copyright (C) 1994 Free Software Foundation, Inc.
3 3
4 ;; Author: Karl Fogel <kfogel@cs.oberlin.edu> 4 ;; Author: Karl Fogel <kfogel@cs.oberlin.edu>
5 ;; Created: March, 1994 5 ;; Created: March, 1994
6 ;; Version: 1.3
7 ;; Keywords: mail, history 6 ;; Keywords: mail, history
8 7
9 ;; This file is part of GNU Emacs. 8 ;; This file is part of GNU Emacs.
10 9
11 ;; GNU Emacs is free software; you can redistribute it and/or modify 10 ;; GNU Emacs is free software; you can redistribute it and/or modify
97 (defsubst mail-hist-current-header-name () 96 (defsubst mail-hist-current-header-name ()
98 "Get name of mail header point is currently in, without the colon. 97 "Get name of mail header point is currently in, without the colon.
99 Returns nil if not in a header, implying that point is in the body of 98 Returns nil if not in a header, implying that point is in the body of
100 the message." 99 the message."
101 (if (save-excursion 100 (if (save-excursion
102 (re-search-backward (concat "^" (regexp-quote mail-header-separator)) 101 (re-search-backward (concat "^" (regexp-quote mail-header-separator)
102 "$")
103 nil t)) 103 nil t))
104 nil ; then we are in the body of the message 104 nil ; then we are in the body of the message
105 (save-excursion 105 (save-excursion
106 (let* ((body-start ; limit possibility of false headers 106 (let* ((body-start ; limit possibility of false headers
107 (save-excursion 107 (save-excursion
108 (re-search-forward 108 (re-search-forward
109 (concat "^" (regexp-quote mail-header-separator)) 109 (concat "^" (regexp-quote mail-header-separator) "$")
110 nil t))) 110 nil t)))
111 (name-start 111 (name-start
112 (re-search-backward mail-hist-header-regexp nil t)) 112 (re-search-backward mail-hist-header-regexp nil t))
113 (name-end 113 (name-end
114 (prog2 (search-forward ":" body-start t) (1- (point))))) 114 (prog2 (search-forward ":" body-start t) (1- (point)))))
125 Places point on the first non-whitespace on the line following the 125 Places point on the first non-whitespace on the line following the
126 colon after the header name, or on the second space following that if 126 colon after the header name, or on the second space following that if
127 the header is empty." 127 the header is empty."
128 (let ((boundary (save-excursion 128 (let ((boundary (save-excursion
129 (re-search-forward 129 (re-search-forward
130 (concat "^" (regexp-quote mail-header-separator)) 130 (concat "^" (regexp-quote mail-header-separator) "$")
131 nil t)))) 131 nil t))))
132 (and 132 (and
133 boundary 133 boundary
134 (let ((unstopped t)) 134 (let ((unstopped t))
135 (setq boundary (save-excursion 135 (setq boundary (save-excursion
172 (save-excursion 172 (save-excursion
173 (mail-hist-beginning-of-header) 173 (mail-hist-beginning-of-header)
174 (let ((start (point))) 174 (let ((start (point)))
175 (or (mail-hist-forward-header 1) 175 (or (mail-hist-forward-header 1)
176 (re-search-forward 176 (re-search-forward
177 (concat "^" (regexp-quote mail-header-separator)))) 177 (concat "^" (regexp-quote mail-header-separator) "$")))
178 (beginning-of-line) 178 (beginning-of-line)
179 (buffer-substring start (1- (point)))))) 179 (buffer-substring start (1- (point))))))
180 180
181 (defsubst mail-hist-get-header-ring (header) 181 (defsubst mail-hist-get-header-ring (header)
182 "Get HEADER's history ring, or nil if none. 182 "Get HEADER's history ring, or nil if none.
217 (mail-hist-current-header-name))) 217 (mail-hist-current-header-name)))
218 (let ((body-contents 218 (let ((body-contents
219 (save-excursion 219 (save-excursion
220 (goto-char (point-min)) 220 (goto-char (point-min))
221 (re-search-forward 221 (re-search-forward
222 (concat "^" (regexp-quote mail-header-separator)) 222 (concat "^" (regexp-quote mail-header-separator) "$")
223 nil) 223 nil)
224 (forward-line 1) 224 (forward-line 1)
225 (buffer-substring (point) (point-max))))) 225 (buffer-substring (point) (point-max)))))
226 (mail-hist-add-header-contents-to-ring "body" body-contents))))) 226 (mail-hist-add-header-contents-to-ring "body" body-contents)))))
227 227