comparison discussion.roff @ 130:0b9aa74ced4d

Reworked the text on the Trash Folder.
author markus schnalke <meillo@marmaro.de>
date Mon, 02 Jul 2012 23:14:19 +0200
parents 01af3c0dfe7b
children 7c741bc8f719
comparison
equal deleted inserted replaced
129:01af3c0dfe7b 130:0b9aa74ced4d
3475 3475
3476 3476
3477 .H2 "Trash Folder 3477 .H2 "Trash Folder
3478 .P 3478 .P
3479 Similar to the situation for drafts is the situation for removed messages. 3479 Similar to the situation for drafts is the situation for removed messages.
3480 Historically, a message was deleted by renaming. 3480 Historically, a message was ``deleted'' by prepending a specific
3481 A specific 3481 \fIbackup prefix\fP, usually the comma character,
3482 \fIbackup prefix\fP, often comma (\c 3482 to the file name.
3483 .Fn , ) 3483 The specific message would vanish from MH because only files with
3484 or hash (\c 3484 non-digit characters in their name are not treated as messages.
3485 .Fn # ), 3485 Although files remained in the file system,
3486 being prepended to the file name. 3486 the messages were no more visible in MH.
3487 Thus, MH wouldn't recognize the file 3487 To truly delete them, a maintenance job is needed.
3488 as a message anymore, as only files whose name consists of digits only 3488 Usually a cron job is installed to delete them after a grace time.
3489 are treated as messages. 3489 For instance:
3490 The removed messages remained as files in the
3491 same directory and needed some maintenance job to truly delete them after
3492 some grace time.
3493 Usually, by running a command similar to
3494 .VS 3490 .VS
3495 find /home/user/Mail -ctime +7 -name ',*' | xargs rm 3491 find $HOME/Mail -type f -name ',*' -ctime +7 -delete
3496 VE 3492 VE
3497 in a cron job. 3493 In such a setup, the original message can be restored
3498 Within the grace time interval 3494 within the grace time interval by stripping the
3499 the original message could be restored by stripping the
3500 the backup prefix from the file name. 3495 the backup prefix from the file name.
3501 If however, the last message of 3496 But one can not rely on this statement.
3502 a folder is been removed \(en say message 3497 If the last message of a folder with six messages (1-6) is removed,
3498 message
3499 .Fn 6 ,
3500 becomes file
3501 .Fn ,6 .
3502 If then a new message enters the same folder, it will be given
3503 the number one higher than the highest existing message.
3504 In this case the message is named
3503 .Fn 6 3505 .Fn 6
3504 becomes file 3506 then.
3505 .Fn ,6 3507 If this message is removed as well,
3506 \(en and a new message enters the same folder, thus the same 3508 then the backup of the former message gets overwritten.
3507 numbered being given again \(en in our case 3509 Hence, the ability to restore removed messages does not only depend on
3508 .Fn 6
3509 \(en, if that one
3510 is removed too, then the backup of the former message gets overwritten.
3511 Thus, the ability to restore removed messages does not only depend on
3512 the ``sweeping cron job'' but also on the removing of further messages. 3510 the ``sweeping cron job'' but also on the removing of further messages.
3513 This is undesirable, because the real mechanism is hidden from the user 3511 It is undesirable to have such obscure and complex mechanisms.
3514 and the consequences of further removals are not always obvious. 3512 The user should be given a small set of clear assertions.
3515 Further more, the backup files are scattered within the whole mail 3513 ``Removed files are restorable within a seven-day grace time.''
3516 storage, instead of being collected at one place. 3514 is such a clear assertion.
3517 .P 3515 With the addition ``... unless a message with the same name in the
3518 To improve the situation, the profile entry 3516 same folder is removed before.'' the statement becomes complex.
3517 A user will hardly be able to keep track of any removal to know
3518 if the assertion still holds true for a specific file.
3519 The the real mechanism is practically obscure to the user.
3520 The consequences of further removals are not obvious.
3521 .P
3522 Further more, the backup files are scattered within the whole mail storage.
3523 This complicates managing them.
3524 It is possible, with help of
3525 .Pn find ,
3526 but everything would be more convenient
3527 if the deleted messages would be collected in one place.
3528 .P
3529 The profile entry
3519 .Pe rmmproc 3530 .Pe rmmproc
3520 (previously named 3531 (previously named
3521 .Pe Delete-Prog ) 3532 .Pe Delete-Prog )
3522 was introduced, very early. 3533 was introduced very early to improve the situation.
3523 It could be set to any command, which would care for the mail removal 3534 It could be set to any command, which would be executed to removed
3524 instead of taking the default action, described above. 3535 the specified messages.
3525 Refiling the to-be-removed files to some garbage folder was a common 3536 This would override the default action, described above.
3526 example. 3537 Refiling the to-be-removed files to a garbage folder is the usual example.
3527 Nmh's man page 3538 Nmh's man page
3528 .Mp rmm(1) 3539 .Mp rmm (1)
3529 proposes 3540 proposes to set the
3541 .Pe rmmproc
3542 to
3530 .Cl "refile +d 3543 .Cl "refile +d
3531 to move messages to the garbage folder and 3544 to move messages to the garbage folder,
3545 .Fn +d ,
3546 instead of renaming them with the backup prefix.
3547 The man page proposes additionally the expunge command
3532 .Cl "rm `mhpath +d all` 3548 .Cl "rm `mhpath +d all`
3533 the empty the garbage folder. 3549 to empty the garbage folder.
3534 Managing the message removal this way is a sane approach. 3550 .P
3535 It keeps 3551 Removing messages in such a way has advantages.
3536 the removed messages in one place, makes it easy to remove the backup 3552 The mail storage is prevented from being cluttered with removed messages
3537 files, and, most important, enables the user to use the tools of MH 3553 because they are all collected in one place.
3538 itself to operate on the removed messages. 3554 Existing and removed messages are thus separated more strictly.
3539 One can 3555 No backup files are silently overwritten.
3540 .Pn scan 3556 Most important is the ability to keep removed messages in the MH domain.
3541 them, 3557 Messages in the trash folder can be listed like those in any other folder.
3542 .Pn show 3558 Deleted messages can be displayed like any other messages.
3543 them, and restore them with 3559 Restoring a deleted messages can be done with
3544 .Pn refile . 3560 .Pn refile .
3545 There's no more 3561 All operations on deleted files are still covered by the MH tools.
3546 need to use 3562 The trash folder is just like any other folder in the mail storage.
3547 .Pn mhpath 3563 .P
3548 to switch over from MH tools to Unix tools \(en MH can do it all itself. 3564 Similar to the draft folder case, I dropped the old backup prefix approach
3549 .P 3565 in favor for replacing it by the better suiting trash folder system.
3550 This approach matches perfect with the concepts of MH, thus making 3566 Hence,
3551 it powerful. 3567 .Pn rmm
3552 Hence, I made it the default. 3568 calls
3553 And even more, I also 3569 .Pn refile
3554 removed the old backup prefix approach, as it is clearly less powerful. 3570 to move the to-be-removed message to the trash folder,
3571 .Fn +trash
3572 by default.
3573 To sweep it clean, one can use
3574 .Cl "rmm -unlink +trash a" ,
3575 where the
3576 .Sw -unlink
3577 switch causes the files to be unlinked.
3578 .P
3579 Dropping the legacy approach and completely converting to the new approach
3580 simplified the code base.
3581 The relationship between
3582 .Pn rmm
3583 and
3584 .Pn refile
3585 was inverted.
3586 In mmh,
3587 .Pn rmm
3588 invokes
3589 .Pn refile ,
3590 which used to be the other way round.
3591 Yet, the relationship is simpler now.
3592 No more can loops, like described in nmh's man page for
3593 .Mp refile (1),
3594 occur:
3595 .QS
3596 Since
3597 .Pn refile
3598 uses your
3599 .Pe rmmproc
3600 to delete the message, the
3601 .Pe rmmproc
3602 must NOT call
3603 .Pn refile
3604 without specifying
3605 .Sw -normmproc
3606 or you will create an infinite loop.
3607 .QE
3608 .LP
3609 .Pn rmm
3610 either unlinks a message with
3611 .Fu unlink()
3612 or invokes
3613 .Pn refile
3614 to move it to the trash folder.
3615 .Pn refile
3616 does not invoke any tools.
3617 .P
3618
3619
3620
3555 Keeping unused alternative in the code is a bad choice as they likely 3621 Keeping unused alternative in the code is a bad choice as they likely
3556 gather bugs, by not being constantly tested. 3622 gather bugs, by not being constantly tested.
3557 Also, the increased code 3623 Also, the increased code
3558 size and more conditions crease the maintenance costs. 3624 size and more conditions crease the maintenance costs.
3559 By strictly 3625
3560 converting to the trash folder approach, I simplified the code base. 3626 By generalizing the message removal in a way that it becomes covered
3561 .Pn rmm 3627 by the MH concepts makes the whole system more powerful.
3562 calls 3628
3563 .Pn refile
3564 internally to move the to-be-removed
3565 message to the trash folder (\c
3566 .Fn +trash
3567 by default).
3568 Messages
3569 there can be operated on like on any other message in the storage.
3570 The sweep clean, one can use
3571 .Cl "rmm -unlink +trash a" ,
3572 where the
3573 .Sw -unlink
3574 switch causes the files to be truly unliked instead
3575 of moved to the trash folder.
3576 3629
3577 3630
3578 .H2 "Path Notations 3631 .H2 "Path Notations
3579 .P 3632 .P
3580 foo 3633 FIXME! TODO
3581 3634
3582
3583 .H2 "MIME Integration
3584 .P
3585 user-visible access to whole messages and MIME parts are inherently
3586 different
3587 3635
3588 3636
3589 .H2 "Of One Cast 3637 .H2 "Of One Cast
3590 .P 3638 .P