all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tim Johnson <tim@johnsons-web.com>
Subject: Adding a font-lock face to a major mode
Date: Wed, 4 Jan 2006 08:16:25 -0900	[thread overview]
Message-ID: <20060104171625.GF1812@johnsons-web.com> (raw)

Hi:

I would like to be able to add a font-lock face to a major mode at load
time.

I've written the following code in a file called lisp-mode++. 
I need some help in adding the face properly.
FYI: *If possible*, I'd like this to be cross-compatible to Xemacs.
      but is not a critical need.
;; code follows:
(defconst tj-word-end "\\)\\b")
(defconst tj-word-begin "\\b\\(")
(defconst tj-lisp-user-keywords 
          (concat tj-word-begin ;; test some symbols not highlighted
                  (regexp-opt '( "and" "apply" "concatenate" "format" "funcall" "list" "lambda" 
                                 "mapcar" "not" "print" "push" "return-from " "setf" "setq")) 
                  tj-word-end))
(add-hook 'lisp-mode-hook
          '(lambda ()
             (require 'extra-faces) ;; font-lock-user-keyword-face defined here
             'turn-on-font-lock
             (cons font-lock-defaults  ;; this is wrong, I know!
                   (list tj-lisp-user-keywords '1 'font-lock-user-keyword-face))
             (message "lisp-mode++ loaded")))   ;; test!
(provide 'lisp-mode++) ;; .emacs has (require 'lisp-mode++)
;;

TIA
tim

-- 
Tim Johnson <tim@johnsons-web.com>
      http://www.alaska-internet-solutions.com

             reply	other threads:[~2006-01-04 17:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-04 17:16 Tim Johnson [this message]
2006-01-05  2:07 ` Adding a font-lock face to a major mode/revisited Tim Johnson
2006-01-05  2:11   ` Tim Johnson
2006-01-05 16:38   ` Kevin Rodgers
     [not found] <mailman.21393.1136395091.20277.help-gnu-emacs@gnu.org>
2006-01-05 17:58 ` Adding a font-lock face to a major mode Stefan Monnier
2006-01-05 20:44   ` Tim Johnson
2006-01-05 21:01   ` Stefan Monnier

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

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

  git send-email \
    --in-reply-to=20060104171625.GF1812@johnsons-web.com \
    --to=tim@johnsons-web.com \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.