home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / languages / elisp / modes / miranda.el < prev    next >
Encoding:
Text File  |  1990-07-22  |  3.2 KB  |  99 lines

  1. ;From ark1!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!tut.cis.ohio-state.edu!CS.UCL.AC.UK!S.Clayman Fri Mar  9 14:47:40 1990
  2. ;Article 1298 of gnu.emacs:
  3. ;Path: ark1!uakari.primate.wisc.edu!zaphod.mps.ohio-state.edu!usc!cs.utexas.edu!tut.cis.ohio-state.edu!CS.UCL.AC.UK!S.Clayman
  4. ;From S.Clayman@CS.UCL.AC.UK (Stuart Clayman)
  5. ;Newsgroups: gnu.emacs
  6. ;Subject: miranda mode for gnu
  7. ;Message-ID: <9003091849.AA17491@aeneas.MIT.EDU>
  8. ;Date: 9 Mar 90 18:40:40 GMT
  9. ;Sender: daemon@tut.cis.ohio-state.edu
  10. ;Distribution: gnu
  11. ;Organization: GNUs Not Usenet
  12. ;Lines: 83
  13. ;
  14. ;i've sent this to 2 news groups so some info may be obvious
  15. ;to a lot of you
  16. ;
  17. ;
  18. ;Here is a bit of elisp which defines a miranda mode, in the style
  19. ;of lisp mode. That is with Miranda running as a sub-process of gnu.
  20. ;
  21. ;This mode has saved me hours in time (and patience) not waiting
  22. ;for a new editor to start every time I want to edit a bug.
  23. ;I know Miranda v2 sort of overcomes this but.....
  24. ;
  25. ;Anyway, type ESC \C-x at a miranda program and off it goes,
  26. ;it automatically sets the right directory and file
  27. ;name for the current script.
  28. ;
  29. ;In the window that has Miranda running, you can go back up the
  30. ;buffer and re-enter lines without having to type them in again,
  31. ;you can edit existing lines, hit RETURN and the new expression
  32. ;will be evaluated.
  33. ;
  34. ;This code can be modified by anyone (please send me changes),
  35. ;added to archives, or put in the real GNU release.
  36. ;
  37. ;------------------------------mira.el------------------------------
  38. ;;; Miranda mode for GNU Emacs
  39. ;;;
  40. ;;; Last update: 9/3/90
  41. ;;;
  42. ;;; Author: Stuart Clayman,
  43. ;;;        Dept. Computer Science,
  44. ;;;        University College London
  45. ;;;
  46. ;;; Email: sclayman@uk.ac.ucl.cs
  47.  
  48. (require 'shell)
  49.  
  50. (defun run-mira()
  51.   "Run an inferior Miranda process."
  52.   (interactive)
  53.   (switch-to-buffer (make-shell "mira" "mira"))
  54.   (make-local-variable 'shell-prompt-pattern)
  55.   (setq shell-prompt-pattern "Miranda \\|^"))
  56.  
  57. (defun save-mira-buffer-and-go()
  58.   "Save current Miranda file buffer.
  59. Goto inferior Miranda buffer and load file."
  60.   (interactive)
  61.   (save-buffer)
  62.   (if (null (get-buffer "*mira*"))    ; if mira not running
  63.       (save-excursion (run-mira)))    ; run it
  64.   (send-string "mira" (concat "/cd " default-directory "\n"))
  65.   (send-string "mira" (concat "/f " (buffer-name) "\n"))
  66.   (switch-to-buffer-other-window "*mira*"))
  67.  
  68.  
  69. (defun mira-mode()
  70.   "Miranda mode."
  71.   (interactive)
  72.   (setq mode-name "Miranda")
  73.   (make-local-variable indent-line-function)
  74.   (setq indent-line-function 'indent-relative)
  75.   (local-set-key "\e\C-x" 'save-mira-buffer-and-go)
  76.   (local-set-key "\eg" 'goto-line))
  77.  
  78.  
  79. ;------------------------------END------------------------------
  80. ;
  81. ;The next few lines should go in your .emacs
  82. ;
  83. ;-------------------- .emacs addditons -------------------------
  84.  
  85. (autoload 'mira-mode "mira" "Go into mira mode" t)
  86. (autoload 'run-mira "mira" "Run Miranda as inferior process" t)
  87.  
  88. (set-variable 'auto-mode-alist
  89.       (append '(("\\.m$" . mira-mode))  ;; miranda source
  90.           auto-mode-alist))
  91.  
  92. (set-variable 'completion-ignored-extensions
  93.       (append '(".x")            ;; miranda byte compiled
  94.           completion-ignored-extensions))
  95.  
  96. ;------------------------------ END ------------------------------
  97.  
  98.  
  99.