;; mail-parse stuff.
(unless (featurep 'mail-parse)
- ;; Should keep track of `rfc2047-narrow-to-field' in rfc2047.el.
- (defun-maybe std11-narrow-to-field ()
- "Narrow the buffer to the header on the current line."
- (forward-line 0)
- (narrow-to-region (point)
- (progn
- (std11-field-end)
- (when (eolp) (forward-line 1))
- (point)))
- (goto-char (point-min)))
+ (unless (fboundp 'std11-narrow-to-field)
+ (defalias 'std11-narrow-to-field
+ ;; Should keep track of `rfc2047-narrow-to-field' in rfc2047.el.
+ (lambda ()
+ "Narrow the buffer to the header on the current line."
+ (forward-line 0)
+ (narrow-to-region (point)
+ (progn
+ (std11-field-end)
+ (when (eolp) (forward-line 1))
+ (point)))
+ (goto-char (point-min)))))
(defalias 'mail-header-narrow-to-field 'std11-narrow-to-field)
;; Should keep track of `ietf-drums-narrow-to-header' in ietf-drums.el.
(point-max)))
(goto-char (point-min)))
- ;; Should keep track of `rfc2047-fold-region' in rfc2047.el.
- (defun-maybe std11-fold-region (b e)
- "Fold long lines in region B to E."
- (save-restriction
- (narrow-to-region b e)
- (goto-char (point-min))
- (let ((break nil)
- (qword-break nil)
- (first t)
- (bol (save-restriction
- (widen)
- (gnus-point-at-bol))))
- (while (not (eobp))
- (when (and (or break qword-break)
- (> (- (point) bol) 76))
- (goto-char (or break qword-break))
- (setq break nil
- qword-break nil)
- (if (looking-at "[ \t]")
- (insert "\n")
- (insert "\n "))
- (setq bol (1- (point)))
- ;; Don't break before the first non-LWSP characters.
- (skip-chars-forward " \t")
- (unless (eobp)
- (forward-char 1)))
- (cond
- ((eq (char-after) ?\n)
- (forward-char 1)
- (setq bol (point)
- break nil
- qword-break nil)
- (skip-chars-forward " \t")
- (unless (or (eobp) (eq (char-after) ?\n))
- (forward-char 1)))
- ((eq (char-after) ?\r)
- (forward-char 1))
- ((memq (char-after) '(? ?\t))
- (skip-chars-forward " \t")
- (if first
- ;; Don't break just after the header name.
- (setq first nil)
- (setq break (1- (point)))))
- ((not break)
- (if (not (looking-at "=\\?[^=]"))
- (if (eq (char-after) ?=)
- (forward-char 1)
- (skip-chars-forward "^ \t\n\r="))
- (setq qword-break (point))
- (skip-chars-forward "^ \t\n\r")))
- (t
- (skip-chars-forward "^ \t\n\r"))))
- (when (and (or break qword-break)
- (> (- (point) bol) 76))
- (goto-char (or break qword-break))
- (setq break nil
- qword-break nil)
- (if (looking-at "[ \t]")
- (insert "\n")
- (insert "\n "))
- (setq bol (1- (point)))
- ;; Don't break before the first non-LWSP characters.
- (skip-chars-forward " \t")
- (unless (eobp)
- (forward-char 1))))))
-
- ;; Should keep track of `rfc2047-fold-field' in rfc2047.el.
- (defun-maybe std11-fold-field ()
- "Fold the current line."
- (save-excursion
- (save-restriction
- (std11-narrow-to-field)
- (std11-fold-region (point-min) (point-max)))))
-
+ (unless (fboundp 'std11-fold-region)
+ (defalias 'std11-fold-region
+ ;; Should keep track of `rfc2047-fold-region' in rfc2047.el.
+ (lambda (b e)
+ "Fold long lines in region B to E."
+ (save-restriction
+ (narrow-to-region b e)
+ (goto-char (point-min))
+ (let ((break nil)
+ (qword-break nil)
+ (first t)
+ (bol (save-restriction
+ (widen)
+ (gnus-point-at-bol))))
+ (while (not (eobp))
+ (when (and (or break qword-break)
+ (> (- (point) bol) 76))
+ (goto-char (or break qword-break))
+ (setq break nil
+ qword-break nil)
+ (if (looking-at "[ \t]")
+ (insert "\n")
+ (insert "\n "))
+ (setq bol (1- (point)))
+ ;; Don't break before the first non-LWSP characters.
+ (skip-chars-forward " \t")
+ (unless (eobp)
+ (forward-char 1)))
+ (cond
+ ((eq (char-after) ?\n)
+ (forward-char 1)
+ (setq bol (point)
+ break nil
+ qword-break nil)
+ (skip-chars-forward " \t")
+ (unless (or (eobp) (eq (char-after) ?\n))
+ (forward-char 1)))
+ ((eq (char-after) ?\r)
+ (forward-char 1))
+ ((memq (char-after) '(? ?\t))
+ (skip-chars-forward " \t")
+ (if first
+ ;; Don't break just after the header name.
+ (setq first nil)
+ (setq break (1- (point)))))
+ ((not break)
+ (if (not (looking-at "=\\?[^=]"))
+ (if (eq (char-after) ?=)
+ (forward-char 1)
+ (skip-chars-forward "^ \t\n\r="))
+ (setq qword-break (point))
+ (skip-chars-forward "^ \t\n\r")))
+ (t
+ (skip-chars-forward "^ \t\n\r"))))
+ (when (and (or break qword-break)
+ (> (- (point) bol) 76))
+ (goto-char (or break qword-break))
+ (setq break nil
+ qword-break nil)
+ (if (looking-at "[ \t]")
+ (insert "\n")
+ (insert "\n "))
+ (setq bol (1- (point)))
+ ;; Don't break before the first non-LWSP characters.
+ (skip-chars-forward " \t")
+ (unless (eobp)
+ (forward-char 1))))))))
+
+ (unless (fboundp 'std11-fold-field)
+ (defalias 'std11-fold-field
+ ;; Should keep track of `rfc2047-fold-field' in rfc2047.el.
+ (lambda ()
+ "Fold the current line."
+ (save-excursion
+ (save-restriction
+ (std11-narrow-to-field)
+ (std11-fold-region (point-min) (point-max)))))))
(defalias 'mail-header-fold-field 'std11-fold-field)
- ;; Should keep track of `rfc2047-unfold-region' in rfc2047.el.
- (defun-maybe std11-unfold-region (b e)
- "Unfold lines in region B to E."
- (save-restriction
- (narrow-to-region b e)
- (goto-char (point-min))
- (let ((bol (save-restriction
- (widen)
- (gnus-point-at-bol)))
- (eol (gnus-point-at-eol)))
- (forward-line 1)
- (while (not (eobp))
- (if (and (looking-at "[ \t]")
- (< (- (gnus-point-at-eol) bol) 76))
- (delete-region eol (progn
- (goto-char eol)
- (skip-chars-forward "\r\n")
- (point)))
- (setq bol (gnus-point-at-bol)))
- (setq eol (gnus-point-at-eol))
- (forward-line 1)))))
-
- ;; Should keep track of `rfc2047-unfold-field' in rfc2047.el.
- (defun-maybe std11-unfold-field ()
- "Fold the current line."
- (save-excursion
- (save-restriction
- (std11-narrow-to-field)
- (std11-unfold-region (point-min) (point-max)))))
-
+ (unless (fboundp 'std11-unfold-region)
+ (defalias 'std11-unfold-region
+ ;; Should keep track of `rfc2047-unfold-region' in rfc2047.el.
+ (lambda (b e)
+ "Unfold lines in region B to E."
+ (save-restriction
+ (narrow-to-region b e)
+ (goto-char (point-min))
+ (let ((bol (save-restriction
+ (widen)
+ (gnus-point-at-bol)))
+ (eol (gnus-point-at-eol)))
+ (forward-line 1)
+ (while (not (eobp))
+ (if (and (looking-at "[ \t]")
+ (< (- (gnus-point-at-eol) bol) 76))
+ (delete-region eol (progn
+ (goto-char eol)
+ (skip-chars-forward "\r\n")
+ (point)))
+ (setq bol (gnus-point-at-bol)))
+ (setq eol (gnus-point-at-eol))
+ (forward-line 1)))))))
+
+ (unless (fboundp 'std11-unfold-field)
+ (defalias 'std11-unfold-field
+ ;; Should keep track of `rfc2047-unfold-field' in rfc2047.el.
+ (lambda ()
+ "Fold the current line."
+ (save-excursion
+ (save-restriction
+ (std11-narrow-to-field)
+ (std11-unfold-region (point-min) (point-max)))))))
(defalias 'mail-header-unfold-field 'std11-unfold-field)
- ;; This is the original function in T-gnus.
- (defun-maybe std11-extract-addresses-components (string)
- "Extract a list of full name and canonical address from STRING. Each
+ (unless (fboundp 'std11-extract-addresses-components)
+ (defalias 'std11-extract-addresses-components
+ ;; This is the original function in T-gnus.
+ (lambda (string)
+ "Extract a list of full name and canonical address from STRING. Each
element looks like a list of the form (FULL-NAME CANONICAL-ADDRESS).
If no name can be extracted, FULL-NAME will be nil."
- (when string
- (let (addresses)
- (dolist (structure (std11-parse-addresses-string
- (std11-unfold-string string))
- addresses)
- (push (list (std11-full-name-string structure)
- (std11-address-string structure))
- addresses))
- (nreverse addresses))))
+ (when string
+ (let (addresses)
+ (dolist (structure (std11-parse-addresses-string
+ (std11-unfold-string string))
+ addresses)
+ (push (list (std11-full-name-string structure)
+ (std11-address-string structure))
+ addresses))
+ (nreverse addresses))))))
;; Should keep track of `ietf-drums-parse-addresses' in ietf-drums.el.
(defun mail-header-parse-addresses (string)
(setq value (buffer-substring start (point)))))
(goto-char begin)
value))
-
(defalias 'mail-header-field-value 'std11-field-value))
;; ietf-drums stuff.