From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Claudius@sailer-online.de (Claudius Sailer) Newsgroups: gmane.emacs.help Subject: need help with highlighting file Date: Fri, 10 Feb 2006 22:46:33 +0100 Organization: T-Online Message-ID: <1hakf3i.cs9pc3c9t1quN%Claudius@sailer-online.de> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: sea.gmane.org 1139608251 1671 80.91.229.6 (10 Feb 2006 21:50:51 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 10 Feb 2006 21:50:51 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Feb 10 22:50:23 2006 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1F7g9l-0005f0-00 for ; Fri, 10 Feb 2006 22:50:22 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F7g9j-0002dz-N3 for geh-help-gnu-emacs@m.gmane.org; Fri, 10 Feb 2006 16:50:19 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 161 Original-X-Trace: news.t-online.com 1139607993 01 15072 R5zrvq-1sxGB7IQ 060210 21:46:33 Original-X-Complaints-To: usenet-abuse@t-online.de X-ID: SSkjPcZpQe9Q56GKrucyyz3uU-8C-ZNe5PHcEAZ4GGQKoa28iWCiUl User-Agent: MacSOUP/D-2.7 (Mac OS X version 10.4.4) Original-Xref: shelby.stanford.edu gnu.emacs.help:137499 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:33121 Archived-At: Hi, I have a language SQR which I want to highlight. I copied sql.el and renamed it. I made correct including in .emacs. I deleted everything I don't need and it works. BUT I have 2 problems. SQR is like SQL not case sensitiv, but my highlighting only works with small letters. So it is case sensitive And SQR uses ! for comments. I don't know how I can activate this correctly. I have only SQL-Comment but I wasn't unable to make changes that it works. could I get some help? thanks Claudius some parts of coding without all comments ;;; sqr-mode.el --- specialized comint.el for SQR ;;;; comments are removed for less traffic ;;; Code: (require 'comint) ;; Need the following to allow GNU Emacs 19 to compile the file. (require 'regexp-opt) (require 'custom) ;; Syntax Table (defvar sqr-mode-syntax-table (let ((table (make-syntax-table))) ;; C-style comments /**/ (see elisp manual "Syntax Flags")) (modify-syntax-entry ?/ ". 14" table) (modify-syntax-entry ?* ". 23" table) ;; double-dash starts comment (if (string-match "XEmacs\\|Lucid" emacs-version) (modify-syntax-entry ?- ". 56" table) (modify-syntax-entry ?- ". 12b" table)) ;; newline and formfeed end coments (modify-syntax-entry ?\n "> b" table) (modify-syntax-entry ?\f "> b" table) ;; single quotes (') quotes delimit strings (modify-syntax-entry ?' "\"" table) table) "Syntax table used in `sqr-mode.") ;; Font lock support (defvar sqr-mode-font-lock-keywords nil "SQR keywords used by font-lock. This variable is used by `sqr-mode'. The regular expressions are created during compilation by calling the function `regexp-opt'. Therefore, take a look at the source before you define your own sqr-mode-font-lock-keywords. You may want to add functions and SQR keywords.") (if sqr-mode-font-lock-keywords () (let ((sqr-keywords (eval-when-compile (concat "\\b" (regexp-opt '( "authorization" "avg" "begin" "close" "cobol" "commit" "continue" "count" "declare" "double" "end" "escape" "exec" "fetch" "foreign" "fortran" "found" "go" "goto" "indicator" "key" "language" "max" "min" "module" "numeric" "open" "pascal" "pli" "precision" "primary" "procedure" "references" "rollback" "schema" "section" "some" "sqlcode" "sqlerror" "sum" "work") t) "\\b"))) (sqr-reserved-words (eval-when-compile (concat "\\b" (regexp-opt '( "all" "and" "any" "as" "asc" "between" "by" "check" "create" "current" "default" "delete" "desc" "distinct" "exists" "float" "for" "from" "grant" "group" "having" "in" "insert" "into" "is" "like" "not" "null" "of" "on" "option" "or" "order" "privileges" "public" "select" "set" "table" "to" "union" "unique" "update" "user" "values" "view" "where" "with") t) "\\b"))) (sqr-types (eval-when-compile (concat "\\b" (regexp-opt '( ;; SQR Keywords that look like types --hellblau "character" "cursor" "dec" "int" "real" ;; SQR Reserved Word that look like types --hellblau "char" "integer" "smallint" ) t) "\\b")))) (setq sqr-mode-font-lock-keywords (list (cons sqr-keywords 'font-lock-function-name-face) (cons sqr-reserved-words 'font-lock-keyword-face) (cons sqr-types 'font-lock-type-face))))) (defvar sqr-mode-font-lock-keywords sqr-mode-font-lock-keywords "SQR keywords used by font-lock. This variable defaults to `sqr-mode-font-lock-keywords'. This is used for the default `font-lock-defaults' value in `sqr-mode'. This can be changed by some entry functions to provide more hilighting.") ;;; Functions to switch highlighting (defun sqr-highlight-keywords () "Highlight SQR keywords. Basically, this just sets `font-lock-keywords' appropriately." (interactive) (setq font-lock-keywords sqr-mode-font-lock-keywords) (font-lock-fontify-buffer)) ;;;###autoload (defun sqr-mode () "Major mode to edit SQR." (interactive) (kill-all-local-variables) (setq major-mode 'sqr-mode) (setq mode-name "SQR-MODE") ;(use-local-map sqr-mode-map) ;(if sqr-mode-menu ; (easy-menu-add sqr-mode-menu)); XEmacs (set-syntax-table sqr-mode-syntax-table) (make-local-variable 'font-lock-defaults) ;; Note that making KEYWORDS-ONLY nil will cause havoc if you try ;; SELECT 'x' FROM DUAL with SQL*Plus, because the title of the column ;; will have just one quote. Therefore syntactic hilighting is ;; disabled for interactive buffers. `_' and `.' are considered part ;; of words. ; (setq font-lock-defaults '(sqr-mode-font-lock-keywords ; nil t ((?_ . "w") (?. . "w")))) ; (make-local-variable 'comment-start) ; (setq comment-start "!") ;; Make each buffer in sqr-mode remember the "current" SQLi buffer. ;(make-local-variable 'sqr-buffer) ;; Add imenu support for sql-mode. Note that imenu-generic-expression ;; is buffer-local, so we don't need a local-variable for it. SQR is ;; case-insensitive, that's why we have to set imenu-case-fold-search. ;; imenu-syntax-alist makes sure that `_' is considered part of object ;; names. ; (setq imenu-generic-expression sqr-imenu-generic-expression ; imenu-case-fold-search t ; imenu-syntax-alist '(("_" . "w"))) ;; Make `sqr-send-paragraph' work on paragraphs that contain indented ;; lines. ; (make-local-variable 'paragraph-separate) ; (make-local-variable 'paragraph-start) ; (setq paragraph-separate "[\f]*$" ; paragraph-start "[\n\f]") ;; Abbrevs ; (setq local-abbrev-table sqr-mode-abbrev-table) ; (setq abbrev-all-caps 1) ) (provide 'sqr-mode) ;;; sqr-mode.el ends here