From 7fce54c3b09700595e14f0d5b35f1103cb9086de Mon Sep 17 00:00:00 2001 Message-Id: <7fce54c3b09700595e14f0d5b35f1103cb9086de.1717835240.git.mdw@distorted.org.uk> From: Mark Wooding Date: Tue, 2 Apr 2013 02:47:48 +0100 Subject: [PATCH] dot/emacs, el/dot-emacs.el: Support for Algol 68 code. Organization: Straylight/Edgeware From: Mark Wooding --- dot/emacs | 5 ++++- el/dot-emacs.el | 44 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/dot/emacs b/dot/emacs index f207a0a..920b370 100644 --- a/dot/emacs +++ b/dot/emacs @@ -579,7 +579,8 @@ python-mode-hook pyrec-mode-hook icon-mode-hook awk-mode-hook tcl-mode-hook go-mode-hook js-mode-hook javascript-mode-hook conf-mode-hook m4-mode-hook autoconf-mode-hook autotest-mode-hook - asm-mode-hook TeX-mode-hook LaTeX-mode-hook + a68-mode-hook a68-mode-hooks asm-mode-hook + TeX-mode-hook LaTeX-mode-hook TeXinfo-mode-hook tex-mode-hook latex-mode-hook texinfo-mode-hook emacs-lisp-mode-hook scheme-mode-hook lisp-mode-hook lisp-interaction-mode-hook makefile-mode-hook @@ -716,6 +717,8 @@ (add-hook 'smalltalk-mode-hook 'mdw-fontify-smalltalk t) (add-hook 'smalltalk-mode-hook 'mdw-setup-smalltalk t) +(add-hook 'a68-mode-hook 'mdw-fontify-algol-68 t) +(add-hook 'a68-mode-hooks 'mdw-fontify-algol-68 t) (add-hook 'dylan-mode-hook 'mdw-fontify-dylan t) (progn diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 4f9bd59..d594b17 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -1968,6 +1968,50 @@ (defun mdw-fontify-dylan () (mdw-post-config-mode-hack)) +;;;-------------------------------------------------------------------------- +;;; Algol 68 configuration. + +(setq a68-indent-step 2) + +(defun mdw-fontify-algol-68 () + + ;; Fix up the syntax table. + (modify-syntax-entry ?# "!" a68-mode-syntax-table) + (dolist (ch '(?- ?+ ?= ?< ?> ?* ?/ ?| ?&)) + (modify-syntax-entry ch "." a68-mode-syntax-table)) + + (make-local-variable 'font-lock-keywords) + + (let ((not-comment + (let ((word "COMMENT")) + (do ((regexp (concat "[^" (substring word 0 1) "]+") + (concat regexp "\\|" + (substring word 0 i) + "[^" (substring word i (1+ i)) "]")) + (i 1 (1+ i))) + ((>= i (length word)) regexp))))) + (setq font-lock-keywords + (list (list (concat "\\" + "\\(" not-comment "\\)\\{0,5\\}" + "\\(\\'\\|\\\\)") + '(0 font-lock-comment-face)) + (list (concat "\\" + "\\([^C]+\\|C[^O]\\)\\{0,5\\}" + "\\($\\|\\\\)") + '(0 font-lock-comment-face)) + (list "\\<[A-Z_]+\\>" + '(0 font-lock-keyword-face)) + (list (concat "\\<" + "[0-9]+" + "\\(\\.[0-9]+\\)?" + "\\([eE][-+]?[0-9]+\\)?" + "\\>") + '(0 mdw-number-face)) + (list "\\s.\\|\\s(\\|\\s)\\|\\s\\\\|\\s/" + '(0 mdw-punct-face))))) + + (mdw-post-config-mode-hack)) + ;;;-------------------------------------------------------------------------- ;;; REXX configuration. -- [mdw]