home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Text / Emacs-1.12d folder / lisp / prolog.elc < prev    next >
Encoding:
Text File  |  1993-11-09  |  6.1 KB  |  102 lines  |  [dELC/EMAC]

  1.  
  2. (defvar prolog-mode-syntax-table nil)
  3.  
  4. (defvar prolog-mode-abbrev-table nil)
  5.  
  6. (defvar prolog-mode-map nil)
  7.  
  8. (defvar prolog-consult-string "reconsult(user).
  9. " "*(Re)Consult mode (for C-Prolog and Quintus Prolog). ")
  10.  
  11. (defvar prolog-compile-string "compile(user).
  12. " "*Compile mode (for Quintus Prolog).")
  13.  
  14. (defvar prolog-eof-string "end_of_file.
  15. " "*String that represents end of file for prolog.
  16. nil means send actual operaing system end of file.")
  17.  
  18. (defvar prolog-indent-width 4)
  19.  
  20. (if prolog-mode-syntax-table nil (let ((table (make-syntax-table))) (modify-syntax-entry 95 "w" table) (modify-syntax-entry 92 "\\" table) (modify-syntax-entry 47 "." table) (modify-syntax-entry 42 "." table) (modify-syntax-entry 43 "." table) (modify-syntax-entry 45 "." table) (modify-syntax-entry 61 "." table) (modify-syntax-entry 37 "<" table) (modify-syntax-entry 60 "." table) (modify-syntax-entry 62 "." table) (modify-syntax-entry 39 "\"" table) (setq prolog-mode-syntax-table table)))
  21.  
  22. (define-abbrev-table (quote prolog-mode-abbrev-table) nil)
  23.  
  24. (defun prolog-mode-variables nil (byte-code "Õ!à
  25. âàŒ√!àœ PâàŒ≈!à âàŒΔ!à«âàŒ»!à–âàŒ…!à—â    àŒ !à“â
  26. àŒÀ!à”â àŒÃ!à‘â á" [prolog-mode-syntax-table local-abbrev-table prolog-mode-abbrev-table paragraph-start page-delimiter paragraph-separate paragraph-ignore-fill-prefix t indent-line-function comment-start comment-start-skip comment-column comment-indent-hook set-syntax-table make-local-variable "^%%\\|^$\\|" prolog-indent-line "%" "%+ *" 48 prolog-comment-indent] 11))
  27.  
  28. (defun prolog-mode-commands (map) (byte-code "¡¬√#ࡃ≈#á" [map define-key "    " prolog-indent-line "" prolog-consult-region] 5))
  29.  
  30. (if prolog-mode-map nil (setq prolog-mode-map (make-sparse-keymap)) (prolog-mode-commands prolog-mode-map))
  31.  
  32. (defun prolog-mode nil "\
  33. Major mode for editing Prolog code for Prologs.
  34. Blank lines and `%%...' separate paragraphs.  `%'s start comments.
  35. Commands:
  36. \\{prolog-mode-map}
  37. Entry to this mode calls the value of prolog-mode-hook
  38. if that value is non-nil." (interactive) (byte-code "√àƒ à≈!àΔâà«âà» à… !á" [prolog-mode-map major-mode mode-name nil kill-all-local-variables use-local-map prolog-mode "Prolog" prolog-mode-variables run-hooks prolog-mode-hook] 5))
  39.  
  40. (defun prolog-indent-line (&optional whole-exp) "\
  41. Indent current line as Prolog code.
  42. With argument, indent any additional lines of the same clause
  43. rigidly along with this one (not yet)." (interactive "p") (byte-code "√àƒ d`Z√≈ à`âàΔ«!à»iZ!É\"√Ç)…
  44. `\"àjàd    Z`VÖ6d    Zb+á" [indent pos beg nil prolog-indent-level beginning-of-line skip-chars-forward "     " zerop delete-region] 7))
  45.  
  46. (defun prolog-indent-level nil "\
  47. Compute prolog indentation level." (byte-code "ä… à À!àÃÕ!ɌǀÜ!ÉÇ€oÉ$ŒÇ€¡ΔΔΔÖ!É8¡âÇ;Δâà
  48. Öi—“!à… àoÉQΔâÇe À!àÜ!Ü^Ô!?ÖeΔâàÇ<àoÉtŒâÇwiâàÑ!ÉÇ Ç⁄Ã’!Éé¡âÇëΔâà÷ àoÜú◊“!àÃÿ!ɪ ֙ß!É¥ \\Ç∏ ]Ç⁄Ã⁄!ÉΔÇ⁄
  49. ÜÕÀ!ÉŸ ZŒ]Ç⁄Œ,)á" [comment-column t empty ind more less nil prolog-indent-width tab-width beginning-of-line skip-chars-forward "     " looking-at "%%%" 0 "%[^%]" ")" forward-line -1 "
  50. " "%%[^%]" "(" end-of-prolog-clause forward-char "[,(;>]" "[^,]" "-" "[^.]"] 20))
  51.  
  52. (defun end-of-prolog-clause nil "\
  53. Go to end of clause in this line." (byte-code "¬√!à䃠à`)≈    Δ#Ö«»!bà… !)á" [eolpos comment-start-skip beginning-of-line 1 end-of-line re-search-forward move match-beginning 0 skip-chars-backward "     "] 6))
  54.  
  55. (defun prolog-comment-indent nil "\
  56. Compute prolog comment indentation." (byte-code "¬√!É
  57. ƒÇ¬≈!ÉΔ Çä«»!àiT    ])á" [t comment-column looking-at "%%%" 0 "%%" prolog-indent-level skip-chars-backward "     "] 6))
  58.  
  59. (defvar inferior-prolog-mode-map nil)
  60.  
  61. (defun inferior-prolog-mode nil "\
  62. Major mode for interacting with an inferior Prolog process.
  63.  
  64. The following commands are available:
  65. \\{inferior-prolog-mode-map}
  66.  
  67. Entry to this mode calls the value of prolog-mode-hook with no arguments,
  68. if that value is non-nil.  Likewise with the value of shell-mode-hook.
  69. prolog-mode-hook is called after shell-mode-hook.
  70.  
  71. You can send text to the inferior Prolog from other buffers
  72. using the commands send-region, send-string and \\[prolog-consult-region].
  73.  
  74. Commands:
  75. Tab indents for Prolog; with argument, shifts rest
  76.  of expression rigidly with the current line.
  77. Paragraphs are separated only by blank lines and '%%'. '%'s start comments.
  78.  
  79. Return at end of buffer sends line as input.
  80. Return not at end copies rest of line to end and sends it.
  81. \\[shell-send-eof] sends end-of-file as input.
  82. \\[kill-shell-input] and \\[backward-kill-word] are kill commands, imitating normal Unix input editing.
  83. \\[interrupt-shell-subjob] interrupts the shell or its current subjob if any.
  84. \\[stop-shell-subjob] stops, likewise. \\[quit-shell-subjob] sends quit signal, likewise." (interactive) (byte-code "ƒà… à âàÀâàÃâàÕ àŒœ!à É ƒÇ)–
  85. !âà— !à“ !à”Δ!à‘ âà”«!à‘ âà’»!à÷âà◊ÿŸ\"á" [major-mode mode-name mode-line-process inferior-prolog-mode-map nil shell-mode-map last-input-start last-input-end shell-prompt-pattern kill-all-local-variables inferior-prolog-mode "Inferior Prolog" (": %s") prolog-mode-variables require shell copy-alist prolog-mode-commands use-local-map make-local-variable make-marker make-variable-buffer-local "^| [ ?][- ] *" run-hooks shell-mode-hook prolog-mode-hook] 14))
  86.  
  87. (defun run-prolog nil "\
  88. Run an inferior Prolog process, input and output via buffer *prolog*." (interactive) (byte-code "¿à¡¬!à√ƒ≈≈\"!àΔ á" [nil require shell switch-to-buffer make-shell "prolog" inferior-prolog-mode] 5))
  89.  
  90. (defun prolog-consult-region (compile beg end) "\
  91. Send the region to the Prolog process made by M-x run-prolog.
  92.  If COMPILE (prefix arg) is not nil,
  93.  use compile mode rather than consult mode." (interactive "P
  94. r") (byte-code "ΔàäÉ«»    \"Ç«»
  95. \"à…» #à«» \"à
  96. É)«»
  97. \"Ç,À»!)á" [compile prolog-compile-string prolog-consult-string beg end prolog-eof-string nil send-string "prolog" send-region "
  98. " process-send-eof] 7))
  99.  
  100. (defun prolog-consult-region-and-go (compile beg end) "\
  101. Send the region to the inferior Prolog, and switch to *prolog* buffer.
  102.  If COMPILE (prefix arg) is not nil,
  103.  use compile mode rather than consult mode." (interactive "P
  104. r") (byte-code "√àƒ    
  105. #à≈Δ!á" [compile beg end nil prolog-consult-region switch-to-buffer "*prolog*"] 4))
  106.