prolog.elc 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. (defvar prolog-mode-syntax-table nil)
  2. (defvar prolog-mode-abbrev-table nil)
  3. (defvar prolog-mode-map nil)
  4. (defvar prolog-consult-string "reconsult(user).
  5. " "*(Re)Consult mode (for C-Prolog and Quintus Prolog). ")
  6. (defvar prolog-compile-string "compile(user).
  7. " "*Compile mode (for Quintus Prolog).")
  8. (defvar prolog-eof-string "end_of_file.
  9. " "*String that represents end of file for prolog.
  10. nil means send actual operaing system end of file.")
  11. (defvar prolog-indent-width 4)
  12. (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)))
  13. (define-abbrev-table (quote prolog-mode-abbrev-table) nil)
  14. (defun prolog-mode-variables nil (byte-code "Ë!ˆ
  15. ‰ˆÌÃ!ˆÍ P‰ˆÌÅ!ˆ ‰ˆÌÆ!ˆÎ‰ˆÌÇ!ˆÏ‰ˆÌÈ!ˆÐ‰ˆÌÉ!ˆÑ‰ ˆÌÊ!ˆÒ‰
  16. ‡" [prolog-mode-syntax-table local-abbrev-table prolog-mode-abbrev-table paragraph-start page-delimiter paragraph-separate 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] 10))
  17. (defun prolog-mode-commands (map) (byte-code "ÁÂÃ#ˆÁÄÅ#‡" [map define-key " " prolog-indent-line "" prolog-consult-region] 5))
  18. (if prolog-mode-map nil (setq prolog-mode-map (make-sparse-keymap)) (prolog-mode-commands prolog-mode-map))
  19. (defun prolog-mode nil "\
  20. Major mode for editing Prolog code for Prologs.
  21. Blank lines and `%%...' separate paragraphs. `%'s start comments.
  22. Commands:
  23. \\{prolog-mode-map}
  24. Entry to this mode calls the value of prolog-mode-hook
  25. 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))
  26. (defun prolog-indent-line (&optional whole-exp) "\
  27. Indent current line as Prolog code.
  28. With argument, indent any additional lines of the same clause
  29. rigidly along with this one (not yet)." (interactive "p") (byte-code "ÃˆÄ d`ZÃÅ ˆ`‰ˆÆÇ!ˆÈiZ!ƒ\"Â)É
  30. `\"ˆjˆd Z`V…6d Zb+‡" [indent pos beg nil prolog-indent-level beginning-of-line skip-chars-forward " " zerop delete-region] 7))
  31. (defun prolog-indent-level nil "\
  32. Compute prolog indentation level." (byte-code "ŠÉ ˆÊË!ˆÌÍ!ƒ΂ÏÌÏ!ƒ‚Ïoƒ$΂ÏÁÆÆÆÌÐ!ƒ8Á‰‚;Ɖˆ
  33. …gÑÒ!ˆÉ ˆo…NƉˆÊË!ˆÌÏ!†\\ÌÓ!?…cƉˆ‚<ˆi‰ˆÌÔ!ƒv ‚ÎÌÕ!ƒ‚Á‰‚…ƉˆÖ ˆo†�×Ò!ˆÌØ!ƒ¯ …žÌÙ!ƒ¨ \\‚¬ ]‚ÎÌÚ!ƒº‚Î †ÁÌÛ!ƒÍ 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 "
  34. " "%%[^%]" "(" end-of-prolog-clause forward-char "[,(;>]" "[^,]" "-" "[^.]"] 20))
  35. (defun end-of-prolog-clause nil "\
  36. 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))
  37. (defun prolog-comment-indent nil "\
  38. Compute prolog comment indentation." (byte-code "ÂÃ!ƒ
  39. Ä‚ÂÅ!ƒÆ ‚ŠÇÈ!ˆiT ])‡" [t comment-column looking-at "%%%" 0 "%%" prolog-indent-level skip-chars-backward " "] 6))
  40. (defvar inferior-prolog-mode-map nil)
  41. (defun inferior-prolog-mode nil "\
  42. Major mode for interacting with an inferior Prolog process.
  43. The following commands are available:
  44. \\{inferior-prolog-mode-map}
  45. Entry to this mode calls the value of prolog-mode-hook with no arguments,
  46. if that value is non-nil. Likewise with the value of shell-mode-hook.
  47. prolog-mode-hook is called after shell-mode-hook.
  48. You can send text to the inferior Prolog from other buffers
  49. using the commands send-region, send-string and \\[prolog-consult-region].
  50. Commands:
  51. Tab indents for Prolog; with argument, shifts rest
  52. of expression rigidly with the current line.
  53. Paragraphs are separated only by blank lines and '%%'. '%'s start comments.
  54. Return at end of buffer sends line as input.
  55. Return not at end copies rest of line to end and sends it.
  56. \\[shell-send-eof] sends end-of-file as input.
  57. \\[kill-shell-input] and \\[backward-kill-word] are kill commands, imitating normal Unix input editing.
  58. \\[interrupt-shell-subjob] interrupts the shell or its current subjob if any.
  59. \\[stop-shell-subjob] stops, likewise. \\[quit-shell-subjob] sends quit signal, likewise." (interactive) (byte-code "ÄˆÉ ˆÊ‰ˆË‰ˆÌ‰ˆÍ ˆÎÏ!ˆ ƒ Ä‚)Ð !‰ˆÑ !ˆÒ !ˆÓÆ!ˆÔ ‰ˆÓÇ!ˆÔ ‰ˆÕÈ!ˆÖ‰ˆ×ØÙ\"‡" [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))
  60. (defun run-prolog nil "\
  61. 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))
  62. (defun prolog-consult-region (compile beg end) "\
  63. Send the region to the Prolog process made by M-x run-prolog.
  64. If COMPILE (prefix arg) is not nil,
  65. use compile mode rather than consult mode." (interactive "P
  66. r") (byte-code "ƈŠƒÇÈ \"‚ÇÈ
  67. \"ˆÉÈ #ˆÇÈÊ\"ˆ ƒ)ÇÈ \"‚,ËÈ!)‡" [compile prolog-compile-string prolog-consult-string beg end prolog-eof-string nil send-string "prolog" send-region "
  68. " process-send-eof] 7))
  69. (defun prolog-consult-region-and-go (compile beg end) "\
  70. Send the region to the inferior Prolog, and switch to *prolog* buffer.
  71. If COMPILE (prefix arg) is not nil,
  72. use compile mode rather than consult mode." (interactive "P
  73. r") (byte-code "ÈÄ
  74. #ˆÅÆ!‡" [compile beg end nil prolog-consult-region switch-to-buffer "*prolog*"] 4))