From: Thien-Thi Nguyen Date: Sat, 1 Jun 2002 00:55:41 +0000 (+0000) Subject: (prolog-mode-syntax-table): Add flags to ?/ and ?* entries X-Git-Tag: ttn-vms-21-2-B4~14795 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f614a1aec27881c29816e0dead5ce52649bfa970;p=emacs.git (prolog-mode-syntax-table): Add flags to ?/ and ?* entries to support /* */ style comments. (prolog-font-lock-keywords): New var. (prolog-mode): Enable font-locking; set `font-lock-defaults'. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5eedf9c6e12..10499922703 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2002-06-01 Thien-Thi Nguyen + + * progmodes/prolog.el (prolog-mode-syntax-table): Add flags to + ?/ and ?* entries to support /* */ style comments. + (prolog-font-lock-keywords): New var. + (prolog-mode): Enable font-locking; set `font-lock-defaults'. + 2002-06-01 Kim F. Storm * simple.el (choose-completion-string-functions): New special hook. @@ -33,7 +40,7 @@ * menu-bar.el (menu-bar-showhide-fringe-menu): Use defvar. - * subr.el (open-network-stream, open-network-stream-nowait) + * subr.el (open-network-stream, open-network-stream-nowait) (open-network-stream-server, process-kill-without-query): Moved from simple.el. @@ -174,8 +181,8 @@ 2002-05-25 Miles Bader - * menu-bar.el (menu-bar-showhide-fringe-menu-customize-left) - (menu-bar-showhide-fringe-menu-customize-right) + * menu-bar.el (menu-bar-showhide-fringe-menu-customize-left) + (menu-bar-showhide-fringe-menu-customize-right) (menu-bar-showhide-fringe-menu-customize-disable): Use proper calling convention for `customize-set-value'. Require `fringe' before setting variable. @@ -2493,7 +2500,7 @@ prefix from scroll commands. Ignore end-of-buffer errors from other windows. (scroll-all-check-to-scroll): Remove `fkey-' prefix from scroll - commands. + commands. (scroll-all-beginning-of-buffer-all, scroll-all-end-of-buffer-all): New functions. diff --git a/lisp/progmodes/prolog.el b/lisp/progmodes/prolog.el index 593d3a8de31..6cb571b73e9 100644 --- a/lisp/progmodes/prolog.el +++ b/lisp/progmodes/prolog.el @@ -26,7 +26,7 @@ ;; This package provides a major mode for editing Prolog. It knows ;; about Prolog syntax and comments, and can send regions to an inferior -;; Prolog interpreter process. +;; Prolog interpreter process. Font locking is tuned towards GNU Prolog. ;;; Code: @@ -38,7 +38,7 @@ "Major mode for editing and running Prolog under Emacs" :group 'languages) - + (defcustom prolog-program-name "prolog" "*Program name for invoking an inferior Prolog with `run-prolog'." :type 'string @@ -65,13 +65,23 @@ nil means send actual operating system end of file." :type 'integer :group 'prolog) +(defvar prolog-font-lock-keywords + '(("\\(#[<=]=>\\|:-\\)\\|\\(#=\\)\\|\\(#[#<>\\/][=\\/]*\\|!\\)" + 0 font-lock-keyword-face) + ("\\<\\(is\\|write\\|nl\\|read_\\sw+\\)\\>" + 1 font-lock-keyword-face) + ("^\\(\\sw+\\)\\s-*\\((\\(.+\\))\\)*" + (1 font-lock-function-name-face) + (3 font-lock-variable-name-face))) + "Font-lock keywords for Prolog mode.") + (if prolog-mode-syntax-table () (let ((table (make-syntax-table))) (modify-syntax-entry ?_ "w" table) (modify-syntax-entry ?\\ "\\" table) - (modify-syntax-entry ?/ "." table) - (modify-syntax-entry ?* "." table) + (modify-syntax-entry ?/ ". 14" table) + (modify-syntax-entry ?* ". 23" table) (modify-syntax-entry ?+ "." table) (modify-syntax-entry ?- "." table) (modify-syntax-entry ?= "." table) @@ -129,6 +139,10 @@ if that value is non-nil." (setq major-mode 'prolog-mode) (setq mode-name "Prolog") (prolog-mode-variables) + ;; font lock + (setq font-lock-defaults '(prolog-font-lock-keywords + nil nil nil + beginning-of-line)) (run-hooks 'prolog-mode-hook)) (defun prolog-indent-line (&optional whole-exp)