home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / misc / startup-2.el < prev    next >
Encoding:
Text File  |  1990-03-21  |  2.6 KB  |  85 lines

  1. ;From: jv@mhres.mh.nl (Johan Vromans)
  2. ;Newsgroups: comp.emacs
  3. ;Subject: GNU Emacs startup service
  4. ;Message-ID: <3468@mhres.mh.nl>
  5. ;Date: 19 Aug 89 09:01:54 GMT
  6. ;Organization: Multihouse NV, the Netherlands
  7. ;Lines: 76
  8. ;
  9. ;I like GNU Emacs to be started from my .profile when I login, and I
  10. ;use the following startup file to have Emacs present me screenful of
  11. ;things I want to know when I login, e.g. mail status, disk status
  12. ;etc.. It could invoke the mail handler for me, but my mail is
  13. ;automatically fetched by Emacs as soon as it appears.
  14. ;
  15. ;Take it for what it's worth, I like it.
  16. ;
  17. ;;; StartUp.el
  18. ;;;
  19. ;;; Automatic services performed upon startup
  20. ;;;
  21. ;;; Usage: enter the following line in your .profile or .login:
  22. ;;;
  23. ;;;    emacs -l StartUp.el
  24. ;;;
  25. ;;; Note: BSD sites need to change "remsh" into "rsh".
  26. ;;;
  27. ;;; This file is hereby declared Public Domain
  28. ;;;
  29. ;;;    1989, Johan Vromans
  30.  
  31. ;; setup the startup buffer
  32. (setq StartUp-buffer "*StartUp*")
  33. (get-buffer-create StartUp-buffer)
  34. (switch-to-buffer StartUp-buffer)
  35. (erase-buffer)
  36.  
  37. (insert "Starting up...\n\n")
  38.  
  39. (defun jv-check-file (file msg)
  40.   "Checks if FILE exists and has a non-zero length. Inserts MESSAGE if
  41. this is true."
  42.   (if (and
  43.        (file-exists-p file)
  44.        (> (nth 7 (file-attributes file)) 0))
  45.       (insert (concat msg "\n"))))
  46.  
  47. (jv-check-file "~/maildir/ToDo"   "There are things to be done.")
  48. (jv-check-file "~/maildir/printq" "There are things to be printed.")
  49. (jv-check-file "~/maildir/risks"  "There are RISKs to be read.")
  50.  
  51. (defun jv-check-mail-file (user)
  52.   "Checks if there is a non-empty mailbox for USER. Inserts a message if so."
  53.   (let ((the-file (concat rmail-spool-directory user)))
  54.     (if (and
  55.      (file-exists-p the-file)
  56.      (> (nth 7 (file-attributes the-file)) 0))
  57.     (insert (concat "There is mail for " user ".\n")))))
  58.  
  59. ;; Check mine and other relevant mail files
  60. (mapcar 'jv-check-mail-file 
  61.     '("jv" "root" "system" "news" "mailer" "mems" "uucp"))
  62.  
  63. ;; Disk status on this system
  64. (insert "\nDisk Status:\n")
  65. (call-process "df" nil t nil)
  66.  
  67. ;; Disk status on the news archive.
  68. (insert "\nDisk Status on mh_eng:\n")
  69. (call-process "remsh" nil t nil "mh_eng" "df")
  70.  
  71. (insert "\n")
  72. (call-process "fortune" nil t nil)
  73.  
  74. ;; Wrap up
  75. (insert "\nStartup complete.\n")
  76. (goto-char (point-min))
  77. (set-buffer-modified-p nil)
  78.  
  79. ;;; End of StatUp.el
  80. ;-- 
  81. ;Johan Vromans                       jv@mh.nl via internet backbones
  82. ;Multihouse Automatisering bv               uucp: ..!{mcvax,hp4nl}!mh.nl!jv
  83. ;Doesburgweg 7, 2803 PL Gouda, The Netherlands  phone/fax: +31 1820 62944/62500
  84. ;------------------------ "Arms are made for hugging" -------------------------
  85.