unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Hill <zhubicen@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to enable the Major mode: ttcn-3-mode.
Date: Wed, 11 Aug 2010 21:05:02 -0700 (PDT)	[thread overview]
Message-ID: <3bb66976-7534-41c2-85e9-b6dfb4c221e2@v8g2000yqe.googlegroups.com> (raw)
In-Reply-To: 4c61c0ec$0$273$14726298@news.sunsite.dk

On 8月11日, 上午5时13分, "Colin S. Miller" <no-spam-
thank-...@csmiller.demon.co.uk> wrote:
> Hill wrote:
>
> <snip!>> But getting wrong info:
> > File mode specification error: (error "Buffer CoffeeSuite.ttcn3 is not
> > a CC Mode buffer (c-set-style)")
>
> > Any the emacs version I used on windows is emacs 23.1.
>
> > I also try to install the ttcn3 on Ubuntu by running : sudo apt-get
> > install ttcn.el. All is going well. But when I open a ttcn3 file, it
> > give me the same error info:
> > File mode specification error: (error "Buffer CoffeeSuite.ttcn3 is not
> > a CC Mode buffer (c-set-style)")
> > I checked the version on my ubuntu is emacs 22.
>
> > I was so confused, Is this a bug?
>
> Hill,
> I've just installed ttcn-el on my Debian box.
>
> On it,
> M-x ttcn-mode
> works,
> but
> M-x ttcn-3-mode
> reports  "Buffer *scratch* is not a CC Mode buffer (c-set-style)"
> which is the same as you get.
>
> I don't have a sample ttcn file to see how well the mode works.
>
> I'm afaid I don't know enough about the internals of CC mode
> to help you much further.
>
> HTH,
> Colin S. Miller
>
> BTW,
> 1) Debian's packages can be searched herehttp://www.debian.org/distrib/packages#search_packages
>
> 2) A binary .deb file is a .ar of .tgz files; they can be opened
> manually on any Linux box (or even under cygwin)
>
> --
> Replace the obvious in my email address with the first three letters of the hostname to reply.

Colin, Thank you very much!

I have installed the deb package, and there is the same issue and
prompt: .... is not CC mode(c-set-style).
I am so confused by this issue. I just want to use the syntax
highlighting for TTCN3 file.
I simplify the ttcn3.el by removing some other parts which no related
with keyword highlighting. Now it can hightlight ttcn3 keywords but
without indention and other features.
I post it here, mayby someone has the same situation:

(if (and (not (boundp 'font-lock-builtin-face))
	 (boundp 'font-lock-doc-string-face))
    (defun ttcn3-builtin-face ()
      "builtin face for XEmacs"
      font-lock-doc-string-face)
  (defun ttcn3-builtin-face ()
    "builtin face for GNU Emacs"
    font-lock-builtin-face))
(if (and (not (boundp 'font-lock-constant-face))
	 (boundp 'font-lock-preprocessor-face))
    (defun ttcn3-constant-face ()
      "constant face for XEmacs"
      font-lock-preprocessor-face)
  (defun ttcn3-constant-face ()
    "constant face for GNU Emacs"
    font-lock-constant-face))

(setq ttcn3-font-lock-keywords
	(list
	 ;; TTCN-3 functions, modules, and testcases
	 (list (concat
                "\\<\\(" "function" "\\|" "group" "\\|" "language"
                "\\|" "module" "\\|" "named alt" "\\|" "altstep"
                "\\|" "testcase"
                "\\)\\>" "[ \t]+\\(\\sw+\\)?")
               '(1 font-lock-keyword-face)
	       '(2 font-lock-function-name-face nil t))
	 ;; TTCN-3 keywords
	 (list
	  (concat
	   "\\<"
	   (regexp-opt
	    '("action" "activate" "all" "alt" "and" "and4b" "any"
              "call" "catch" "check" "clear" "connect" "const"
              "control" "create" "deactivate" "disconnect" "display"
              "do" "done" "else" "encode" "error" "except" "exception"
              "execute" "expand" "extension" "external" "fail" "false"
              "for" "from" "get" "getcall" "getreply" "getverdict"
"goto" "if"
              "ifpresent" "import" "in" "inconc" "infinity" "inout"
              "interleave" "label" "length" "log" "map" "match"
              "message" "mixed" "mod" "modifies" "modulepar" "mtc"
"none"
              "nonrecursive" "not" "not4b" "nowait" "null" "omit"
              "optional" "or" "or4b" "out" "param" "pass" "pattern"
              "procedure" "raise" "read" "receive" "rem" "repeat"
              "reply" "return" "running" "runs on" "self" "send"
              "sender" "setverdict" "signature" "start" "stop"
"sut.action"
              "system" "template" "timeout" "timer" "to" "trigger"
              "true" "type" "unmap" "value" "valueof" "var"
              "verdict.get" "verdict.set" "while" "with" "xor"
              "xor4b") t) "\\>")
	  '(1 font-lock-keyword-face))
	 ;; TTCN-3 predefined (built-in) functions
	 (list
	  (concat
	   "\\<"
	   (regexp-opt
	    '("bit2hex" "bit2int" "bit2oct" "bit2str" "char2int" "float2int"
	      "hex2bit" "hex2int" "hex2oct" "hex2str" "int2bit" "int2char"
	      "int2float" "int2hex" "int2oct" "int2str" "int2unichar"
"ischosen"
	      "ispresent" "lengthof" "oct2bit" "oct2hex" "oct2int"
	      "oct2str" "regexp" "rnd" "sizeof" "str2int" "str2oct"
	      "substr" "unichar2int") t) "\\>")
          '(1 (ttcn3-builtin-face)))
	 ;; TTCN-3 types
	 (list
	  (concat
	   "\\<"
	   (regexp-opt
	    '("address" "anytype" "bitstring" "boolean" "char" "charstring"
	      "component" "enumerated" "float" "hexstring" "integer"
	      "objid" "octetstring" "port" "record" "record of" "set"
	      "set of" "union" "universal char" "universal charstring"
	      "verdicttype") t)
	      "\\>")
	  '(1 font-lock-type-face))
	 ;; user-defined types
	 (list (concat "\\<\\(type\\)\\>[ \t]+\\(\\(record\\|set\\)[ \t]+"
		       "of[ \t]+\\)?\\(\\sw+\\)[ \t]+\\(\\sw+\\)")
	       '(1 font-lock-keyword-face)
	       '(5 font-lock-type-face nil t))
	 ;; TTCN-3 constants
	 (list (concat "\\<\\(const\\)\\>"
		       "[ \t]+\\(\\sw+\\)?[ \t]+\\(\\sw+\\)?")
	       '(1 font-lock-keyword-face)
	       '(2 font-lock-type-face)
	       '(3 (ttcn3-constant-face) nil t))
	 ;; TTCN-3 templates, and variables
	 (list (concat "\\<\\(template\\|var\\)\\>[ \t]+"
		       "\\(\\(record\\|set\\)[ \t]+of[ \t]+\\)?"
		       "\\(\\sw+\\)[ \t]+\\(\\sw+\\)")
	       '(1 font-lock-keyword-face)
	       '(4 font-lock-type-face)
	       '(5 font-lock-variable-name-face nil t))
	 ;; ASN.1 keywords, not to be used as identifiers in TTCN-3
	 (list
	  (concat
	   "\\<"
	   (regexp-opt
	    '("ABSENT" "ABSTRACT-SYNTAX" "ALL" "APPLICATION"
	      "AUTOMATIC" "BEGIN" "BIT" "BMPSTRING" "BOOLEAN" "BY"
	      "CHARACTER" "CHOICE" "CLASS" "COMPONENT" "COMPONENTS"
	      "CONSTRAINED" "DEFAULT" "DEFINITIONS" "EMBEDDED" "END"
	      "ENUMERATED" "EXCEPT" "EXPLICIT" "EXPORTS" "EXTERNAL"
	      "FALSE" "FROM" "GeneralizedTime" "GeneralString"
	      "IA5String" "IDENTIFIER" "IMPLICIT" "IMPORTS" "INCLUDES"
	      "INSTANCE" "INTEGER" "INTERSECTION" "ISO646String" "MAX"
	      "MIN" "MINUS-INFINITY" "NULL" "NumericString" "OBJECT"
	      "ObjectDescriptor" "OCTET" "OF" "OPTIONAL" "PDV"
	      "PLUS-INFINITY" "PRESENT" "PrintableString" "PRIVATE"
	      "REAL" "SEQUENCE" "SET" "SIZE" "STRING" "SYNTAX"
	      "T61String" "TAGS" "TeletexString" "TRUE"
	      "TYPE-IDENTIFIER" "UNION" "UNIQUE" "UNIVERSAL"
	      "UniversalString" "UTCTime" "VideotexString"
	      "VisibleString" "WITH") t) "\\>")
	  '(1 font-lock-reference-face))))

(define-derived-mode ttcn3-mode fundamental-mode
  (set (make-local-variable 'font-lock-defaults) '(ttcn3-font-lock-
keywords))
  (setq mode-name "TTCN3")
)
(provide 'ttcn3)



      reply	other threads:[~2010-08-12  4:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-08  8:05 How to enable the Major mode: ttcn-3-mode Hill
2010-08-08 10:29 ` Colin S. Miller
2010-08-08 13:08   ` Hill
     [not found]     ` <4c5eb374$0$286$14726298@news.sunsite.dk>
2010-08-08 22:41       ` Hill
2010-08-10 21:13         ` Colin S. Miller
2010-08-12  4:05           ` Hill [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3bb66976-7534-41c2-85e9-b6dfb4c221e2@v8g2000yqe.googlegroups.com \
    --to=zhubicen@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).