Hi All,
I have written a 'soapp.el' file to derive a major mode. In my mode every
keyword starts with $. For example '$run'. I need to highlight the whole
thing. But I could able to achieve the highlighting effect only on run
keyword and not with dollar ($) character. How to highlight a character?
Also, in my '.runin' file a comment starts with keyword comment. I need to
highlight this. If I am providing the word directly in my keywords list, its
not getting highlighted.
Can you please provide me help in this regard?
Here, is my soapp.el file for your reference.
*****************************************************
soapp.el
*****************************************************
;;; Code:
(defconst soapp-mode-version "version 0.01.0")
(defgroup soapp nil
"Soapp mode for XEmacs"
:group 'languages)
;; font-lock-comment-face -COMMENTS
;; font-lock-keyword-face -COMMANDS,OPERATORS
(let ((soapp-keywords
; ("run" "RUN" "end" "END" "set"
"SET" "clo" "CLO"
; "cls" "CLS" "page" "PAGE" "CMT"
"cmt" "BINNEW" "binnew"
; "comment" "COMMENT"))
(concat "$run\\|RUN\\|"
"$end\\|END\\|"
"set\\|SET\\|"
"clo\\|cls\\|CLO\\|CLS\\|"
"page\\|PAGE\\|"
"cmt\\|CMT\\|"
"binnew\\|BINNEW\\|"
"comment\\|COMMENT\\|"))
)
(setq soapp-font-lock-keywords
(list
'("\"[^'\n]*'?" .font-lock-comment-face)
(list (concat "\\<\\(go\\|spaw\\|spawn\\)\\>[ \t]*\\(\\sw+\\)?")
'(1 font-lock-keyword-face)
'(2 font-lock-function-name-face nil t))
; (cons (concat "\\/\\("soapp-qualifiers "\\)\\>")
'font-lock-type-face)
(concat "\\<\\("soapp-keywords"\\)\\>")
))
"Default expressions to highlight in Soapp mode.")
-------------------------------------------------------------------
;;;###autoload
(require 'derived)
(define-derived-mode soapp-mode text-mode "Soapp"
"Major mode for editing soapp .runin files.
Special commands:
\\{soapp-mode-map}"
(set (make-local-variable 'comment-start) "comment")
(set-syntax-table (copy-syntax-table))
; (modify-syntax-entry ?! "<")
(modify-syntax-entry ?\n ">")
(set (make-local-variable 'font-lock-defaults)
'(soapp-font-lock-keywords nil t)))
(provide 'soapp)
****************************************************
soapp.el
****************************************************
Regards
Phanender
IEL, INDIA.
====
Off:040-23112296
Res:040-27061857