casl-mode.el revision f4152ab9d084afebd592edfcde4bf5a0d8556edd
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;;;###autoload
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang(autoload 'turn-on-casl-indent "casl-indent" "Turn on CASL indentation." t)
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; Version number
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang "Version of CASL-Mode")
3e4305eb6432c65bb0dfe8d9af9707dfc92383eaChristian Maeder "Major mode for editing (heterogeneous) CASL programs."
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; casl major mode setup
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang(defvar casl-mode-map (let ((keymap (make-keymap)))
67d5e49547d78aa56a8f9ba5e64a950b730eba66Till Mossakowski (define-key keymap "\C-c\C-g" 'casl-run-hetsg)
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang (define-key keymap "\C-c\C-n" 'casl-compile-goto-next-error)
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang "Keymap for CASL major mode")
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; Are we running FSF Emacs or XEmacs?
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang "non-nil if we are running XEmacs, nil otherwise.")
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; ============= K E Y W O R D H I G H L I G H T I N G ============
806bce66335c88260a63e7524b1efc68d8dfacc1Heng Jiang(defvar casl-black-komma-face 'casl-black-komma-face
806bce66335c88260a63e7524b1efc68d8dfacc1Heng Jiang "Face name to use for black komma.")
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang(defvar casl-annotation-face 'casl-annotation-face
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang "CASL mode face for Annotations")
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang(setq casl-annotation-face 'font-lock-constant-face)
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang(defvar casl-library-name-face 'casl-library-name-face)
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang(setq casl-library-name-face 'font-lock-type-face)
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang(setq casl-name-face 'font-lock-variable-name-face)
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang(defvar casl-other-name-face 'casl-other-name-face)
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang(setq casl-other-name-face 'font-lock-function-name-face)
806bce66335c88260a63e7524b1efc68d8dfacc1Heng Jiang(defvar casl-string-char-face 'casl-string-char-face)
806bce66335c88260a63e7524b1efc68d8dfacc1Heng Jiang(setq casl-string-char-face 'font-lock-string-face)
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; Syntax highlighting of CASL
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; Keywords of loading Library
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang '("\\(\\<\\|\\s-+\\)\\(logic\\|from\\|get\\|library\\|version\\)[ :\t\n]+"
806bce66335c88260a63e7524b1efc68d8dfacc1Heng Jiang;; '("\\(\\<\\|\\s-+\\)\\(%authors\\|%date\\|%display\\|%prec\\|%left_assoc\\|%number\\|%floating\\|%LATEX\\|%implies\\)[ :\t\n]+"
806bce66335c88260a63e7524b1efc68d8dfacc1Heng Jiang;; (2 casl-annotation-face keep t))
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; Library and Logic name
806bce66335c88260a63e7524b1efc68d8dfacc1Heng Jiang '("\\(\\<\\|\\s-+\\)\\(library\\|logic\\)\\s-+\\(\\(\\w\\|/\\)+\\)[ \t\n]*"
c10df434f8e16b46ccf703bf2e38b799f7bcb38bHeng Jiang ;; name of from, get and given
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang '("\\(\\<\\|[ \t]+\\)\\(get\\|given\\)[ \t\n]+\\(\\(\\sw+\\s-*\\(,\\|$\\)[ \t\n]*\\)+\\)"
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang '("\\(\\<\\|\\s-+\\)from\\([ \t]+\\)\\(.+\\)\\(get\\|\\s-*\\)"
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; the name of specification and view
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang '("\\(\\<\\|\\[\\)\\(spec\\|view\\)\\s-+\\(\\w+\\)[ \t]*\\(\\[\\([A-Z]\\w*\\).*\\]\\)?\\s-*.*\\([]=:]\\|::=\\)"
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang (3 casl-name-face keep t) (5 casl-name-face keep t))
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; then, and + name
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang '("\\(\\<\\|\\s-+\\)\\(and\\|then\\)[ \t\n]*\\([A-Z]\\w*\\)\\s-*\\(\\[\\([A-Z]\\w*\\).*\\]\\)?"
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang (3 casl-name-face keep t) (5 casl-name-face keep t))
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; names before and after to
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang '("[ \t\n]*\\(\\w+\\)[ \t\n]+to[ \t\n]+\\(\\(\\w+\\)\\s-*\\(\\[\\([A-Z]\\w*\\).*\\]\\)?[, \t]*\\)?"
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang (1 casl-name-face keep t) (3 casl-name-face keep t) (5 casl-name-face keep t))
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; instance name of specification
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang '("\\<spec.+=\\s-*\\(%\\sw+\\s-*\\)?[ \t\n]*\\([A-Z]\\sw*\\)\\s-*\\(\\[\\([A-Z]\\w*\\).*\\]\\)?"
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang (2 casl-name-face keep t) (4 casl-name-face keep t))
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; Basic signature: sort X, Y, Z
c10df434f8e16b46ccf703bf2e38b799f7bcb38bHeng Jiang '("\\(\\<\\|\\s-+\\)sorts?[ \t]+\\(\\(\\sw+\\s-*\\(\\[\\(\\sw\\|,\\)+\\]\\s-*\\)?\\(,\\(\\s-\\)*\\|$\\|<\\|;\\|=\\)\\(\\sw\\|=\\|<\\|;\\|,\\)*[ \t\n]*\\)+\\)"
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; Basic signature: op ,pred and var name
b0905caf30330ed73d5363e67c9f1f4576737ee1Heng Jiang '("\\(^\\|\\bops?\\|\\bpreds?\\|\\bvars?\\)\\s-+\\([^.]\\(,\\s-*\\)?\\(\\sw\\(,\\s-*\\)?\\|\\(\\s_\\|\\s_+::?\\s_+\\)\\(,\\s-*\\)?\\|\\s(\\|\\s)\\)*\\)\\s-*\\(\(.*\)\\)?\\s-*\\(:\\??\\|<=>\\)[^:\n]*;?[ \t]*$"
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; type name
6c8dc7ab7cb52a12cba748fe0f6b8d8d17a95eb9Heng Jiang '("\\s-+\\(\\sw+\\)[ \t\n]*::?=\\s-*\\(\\sw*\\).*"
6c8dc7ab7cb52a12cba748fe0f6b8d8d17a95eb9Heng Jiang (1 casl-other-name-face keep t) (2 casl-other-name-face keep t) )
0b31ea5ec0e20f17d55845a5d803c48466e01ca3Heng Jiang ;; constructor
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang '("\\(\\sw+\\)?\\s-*|\\s-*\\(\\sw+\\)\\s-*[|(]?\\([ \t\n]*\\|$\\)"
6c8dc7ab7cb52a12cba748fe0f6b8d8d17a95eb9Heng Jiang (1 casl-other-name-face keep t) (2 casl-other-name-face keep t))
0b31ea5ec0e20f17d55845a5d803c48466e01ca3Heng Jiang '("\(\\(\\(\\sw\\|,\\)*\\)\\s-*:\\??[^)]*\)"
0b31ea5ec0e20f17d55845a5d803c48466e01ca3Heng Jiang '("\([^;]*;\\s-*\\(\\sw+\\)\\s-*:\\??.*\)"
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; names before and after '|->'
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang '("[ \t\n]*\\([^[ \t\n]+\\)\\s-*\\(\\[\\([A-Z]\\w*\\).*\\]\\)?[ \t\n]+|->[ \t\n]+\\([^[ \t\n]+\\)\\s-*\\(\\[\\([A-Z]\\w*\\).*\\]\\)?[, \t]*"
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang (1 casl-other-name-face keep t) (3 casl-other-name-face keep t)
31ac08a9e5233b83a63fd5aaac494c32305c4c77Heng Jiang (4 casl-other-name-face keep t) (6 casl-other-name-face keep t))
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; reserved keyword
3e4305eb6432c65bb0dfe8d9af9707dfc92383eaChristian Maeder '("\\(\\<\\|\\s-+\\)\\(/\\\\\\|\\\\/\\|=>\\|<=>\\|and\\|arch\\|assoc\\|behaviourally\\|closed\\|comm\\|else\\|end\\|exists\\|fit\\|forall\\|free\\|generated\\|given\\|hide\\|idem\\|if\\|local\\|not\\|refined\\|refinement\\|reveal\\|spec\\|then\\|to\\|unit\\|via\\|view\\|when\\|within\\|with\\|\\(\\(op\\|pred\\|var\\|type\\|sort\\)s?\\)\\)[,;]?[ \t\n]"
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang "Reserved keywords highlighting")
0b31ea5ec0e20f17d55845a5d803c48466e01ca3Heng Jiang;; String and Char
0b31ea5ec0e20f17d55845a5d803c48466e01ca3Heng Jiang (list '("\\(\\(\"\\|^>[ \t]*\\\\\\)\\([^\"\\\\\n]\\|\\\\.\\)*\\(\"\\|\\\\[ \t]*$\\)\\|'\\([^'\\\\\n]\\|\\\\.[^'\n]*\\)'\\)" (0 casl-string-char-face t t))
0b31ea5ec0e20f17d55845a5d803c48466e01ca3Heng Jiang "Syntax highlighting of String and Char")
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; Alternativ for Annotation
31ac08a9e5233b83a63fd5aaac494c32305c4c77Heng Jiang ;; %word(...)\n
31ac08a9e5233b83a63fd5aaac494c32305c4c77Heng Jiang '("%\\sw+\([^%\n]+\)$" (0 casl-annotation-face t t))
806bce66335c88260a63e7524b1efc68d8dfacc1Heng Jiang ;; %words \n
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; %( ... )%
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang '("%\([^)%]*\)%[ \t\n]*" (0 casl-annotation-face t t))
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; %word( ... )%
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang '("%\\sw+\([^)%]*\)%[ \t\n]*" (0 casl-annotation-face t t))
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang "Annotation")
6c8dc7ab7cb52a12cba748fe0f6b8d8d17a95eb9Heng Jiang '("\\(%{[^}%]*}%\\)[ \t\n]*" (1 casl-comment-face t t))
6c8dc7ab7cb52a12cba748fe0f6b8d8d17a95eb9Heng Jiang "Special Comment")
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; Define default highlighting level
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; (defvar casl-font-lock-syntax-highligthing casl-font-lock-keywords
6c8dc7ab7cb52a12cba748fe0f6b8d8d17a95eb9Heng Jiang(defvar casl-font-lock-syntax-highligthing casl-font-lock-specialcomment
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang "Default syntax highlighting level in CASL mode")
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; ====================== S Y N T A X T A B L E ==================
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; Syntax table for CASL major mode
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang "Syntax table for CASL mode.")
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; Indicate that underscore may be part of a word
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; commenting-out plus including other kinds of comment
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; Some of these are actually OK by default.
6c8dc7ab7cb52a12cba748fe0f6b8d8d17a95eb9Heng Jiang "!#$&*+.,/\\\\:<=>?@^|~")
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; Various mode variables.
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang (setq comment-indent-function 'casl-comment-indent)
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; Find the indentation level for a comment.
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; if the line is blank, put the comment at the beginning,
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; else at comment-column
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang (if (bolp) 0 (max (1+ (current-column)) comment-column)))
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; ======================= R U N H E T S =======================
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang "Run hets process to compile the current CASL file."
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang (setq hets-command (concat casl-hets-program " " casl-hets-file-name))
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; Pop up the compilation buffer.
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; (display-buffer outbuf nil t)
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; (set-buffer outbuf)
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; Start the compilation.
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; Set the EMACS variable, but
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; don't override users' setting of $EMACS.
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang (proc (start-process-shell-command "hets-compile" outbuf
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang (set-process-sentinel proc 'casl-compilation-sentinel)
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang (set-process-filter proc 'casl-compilation-filter)
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang "Run hets process with -g to compile the current CASL file."
67d5e49547d78aa56a8f9ba5e64a950b730eba66Till Mossakowski (let* ((casl-hets-file-name (buffer-file-name))
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang (setq hets-command (concat casl-hets-program " -g " casl-hets-file-name))
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; Pop up the compilation buffer.
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; (display-buffer outbuf nil t)
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; Start the compilation.
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; Set the EMACS variable, but
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; don't override users' setting of $EMACS.
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang (proc (start-process-shell-command "hets-compile" outbuf
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang (set-process-sentinel proc 'casl-compilation-sentinel)
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang (set-process-filter proc 'casl-compilation-filter)
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang;; sentinel and filter of asynchronous process of hets
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang;; Called when compilation process changes state.
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang "Sentinel for compilation buffers."
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; buffer killed
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; save-excursion isn't the right thing if
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; process-buffer is current-buffer
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; Write something in the compilation buffer
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; and hack its mode line.
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang (casl-compilation-handle-exit (process-status proc)
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; Since the buffer and mode line will show that the
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; process is dead, we can delete it now. Otherwise it
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; will stay around until M-x list-processes.
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; (setq compilation-in-progress (delq proc compilation-in-progress))
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang;; show the message from hets compile direct on *hets-run* buffer
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; Insert the text, advancing the process marker.
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang(defun casl-compilation-handle-exit (process-status exit-status msg)
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang "Write msg in the current buffer and hack its mode-line-process."
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; Record where we put the message, so we can ignore it
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; later on.
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; (goto-char omax)
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang (insert " at " (substring (current-time-string) 0 19))
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang (setq mode-line-process (format ":%s [%s]" process-status (cdr status)))
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; Force mode line redisplay soon.
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; Automatically parse (and mouse-highlight) error messages:
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang (message "%s errors have been found." (length casl-error-list)))
b91c4dbd00294ce29ab1ae84ad4e8c93ca5ad943Heng Jiang;; also functions with old hets-program?
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang "Error Parser"
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;;;(pop-to-buffer compiler-buffer)
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang (if (not (or (looking-at "Fail") (looking-at "\\*\\*\\*")))
b3c65285705f6d184b5f8b00b1a328d96b6b19c5Heng Jiang (if (not (search-forward ":" (save-excursion (end-of-line) (point)) t 1))
b91c4dbd00294ce29ab1ae84ad4e8c93ca5ad943Heng Jiang (re-search-backward "\\(\(\\|\\s-+\\)\\([^.]+\\.\\(casl\\|het\\)\\)" nil t 1)
b91c4dbd00294ce29ab1ae84ad4e8c93ca5ad943Heng Jiang (re-search-forward ":\\([0-9]+\\)\\.\\([0-9]+\\)[:,]" (save-excursion (end-of-line) (point)) t 1)
b3c65285705f6d184b5f8b00b1a328d96b6b19c5Heng Jiang (when (not (string= (match-string-no-properties 0) ""))
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang (setq error-colnum (match-string-no-properties 2))
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang (nconc casl-error-list (list (list file-name error-line error-colnum error-window-point))))
b91c4dbd00294ce29ab1ae84ad4e8c93ca5ad943Heng Jiang "search the next error position from error-list, and move to it."
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; if error-list is empty ...
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang (if (member (get-buffer "*hets-run*") (buffer-list))
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang (message "this file have not yet been compiled."))
b91c4dbd00294ce29ab1ae84ad4e8c93ca5ad943Heng Jiang ;; (message "DEBUG<Goto Error>: file: %s, line: %s, column: %s" error-file-name error-line error-column)
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; if the file already opened ...
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang (pop-to-buffer (get-file-buffer error-file-name))
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; switch to hets-run window to jump to next error message
44ea7e3effe9200ccc6abd3231ae56cf5cfb0fb8Heng Jiang ;; return to current file
c51b5677113ce7260c44afb3c5932eea6c875e27Heng Jiang (move-to-column (- (string-to-number error-column) 1))
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang (message "goto next error... line: %s column: %s" error-line error-column)
b3c65285705f6d184b5f8b00b1a328d96b6b19c5Heng Jiang (setq casl-error-list (nconc casl-error-list (list this-error)))
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; ================= C A S L M A J O R M O D E ===============
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; Definition of CASL major mode
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang "Major mode for editing CASL models"
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; Load keymap
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; Load syntax table
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; (casl-create-syntax-table)
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; Highlight CASL keywords
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; Support for compile.el
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; We just substitute our own functions to go to the error.
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang (set (make-local-variable 'compile-auto-highlight) 40)
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang ;; FIXME: This has global impact! -stef
95242ab07e9aa13b37c16cac36a75d190e1766e4Heng Jiang;; CASL-mode ends here