home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / functions / vip-default.el < prev    next >
Encoding:
Text File  |  1991-06-03  |  1.3 KB  |  41 lines

  1. ; Path: dg-rtp!rock.concert.net!mcnc!gatech!ncar!elroy.jpl.nasa.gov!swrinde!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!tut.cis.ohio-state.edu!unreplyable!garbage
  2. ; From: djm@ENG.UMD.EDU (David J. MacKenzie)
  3. ; Newsgroups: gnu.emacs.sources
  4. ; Subject: running emacs as vip
  5. ; Date: 30 May 91 12:38:36 GMT
  6. ; Organization: Source only  Discussion and requests in gnu.emacs.help.
  7. ; I decided to see what would be necessary to make emacs run as a vi
  8. ; emulator from the command line, so I could type
  9. ; bash$ vip file1 file2.c file3
  10. ; Here's what I came up with.
  11. ; In .bashrc:
  12. ; alias vip='emacs -f vip-default'
  13. ; In .emacs:
  14. ;;; Use text mode by default instead of fundamental mode.
  15. (setq default-major-mode 'text-mode)
  16.  
  17. (defvar vip-mode-default nil
  18.   "*If non-nil, text mode buffers start up in vip-mode.")
  19. (defun vip-default (&optional arg)
  20.   "Toggle making vip-mode a default minor mode for text-mode.
  21. With arg, turn it on iff arg is positive."
  22.   (interactive "P")  (setq vip-mode-default
  23.     (if arg
  24.         (> (prefix-numeric-value arg) 0)
  25.       (not vip-mode-default))))
  26.  
  27. ;;; Set auto-fill minor mode in all text modes.
  28. (setq text-mode-hook
  29.       '(lambda ()
  30.      (auto-fill-mode 1)
  31.      (if vip-mode-default (vip-mode))))
  32. (setq c-mode-hook
  33.       '(lambda ()
  34.      (if vip-mode-default (vip-mode))))
  35. (setq lisp-mode-hook
  36.       '(lambda ()
  37.      (if vip-mode-default (vip-mode))))
  38.