all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#4448: 23.1; unrmail fails if buffer has mixed line endings (patch)
@ 2009-09-16 13:28 David J. Biesack
  2009-09-16 17:17 ` Eli Zaretskii
  0 siblings, 1 reply; 7+ messages in thread
From: David J. Biesack @ 2009-09-16 13:28 UTC (permalink / raw)
  To: bug-gnu-emacs


I invoked rmail-input on an RMAIL file and got the following traceback.

I performed find-file-literally on the rmail file and found that
it has mixed line endings - text text of the first messages end in just LF and
others end in CR LF. This causes the 

                  (re-search-forward "^[*][*][*] EOOH [*][*][*]\n")

in unrmail to fail.

below is the traceback.

Debugger entered--Lisp error: (search-failed "^[*][*][*] EOOH [*][*][*]
")
  re-search-forward("^[*][*][*] EOOH [*][*][*]\n")
  unrmail("c:/TEMP/rmail4124CNA" "c:/TEMP/rmail4124PXG")
  byte-code("=3fffc6=3fffc7!=3fffc6=3fffc7!\x18\x19=3fffc8=3fff8e=3fffc9 =3fff88=3fffcaed   #=3fff88=3fffcb \b\"=3fff88=3fffcc=3fffcd!=3fff88=3fffce=3fffcf=3fffce\x1a^[\x1c=3fffd0 =3fff88=3fffd1\b!=3fff88=3fffd2=3fffd3!=3fff88=3fffd4 =3fff88=3fffd5 =3fff88=3fffd6 =3fff88=3fffce\x15=3fffd7 =3fff88db=3fff88=3fffd8 =3fff88+=3fffcc=3fffd9!+=3fff87" [new-file old-file buffer-undo-list coding-system-for-read inhibit-read-only rmail-was-converted make-temp-file "rmail" ((byte-code "=3fffc2\b!=3fff88=3fffc2  !=3fff87" [old-file new-file delete-file] 2)) kill-all-local-variables write-region unrmail message "Replacing BABYL format with mbox format..." t raw-text erase-buffer insert-file-contents set-buffer-file-coding-system raw-text-unix rmail-mode-1 rmail-perm-variables rmail-variables rmail-dont-modify-format rmai
 l-set-message-counters "Replacing BABYL format with mbox format...done"] 4)
  rmail-convert-babyl-to-mbox()
  byte-code("=3fffc2 =3fff88eb=3fff88=3fffc3\x18=3fffc4=3fffc5!=3fff83\x13  rmail-convert-file-maybe()
  byte-code("=3fffc6 =3fff88=3fffc7\b=3fff86      rmail("u:/rmail/test-rmail-to-mbox")
  byte-code("=3fffc1\b!=3fff87" [filename rmail] 2)
  rmail-input("u:/rmail/test-rmail-to-mbox")
  call-interactively(rmail-input nil nil)

Here is a patch which makes it work, but I don't think this is the correct
change; it seems that the correct change would be to account for coding
systems. But this works for me.

*** unrmail.el.orig     Wed Sep 16 09:14:27 2009
--- unrmail.el  Wed Sep 16 09:24:22 2009
***************
*** 167,180 ****
                      (forward-line 1)))
                  (delete-region (point-min) (point))
                  ;; Delete the old reformatted header.
!                 (re-search-forward "^[*][*][*] EOOH [*][*][*]\n")
                  (forward-line -1)
                  (let ((start (point)))
!                   (search-forward "\n\n")
                    (delete-region start (point))))
              ;; Not reformatted.  Delete the special
              ;; lines before the real header.
!             (re-search-forward "^[*][*][*] EOOH [*][*][*]\n")
              (delete-region (point-min) (point)))
  
            ;; Handle rmime formatting.
--- 167,180 ----
                      (forward-line 1)))
                  (delete-region (point-min) (point))
                  ;; Delete the old reformatted header.
!                 (re-search-forward "^[*][*][*] EOOH [*][*][*]\015?\n")
                  (forward-line -1)
                  (let ((start (point)))
!                   (re-search-forward "\n\015?\n")
                    (delete-region start (point))))
              ;; Not reformatted.  Delete the special
              ;; lines before the real header.
!             (re-search-forward "^[*][*][*] EOOH [*][*][*]\015?\n")
              (delete-region (point-min) (point)))
  
            ;; Handle rmime formatting.
***************
*** 188,194 ****
            (save-restriction
              (narrow-to-region
               (point-min)
!              (save-excursion (search-forward "\n\n" nil 'move) (point)))
  
              ;; Fetch or construct what we should use in the `From ' line.
              (setq mail-from (or (let ((from (mail-fetch-field "Mail-From")))
--- 188,194 ----
            (save-restriction
              (narrow-to-region
               (point-min)
!              (save-excursion (re-search-forward "\n\015?\n" nil 'move) (point)))
  
              ;; Fetch or construct what we should use in the `From ' line.
              (setq mail-from (or (let ((from (mail-fetch-field "Mail-From")))
***************
*** 234,240 ****
                (insert ?>)))
            ;; Make sure the message ends with two newlines
            (goto-char (point-max))
!           (unless (looking-back "\n\n")
              (insert "\n"))
            ;; Write it to the output file, suitably encoded.
            (let ((coding-system-for-write coding))
--- 234,240 ----
                (insert ?>)))
            ;; Make sure the message ends with two newlines
            (goto-char (point-max))
!           (unless (looking-back "\n\015?\n")
              (insert "\n"))
            ;; Write it to the output file, suitably encoded.
            (let ((coding-system-for-write coding))


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: Debugger

Minor modes in effect:
  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

Recent input:
C-x C-o C-g C-g C-x o M-x ^ m <return> C-x C-s <escape> 
C-x k SPC <backspace> C-g C-g C-x k SPC q C-x b R M 
<return> i I n s t a SPC <return> C-x , o i n s t a 
SPC <return> y e s <return> C-x C-f C o d e SPC P SPC 
<return> q C-x b C o d e C-s C-s <return> C-x ~ M-x 
f i n d - f i l e - l i SPC <return> C o d e P SPC 
<return> y C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-p C-p C-p C-s C-w C-w C-r C-r C-s C-s M-> C-r 
C-r M-< M-x ^ m <return> C-x C-s <escape> C-x k SPC 
C-g C-g C-g C-n C-n C-x k SPC i C o d e P SPC <return> 
C-x C-s h C-x o C-x b I <backspace> R M <return> o 
C o d e P r o SPC <return> y e s <return> C-x C-s C-x 
k SPC C-x C-f <backspace> <return> <up> <up> <up> <up> 
<up> <down> e C-x k SPC <down> <down> <down> <down> 
<down> <down> <down> C-x o i A d d SPC <return> C-x 
k SPC C-x o C-n C-n C-n C-p C-p C-n e C-x k SPC d C-n 
C-n C-n <f2> C-e <backspace> C-d <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
t e s t - r m a i l - t o - m b o x <return> C-x o 
C-x D C-x D i t e s t 0 <backspace> - m <backspace> 
r m SPC SPC SPC SPC <return> C-x h M-w M-x r e p o 
r t 0 <backspace> - e m SPC <return>

Recent messages:
Press RET when finished
Toggling font-lock-mode off; better pass an explicit argument.
Auto-saving...done
(setq debug-on-error nil)
(setq debug-on-error t)
Wrote c:/TEMP/rmail4124CNA
Writing messages to c:/TEMP/rmail4124PXG...
Entering debugger...
Mark set [2 times]
Region saved


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






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

end of thread, other threads:[~2009-09-17 14:56 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-16 13:28 bug#4448: 23.1; unrmail fails if buffer has mixed line endings (patch) David J. Biesack
2009-09-16 17:17 ` Eli Zaretskii
2009-09-16 17:48   ` David J. Biesack
2009-09-16 20:33     ` Eli Zaretskii
2009-09-17 12:58       ` David J. Biesack
2009-09-17 14:06         ` Stefan Monnier
2009-09-17 14:56           ` David J. Biesack

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.