unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: Recognize mbox files?
@ 2009-02-17 15:27 Alfred M. Szmidt
  2009-02-17 16:36 ` Stefan Monnier
  0 siblings, 1 reply; 45+ messages in thread
From: Alfred M. Szmidt @ 2009-02-17 15:27 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: xma, cyd, rms, emacs-devel

    > What would happen if you have a legal non-mbox file, that
    > contains X-RMAIL-ATTRIBUTES?

   In any case, surely this check would be optional.

I hope not, then it makes rmail not usable for most users.

What is wrong with using real local variables?  Either by adding it to
the first message, or always adding "-*- rmail -*-" to X-RMAIL-...?
That way a user could disable rmail explictly for a file, or enable it
by adding -*- rmail -*- to it.  This would then work exactly as it did
for RMAIL/BABYL.  Without adding specifc rmail hacks to other parts of
emacs.




^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: Recognize mbox files?
@ 2009-02-18 16:57 Alfred M. Szmidt
  0 siblings, 0 replies; 45+ messages in thread
From: Alfred M. Szmidt @ 2009-02-18 16:57 UTC (permalink / raw)
  To: Stephen J. Turnbull; +Cc: xma, cyd, emacs-devel, monnier, rms

   Doesn't Emacs recognize local variables in the last page?  Why not
   simply have a last "message" from Rmail that simply says

       This mailbox is an explicit Rmail mbox.  That means that Emacs
       will recognize it and automatically start Rmail mode, and you can
       set local variables here.  Keep the local variables at the end of
       this message.

       Local Variables:
       mode: rmail
       coding: binary
       End:

   Rmail could suppress display of that message ordinarily.

I like this.




^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: Recognize mbox files?
@ 2009-02-17 23:55 Xavier Maillard
  0 siblings, 0 replies; 45+ messages in thread
From: Xavier Maillard @ 2009-02-17 23:55 UTC (permalink / raw)
  To: Alfred M. Szmidt; +Cc: cyd, stephen, rms, emacs-devel


             A better idea would be for Rmail to detect whether it has
             already munged the file (a quick grep for "^X-RMAIL-.*"
             headers should do) and if not make the buffer read-only.

         That sounds like a good idea.  It should be enough to check the
         first message for that header, since a previous visit with Rmail
         will necessarily have displayed the first message and put that
         header into it.

      This mbox detection problem sounds like what we are trying to solve
      with bug#2222 (Labels). Launching rmail would automatically add a
      message on top of the mbox file, adding special rmail headers and
      thus making this mbox file detection really easy (if grepping for
      rmail headers on the first message). We would have solved two
      problems that way. I am strongly in favour of this approach. Still
      we need to find a consensus to the question: to hide or not to
      hide.

   How would thiis work for "C-x C-f ~/RMAIL.foo"?  Is the suggestion to
   do this check on all files one opens?  I think this would be very
   bad...

See below. But I guess emacs is already doing such check each
time it opens a file, no ?

   Using file variables is the right solution.

This is what we have discussed using normal local variables, so
C-x C-f would work or I did not understand all the discussion :/
The alternative would be to use a special suffix for the rmail
files and add it to the auto-mode-alist variable but I find it
less useful since we cannot offer user the possibility not to
open a mbox file in rmail-mode.

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org




^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: Recognize mbox files?
@ 2009-02-17 23:55 Xavier Maillard
  0 siblings, 0 replies; 45+ messages in thread
From: Xavier Maillard @ 2009-02-17 23:55 UTC (permalink / raw)
  To: Alfred M. Szmidt; +Cc: cyd, stephen, rms, emacs-devel


       > What would happen if you have a legal non-mbox file, that
       > contains X-RMAIL-ATTRIBUTES?

      In any case, surely this check would be optional.

   I hope not, then it makes rmail not usable for most users.

   What is wrong with using real local variables?  Either by adding it to
   the first message, or always adding "-*- rmail -*-" to X-RMAIL-...?
   That way a user could disable rmail explictly for a file, or enable it
   by adding -*- rmail -*- to it.  This would then work exactly as it did
   for RMAIL/BABYL.  Without adding specifc rmail hacks to other parts of
   emacs.

I like this approach.

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org




^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: Recognize mbox files?
@ 2009-02-17 13:10 Alfred M. Szmidt
  2009-02-17 14:17 ` Stephen J. Turnbull
  2009-02-18 12:10 ` Richard M Stallman
  0 siblings, 2 replies; 45+ messages in thread
From: Alfred M. Szmidt @ 2009-02-17 13:10 UTC (permalink / raw)
  To: Richard M Stallman; +Cc: xma, cyd, stephen, emacs-devel

       I still do not understand how this will work for find-file on a
       RMAIL file.  Before you could just do C-x C-f on a RMAIL file,
       and it would open in rmail-mode.  Could someone explain how
       this would work by using X-RMAIL-ATTRIBUTES?

   Emacs would check for X-RMAIL-ATTRIBUTES: in the first message,
   find it, and visit the file using Rmail.

So such a check would be needed for _every_ file one does a find-file
on.  What would happen if you have a legal non-mbox file, that
contains X-RMAIL-ATTRIBUTES?  




^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: Recognize mbox files?
@ 2009-02-16 16:12 Alfred M. Szmidt
  2009-02-17 12:13 ` Richard M Stallman
  0 siblings, 1 reply; 45+ messages in thread
From: Alfred M. Szmidt @ 2009-02-16 16:12 UTC (permalink / raw)
  To: Richard M Stallman; +Cc: xma, cyd, stephen, emacs-devel

I still do not understand how this will work for find-file on a RMAIL
file.  Before you could just do C-x C-f on a RMAIL file, and it would
open in rmail-mode.  Could someone explain how this would work by
using X-RMAIL-ATTRIBUTES?




^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: Recognize mbox files?
@ 2009-02-14 21:52 Alfred M. Szmidt
  0 siblings, 0 replies; 45+ messages in thread
From: Alfred M. Szmidt @ 2009-02-14 21:52 UTC (permalink / raw)
  To: Xavier Maillard; +Cc: cyd, stephen, rms, emacs-devel

	  A better idea would be for Rmail to detect whether it has
	  already munged the file (a quick grep for "^X-RMAIL-.*"
	  headers should do) and if not make the buffer read-only.

      That sounds like a good idea.  It should be enough to check the
      first message for that header, since a previous visit with Rmail
      will necessarily have displayed the first message and put that
      header into it.

   This mbox detection problem sounds like what we are trying to solve
   with bug#2222 (Labels). Launching rmail would automatically add a
   message on top of the mbox file, adding special rmail headers and
   thus making this mbox file detection really easy (if grepping for
   rmail headers on the first message). We would have solved two
   problems that way. I am strongly in favour of this approach. Still
   we need to find a consensus to the question: to hide or not to
   hide.

How would thiis work for "C-x C-f ~/RMAIL.foo"?  Is the suggestion to
do this check on all files one opens?  I think this would be very
bad...

Using file variables is the right solution.




^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: Recognize mbox files?
@ 2009-02-14 21:25 Xavier Maillard
  2009-02-14 22:51 ` Stefan Monnier
  2009-02-16 15:40 ` Richard M Stallman
  0 siblings, 2 replies; 45+ messages in thread
From: Xavier Maillard @ 2009-02-14 21:25 UTC (permalink / raw)
  To: Richard M Stallman; +Cc: cyd, stephen, ams, emacs-devel


       A better idea would be for Rmail to detect whether it has already
       munged the file (a quick grep for "^X-RMAIL-.*" headers should do) and
       if not make the buffer read-only.

   That sounds like a good idea.
   It should be enough to check the first message for that header,
   since a previous visit with Rmail will necessarily have displayed the
   first message and put that header into it.

This mbox detection problem sounds like what we are trying to
solve with bug#2222 (Labels). Launching rmail would automatically
add a message on top of the mbox file, adding special rmail
headers and thus making this mbox file detection really easy (if
grepping for rmail headers on the first message). We would have
solved two problems that way. I am strongly in favour of this
approach. Still we need to find a consensus to the question: to
hide or not to hide.

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org




^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: Recognize mbox files?
@ 2009-02-14 21:25 Xavier Maillard
  0 siblings, 0 replies; 45+ messages in thread
From: Xavier Maillard @ 2009-02-14 21:25 UTC (permalink / raw)
  To: Alfred M. Szmidt; +Cc: eliz, emacs-devel, rms, monnier


          When a buffer was converted to BABYL, the file was never saved
          automatically.

      Rmail still does not save automatically.

   That is very good.

I second that (saving a big file is really slow :/)

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org




^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: Recognize mbox files?
@ 2009-02-13  8:25 Alfred M. Szmidt
  0 siblings, 0 replies; 45+ messages in thread
From: Alfred M. Szmidt @ 2009-02-13  8:25 UTC (permalink / raw)
  To: Richard M Stallman; +Cc: eliz, monnier, emacs-devel

       Infact, a solution to the whole problem is simple.  Upon adding
       headers, add the following header to the first message:

       X-RMAIL-MODE: -*- rmail -*-

   I see two problems with this:

   * The first line is supposed to start with `From ' followed by
     name, date, etc.

The header doesn't need to be on the first line though.

   * If you put that header into just the first message, and you
     delete the first message, the header will no longer be present.

Very true, this did not occur to me.  rmail could check, and add the
header when saving the file.  Then it would work for all cases.

       When a buffer was converted to BABYL, the file was never saved
       automatically.

   Rmail still does not save automatically.

That is very good.





^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: Recognize mbox files?
@ 2009-02-12  8:16 Alfred M. Szmidt
  2009-02-13  6:33 ` Richard M Stallman
  0 siblings, 1 reply; 45+ messages in thread
From: Alfred M. Szmidt @ 2009-02-12  8:16 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: eliz, rms, emacs-devel

   >> >> Otherwise, Rmail will have to be considered risky for use by mail
   >> >> admins.
   >> > Heh, what it does nowadays is nothing compared with what it did before
   >> > the mbox merge: it would convert the file to Babyl!  How's that for
   >> > ``risky''?
   >> 
   >> But *when* did it do it?  Would it do it, just by C-x C-f <somemboxfile> RET?

   > The conversion happened when you turned on rmail-mode.  If C-x C-f did
   > that automatically, the conversion happened automatically just by
   > typing C-x C-f.

   But could C-x C-f do that "by accident"?  Anyway, even if it could, we
   want to be more careful now.  I think the idea of checking the presence
   of RMAIL tags before allowing to modify the buffer is a good plan.

There seems to be confusion about how rmail work(s/ed).

A RMAIL/BABYL file contains a header that specifies the mode of the
file, so when you open such files (C-x C-f), you will get the file in
rmail-mode.

If you opened a random mbox file, no conversion occurs. 

If you type M-x rmail, rmail will read the mail spool, and save the
content to ~/RMAIL, converting the result to BABYL.

When a buffer was converted to BABYL, the file was never saved
automatically.  This was, I found anyway, useful for looking at mbox
files where you could then just use rmail to navigate th file,
disgarding the conversion later.

rmail would _never_ convert a file to BABYL unless the user explicitly
commanded emacs to do so, by invoking M-x rmail, or C-u M-x rmail.


Infact, a solution to the whole problem is simple.  Upon adding
headers, add the following header to the first message:

X-RMAIL-MODE: -*- rmail -*-

The file will then be handled by Emacs correctly, when the user does a
C-x C-f.




^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: Recognize mbox files?
@ 2009-02-12  7:45 Alfred M. Szmidt
  0 siblings, 0 replies; 45+ messages in thread
From: Alfred M. Szmidt @ 2009-02-12  7:45 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: cyd, stephen, rms, emacs-devel

   > Otherwise, Rmail will have to be considered risky for use by mail
   > admins.

   Heh, what it does nowadays is nothing compared with what it did
   before the mbox merge: it would convert the file to Babyl!  How's
   that for ``risky''?

But only if you explicitly did "C-u M-x rmail FILE", it would do
nothing if you just opened a mbox file.




^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: Recognize mbox files?
@ 2009-02-10  7:36 Alfred M. Szmidt
  0 siblings, 0 replies; 45+ messages in thread
From: Alfred M. Szmidt @ 2009-02-10  7:36 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: cyd, rms, emacs-devel

   OTOH, the format of that From line is somewhat free, so we could
   arrange to place some kind of cookie in it (maybe even
   "-*-rmail-*-" could fit).

This sounds like a good solution as well.

   > What about assuming that rmail files always start witj "RMAIL" or
   > "XMAIL" (and ignore case-sensitivity)? Then RMAIL.foo would be a
   > RMAIL file, and xmail.123 would also be a rmail file.

   Yes, a naming convention seems easier.  a ".mbox" extension seems
   like an obvious choice as well.

I dislike this choice, we use the .mbox extention for spool files that
are nott put into the normal mail spool.  Having them open up using
rmail, and consequently get modified wouldn't be good.

   > That would work for most normal cases.  That way if you open
   > /com/mail/ams or some other mail spool file, RMAIL will not do
   > anything funny with it.

   It's important that if opened on a non-mbox file, Rmail shouldn't
   do anything bad (e.g. it shouldn't modify the file).

I do not think that mbox files should be opened using rmail either,
only files that have been explictly OKed by the user (modeline
{X,R}MAIL naming scheme, ...).




^ permalink raw reply	[flat|nested] 45+ messages in thread
* Re: Recognize mbox files?
@ 2009-02-09 18:38 Alfred M. Szmidt
  2009-02-10  1:34 ` Stefan Monnier
  2009-02-10 20:02 ` Richard M Stallman
  0 siblings, 2 replies; 45+ messages in thread
From: Alfred M. Szmidt @ 2009-02-09 18:38 UTC (permalink / raw)
  To: Chong Yidong; +Cc: rms, emacs-devel

   > Is it reliable enough to recognize mbox files that we could visit
   > them automatically in Rmail mode?

   I don't think so.  Mbox files are lines that begin with "From ",
   separated by arbitrary data.  There's not enough information to
   autodetect them.

What about assuming that rmail files always start witj "RMAIL" or
"XMAIL" (and ignore case-sensitivity)? Then RMAIL.foo would be a RMAIL
file, and xmail.123 would also be a rmail file.

That would work for most normal cases.  That way if you open
/com/mail/ams or some other mail spool file, RMAIL will not do
anything funny with it.




^ permalink raw reply	[flat|nested] 45+ messages in thread
* Recognize mbox files?
@ 2009-02-09  5:31 Richard M Stallman
  2009-02-09 18:17 ` Chong Yidong
  0 siblings, 1 reply; 45+ messages in thread
From: Richard M Stallman @ 2009-02-09  5:31 UTC (permalink / raw)
  To: emacs-devel

Is it reliable enough to recognize mbox files
that we could visit them automatically in Rmail mode?




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

end of thread, other threads:[~2009-02-18 16:57 UTC | newest]

Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-17 15:27 Recognize mbox files? Alfred M. Szmidt
2009-02-17 16:36 ` Stefan Monnier
2009-02-18  3:27   ` Stephen J. Turnbull
2009-02-18  3:39     ` Miles Bader
2009-02-18  4:18       ` Stephen J. Turnbull
2009-02-18 12:10       ` Richard M Stallman
2009-02-18 12:09   ` Richard M Stallman
  -- strict thread matches above, loose matches on Subject: below --
2009-02-18 16:57 Alfred M. Szmidt
2009-02-17 23:55 Xavier Maillard
2009-02-17 23:55 Xavier Maillard
2009-02-17 13:10 Alfred M. Szmidt
2009-02-17 14:17 ` Stephen J. Turnbull
2009-02-18 12:10 ` Richard M Stallman
2009-02-16 16:12 Alfred M. Szmidt
2009-02-17 12:13 ` Richard M Stallman
2009-02-14 21:52 Alfred M. Szmidt
2009-02-14 21:25 Xavier Maillard
2009-02-14 22:51 ` Stefan Monnier
2009-02-16 15:40 ` Richard M Stallman
2009-02-14 21:25 Xavier Maillard
2009-02-13  8:25 Alfred M. Szmidt
2009-02-12  8:16 Alfred M. Szmidt
2009-02-13  6:33 ` Richard M Stallman
2009-02-12  7:45 Alfred M. Szmidt
2009-02-10  7:36 Alfred M. Szmidt
2009-02-09 18:38 Alfred M. Szmidt
2009-02-10  1:34 ` Stefan Monnier
2009-02-10  9:36   ` Eli Zaretskii
2009-02-10 20:02 ` Richard M Stallman
2009-02-11  0:34   ` Chetan Pandya
2009-02-11 20:58     ` Richard M Stallman
2009-02-11  4:51   ` Stephen J. Turnbull
2009-02-11 20:18     ` Eli Zaretskii
2009-02-12  1:59       ` Stefan Monnier
2009-02-12  4:09         ` Eli Zaretskii
2009-02-12  5:15           ` Stefan Monnier
2009-02-12  2:40       ` Stephen J. Turnbull
2009-02-11 20:59     ` Richard M Stallman
2009-02-09  5:31 Richard M Stallman
2009-02-09 18:17 ` Chong Yidong
2009-02-09 19:09   ` Harald Hanche-Olsen
2009-02-09 21:26   ` Reiner Steib
2009-02-09 22:06     ` Eli Zaretskii
2009-02-09 22:35       ` Reiner Steib
2009-02-10  8:34         ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

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 read-only IMAP folder(s) and NNTP newsgroup(s).