home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / misc / safe-rmail.el < prev    next >
Encoding:
Text File  |  1990-07-22  |  2.0 KB  |  64 lines

  1. ;From utkcs2!emory!swrinde!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!compass.com!worley Wed Jun  6 14:24:58 EDT 1990
  2. ;Article 2911 of gnu.emacs:
  3. ;Path: utkcs2!emory!swrinde!zaphod.mps.ohio-state.edu!tut.cis.ohio-state.edu!compass.com!worley
  4. ;>From: worley@compass.com (Dale Worley)
  5. ;Newsgroups: gnu.emacs
  6. ;Subject: Protecting Rmail files from unintentional expunges
  7. ;Message-ID: <9006061422.AA00787@sn1987a.compass.com>
  8. ;Date: 6 Jun 90 14:22:52 GMT
  9. ;Sender: daemon@tut.cis.ohio-state.edu
  10. ;Distribution: gnu
  11. ;Organization: GNUs Not Usenet
  12. ;Lines: 48
  13. ;
  14. ;The following code protects your Rmail files from unintentional
  15. ;expunges, by requiring a prefix argument on rmail-expunge (E and X),
  16. ;rmail-save (S), and rmail-quit (Q).  If you do not give an argument,
  17. ;these commands just beep.  The hook function interacts safely with
  18. ;hook functions that redefine the rmail-mode-map, because it uses
  19. ;substitute-key-definition.
  20.  
  21. (require 'rmail)
  22.  
  23. (setq rmail-mode-hook
  24.       (cons '(lambda ()
  25.            (substitute-key-definition 'rmail-expunge 'rmail-expunge-safely
  26.                       rmail-mode-map)
  27.            (substitute-key-definition 'rmail-expunge-and-save
  28.                       'rmail-expunge-and-save-safely
  29.                       rmail-mode-map)
  30.            (substitute-key-definition 'rmail-quit 'rmail-quit-safely
  31.                       rmail-mode-map))
  32.         rmail-mode-hook))
  33.  
  34. (defun rmail-expunge-safely (x)
  35.   "Actually erase all deleted messages in the file.
  36. Requires an argument, for safety's sake."
  37.   (interactive "P")
  38.   (if x
  39.       (rmail-expunge)
  40.     (beep)))
  41.  
  42. (defun rmail-expunge-and-save-safely (x)
  43.   "Expunge and save RMAIL file.
  44. Requires an argument, for safety's sake."
  45.   (interactive "P")
  46.   (if x
  47.       (rmail-expunge-and-save)
  48.     (beep)))
  49.  
  50. (defun rmail-quit-safely (x)
  51.   "Quit out of RMAIL.
  52. Requires an argument, for safety's sake."
  53.   (interactive "P")
  54.   (if x
  55.       (rmail-quit)
  56.     (beep)))
  57.  
  58. ;Dale Worley        Compass, Inc.            worley@compass.com
  59. ;--
  60. ;Don't waste the money to see _Waiting for Godot_.  There isn't
  61. ;any point to it -- believe it or not, Godot never arrives.
  62.  
  63.  
  64.