[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: objc-c in xemacs
From: |
John Eikenberry [MSAI] |
Subject: |
Re: objc-c in xemacs |
Date: |
Fri, 28 Feb 1997 12:51:24 -0500 (EST) |
On Fri, 28 Feb 1997, Ludo Pagie wrote:
> I'm sorry, but I just can't get emacs to fontify and color my objc code to my
> liking; all it seems to do is 'highlight' strings and comments. Of course I
> can
> use C++-mode but it has some quirks.
>
> Has anybody got a working (font-lock) emacs going? Please help me out.
Hey Ludo,
I got this from the Obj-C newsgroup. It works great. :)
Just stick it in your .emacs file (or whereever you put the mode
hooks).
John Eikenberry
address@hidden
______________________________________________________________
"A society that will trade a little liberty for a little order
will deserve neither and lose both."
--B. Franklin
;; Objective C settings
;; ====================
(defun my-objc-mode-hook ()
;; my customizations for objc mode
(setq font-lock-keywords
(append '(
;; Keywords
("address@hidden" . font-lock-keyword-face)
("address@hidden" . font-lock-keyword-face)
("@selector" . font-lock-keyword-face)
("address@hidden" . font-lock-keyword-face)
("\\<static\\>" . font-lock-keyword-face)
;; Objc/c types/variables
("\\<id\\>" . font-lock-type-face)
("\\<nil\\>" . font-lock-type-face)
("\\<self\\>" . font-lock-keyword-face)
("\\<super\\>" . font-lock-type-face)
("\\<Boolean\\>" . font-lock-type-face)
;; Class names
("\\<[A-Z][a-zA-Z]*\\>" . font-lock-function-name-face)
;; Function names
("\\([_a-zA-Z0-9]+\\)(" 1 font-lock-function-name-face)
;; Macro's/constants
("\\<[_A-Z0-9]+\\>" 0 font-lock-function-name-face t)
;; Imported files
("^#import <\\(.*\\)>" 1 font-lock-function-name-face t)
;; Method declarations and messages
("^[-|+][ ]*\\(([a-zA-Z]*)\\)?[
]*\\([_a-zA-Z0-9]*\\)[;]?" 2 f
ont-lock-keyword-face)
("[ ]+\\([_a-zA-Z0-9]+\\)[\]|:]" 1 font-lock-keyword-face)
("[^:^[][ ]+\\([_a-zA-Z0-9]+\\)[\]|:]" 1
font-lock-keyword-fac
e)
) c-font-lock-keywords-2))
)
(add-hook 'c-mode-common-hook 'my-objc-mode-hook)
;; I actually have this code somewhere else, but this is what was
;; included in the newsgroup posting - John Eikenberry
;; OBJECTIVE C MODE
(autoload 'c++-mode "cc-mode" "C++ Editing Mode" t)
(autoload 'c-mode "cc-mode" "C Editing Mode" t)
(autoload 'objc-mode "cc-mode" "Objective-C Editing Mode" t)
(setq auto-mode-alist
(append '(("\\.C$" . c++-mode)
("\\.cc$" . c++-mode)
("\\.c$" . objc-mode)
("\\.h$" . objc-mode)
("\\.m$" . objc-mode)
) auto-mode-alist))
- objc-c in xemacs, Ludo Pagie, 1997/02/28
- Re: objc-c in xemacs,
John Eikenberry [MSAI] <=