bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#4076: 23.1; RMAIL splitting mbox at text starting with 'From ' (patc


From: David J. Biesack
Subject: bug#4076: 23.1; RMAIL splitting mbox at text starting with 'From ' (patch)
Date: Fri, 07 Aug 2009 14:41:45 -0400

Content-Transfer-Encoding: 7bit
Send a plain text email with the text between the ==== lines below.

The lines beginning with "From " start at the beginning
of the line; there is no leading whitespace or > there
(which might get added by sending this message)
i.e. the message text contains "\n\nFrom " twice.

=====================
This message contains a new paragraph starting with "From " but nit is not a 
new message

>From the beginning, RMAIL/Babyl did not have a problem with this type of 
>message. Now, RMAIl/mbox format does.

this text will show up as a second message; RMAIL will not show any headers.

>From where I sit, this is really annoying.

this text will show up as a third message; RMAIL will not show any headers.
=====================

Using RMAIL where the RMAIL file has been converted to mbox format (23.1),
this mail message gets split up into three separate "messages".
The first has the correct mail headers; the other two have no
header information. The lines beginning with "From " are seen
as new mbox messages.

Attached is a patch to rmail to use rmail-unix-mail-delimiter 
instead of simply searching for or looking-at "From ".

I'm not sure if rmail-unix-mail-delimiter is needed in each place,
but this patch works for me.

David J. Biesack, SAS
SAS Campus Dr. Cary, NC 27513
www.sas.com    (919) 531-7771


In GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600)
 of 2009-07-30 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4)'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  diff-auto-refine-mode: t
  display-time-mode: t
  shell-dirtrack-mode: t
  delete-selection-mode: t
  pc-selection-mode: t
  show-paren-mode: t
  iswitchb-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t
  hs-minor-mode: t

Recent input:
k SPC C-x o C-x C-f r m C-g C-g M-x r m <return> r 
C-g C-g C-x b o r i g <return> M-x r m <return> r m 
a i l . e l . o r SPC <return> M-x r e n a m e - f 
SPC <return> r m SPC . e l SPC . SPC e o <backspace> 
<backspace> o SPC <return> r m a i l . e l . o r g 
<return> C-x p M-p M-b M-b C-b M-b C-b | <return> <down-mouse-1> 
<mouse-1> <backspace> ! <return> <down-mouse-1> <mouse-1> 
<down-mouse-1> <mouse-1> <backspace> <backspace> > 
! <backspace> | <backspace> C-e <return> M-\ M-\ <backspace> 
<return> M-p M-b M-b M-b C-b ! <return> r m SPC <M-wheel-down> 
<M-down-mouse-2> <M-mouse-2> <backspace> <return> M-p 
M-p M-b M-b M-b C-b = <backspace> <backspace> <backspace> 
! <backspace> > <return> <help-echo> <down-mouse-1> 
<mouse-1> C-x C-w r m a i l . e l . o r SPC SPC <return> 
y C-x C-w r m a SPC . e l SPC . o r i SPC <backspace> 
<return> C-x p r m r m <backspace> <backspace> SPC 
r m a i l . e l . o r g <return> M-p <backspace> <backspace> 
* C-a C-d C-d l l <return> r m SPC r m a i l * <M-backspace> 
<M-backspace> C-p C-p C-p C-p C-p C-p C-p C-e <return> 
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p <return> C-p 
C-p C-p C-e <return> <down-mouse-3> <mouse-3> C-x k 
SPC C-p C-p <return> C-p C-p C-e M-b M-b M-b M-b C-b 
M-d M-b M-b C-b C-y C-e <return> <down-mouse-3> <mouse-3> 
<down-mouse-1> <mouse-1> <down-mouse-1> <mouse-1> M-x 
r e p o r t - e m a c s - b u f SPC g <backspace> <backspace> 
g SPC <return>

Recent messages:
rmail.el.patch
Fontifying rmail.el.patch... (regexps................)
rmail.el.patch
Kill buffer rmail.el.patch? (y or n) 
Mark set
rmail.el.patch [2 times]
Fontifying rmail.el.patch... (regexps................)
rmail.el.patch
Fontifying rmail.el.patch... (regexps................)
rmail.el.patch

patch below


*** rmail.el.orig       Fri Aug  7 14:26:34 2009
--- rmail.el    Fri Aug  7 14:24:07 2009
***************
*** 772,777 ****
--- 772,784 ----
  this expression, you must change the code in `rmail-nuke-pinhead-header'
  that knows the exact ordering of the \\( \\) subexpressions.")
  
+ ; fix broken rmail-add-mbox-headers in rmail.el 
+ ; which originally breaks messages at any text starting with "^From " instead 
of rmail-unix-mail-delimiter
+ ; address@hidden 07Aug09
+ (defvar rmail-unix-mail-delimiter-nn (concat "\n\n" rmail-unix-mail-delimiter)
+       "Like rmail-unix-mail-delimiter but with \n\n prepended.")
+ 
+ 
  ;; FIXME the rmail-header-name headers ought to be customizable.
  ;; It seems a bit arbitrary, for example, that all of the Date: line
  ;; gets highlighted.
***************
*** 2059,2064 ****
--- 2066,2072 ----
    (unless (looking-back "\n\n")
      (insert "\n")))
  
+ ;; patched to use rmail-unix-mail-delimiter instead of "From " address@hidden 
07Aug09
  (defun rmail-add-mbox-headers ()
    "Validate the RFC2822 format for the new messages.
  Point should be at the first new message.
***************
*** 2077,2083 ****
        (unless (= start (point-max))
          ;; Scan the new messages to establish a count and to ensure that
          ;; an attribute header is present.
!         (while (looking-at "From ")
            ;; Determine if a new attribute header needs to be added to
            ;; the message.
            (if (search-forward "\n\n" nil t)
--- 2085,2091 ----
        (unless (= start (point-max))
          ;; Scan the new messages to establish a count and to ensure that
          ;; an attribute header is present.
!         (while (looking-at rmail-unix-mail-delimiter) ;; was : (looking-at 
"From ") sasdjb 07Aug09
            ;; Determine if a new attribute header needs to be added to
            ;; the message.
            (if (search-forward "\n\n" nil t)
***************
*** 2090,2099 ****
                  (widen))
              (rmail-error-bad-format))
            ;; Move to the next message.
!           (if (search-forward "\n\nFrom " nil 'move)
                (forward-char -5))
            (setq start (point))))
        count))))
  
  (defun rmail-get-header-1 (name)
    "Subroutine of `rmail-get-header'.
--- 2098,2109 ----
                  (widen))
              (rmail-error-bad-format))
            ;; Move to the next message.
!           (if (search-forward rmail-unix-mail-delimiter-nn nil 'move)
                (forward-char -5))
            (setq start (point))))
        count))))
+ 
+ 
  
  (defun rmail-get-header-1 (name)
    "Subroutine of `rmail-get-header'.
***************
*** 2475,2497 ****
                    ?D
                  ?\s) deleted-head))))
  
  (defun rmail-set-message-counters-counter (&optional stop)
    ;; Collect the start position for each message into 'messages-head.
    (let ((start (point)))
      (while (search-backward "\n\nFrom " stop t)
        (forward-char 2)
!       (rmail-collect-deleted start)
!       (setq messages-head (cons (point-marker) messages-head)
!           total-messages (1+ total-messages)
!           start (point))
!       ;; Show progress after every 20 messages or so.
!       (if (zerop (% total-messages 20))
!         (message "Counting messages...%d" total-messages)))
      ;; Handle the first message, maybe.
      (if stop
        (goto-char stop)
        (goto-char (point-min)))
!     (unless (not (looking-at "From "))
        (rmail-collect-deleted start)
        (setq messages-head (cons (point-marker) messages-head)
            total-messages (1+ total-messages)))))
--- 2485,2510 ----
                    ?D
                  ?\s) deleted-head))))
  
+ ;; patched to use rmail-unix-mail-delimiter instead of "From "; 
address@hidden 07Aug09
  (defun rmail-set-message-counters-counter (&optional stop)
    ;; Collect the start position for each message into 'messages-head.
    (let ((start (point)))
      (while (search-backward "\n\nFrom " stop t)
        (forward-char 2)
!       (cond ((looking-at rmail-unix-mail-delimiter)
!              (rmail-collect-deleted start)
!              (setq messages-head (cons (point-marker) messages-head)
!                    total-messages (1+ total-messages)
!                    start (point))
!              ;; Show progress after every 20 messages or so.
!              (if (zerop (% total-messages 20))
!                  (message "Counting messages...%d" total-messages))))
!       )
      ;; Handle the first message, maybe.
      (if stop
        (goto-char stop)
        (goto-char (point-min)))
!     (unless (not (looking-at rmail-unix-mail-delimiter))
        (rmail-collect-deleted start)
        (setq messages-head (cons (point-marker) messages-head)
            total-messages (1+ total-messages)))))






reply via email to

[Prev in Thread] Current Thread [Next in Thread]