From: Tim Johnson <tim@johnsons-web.com>
Subject: Adding a font-lock face to a major mode/revisited
Date: Wed, 4 Jan 2006 17:07:47 -0900 [thread overview]
Message-ID: <20060105020747.GH1812@johnsons-web.com> (raw)
In-Reply-To: <20060104171625.GF1812@johnsons-web.com>
After studying documentation, I have taken a different approach.
Code for lisp-mode++.el is not as follows:
;;
(defconst tj-word-end "\\)\\b")
(defconst tj-lisp-user-keywords
(concat tj-word-begin
(regexp-opt '("and" "apply" "concatenate" "format" "funcall" "list" "lambda"
"mapcar" "not" "print" "push" "return-from " "setf" "setq")
) tj-word-end))
(make-local-variable 'lisp-font-lock-keywords-tj)
(defvar lisp-font-lock-keywords-tj
(list
(list tj-lisp-user-keywords '1 'font-lock-user-keyword-face))
"Additional keywords and groups for lisp-mode")
(add-hook 'lisp-mode-hook
'(lambda ()
(require 'extra-faces) ;; font-lock-user-keyword-face defined here
'turn-on-font-lock
;; I have tried both of the lines below, with no good effect
(put 'lisp-mode 'font-lock-defaults '(lisp-font-lock-keywords-tj))
;(cons font-lock-defaults lisp-font-lock-keywords-tj)
(message "lisp-mode++ loaded")))
(provide 'lisp-mode++) ;; .emacs has (require 'lisp-mode++)
;;
What works:
'add hook is being executed.
I see the message
Even with "debug on error" turned on, there are no errors.
the 'require form is being evaluated as
'font-lock-user-keyword-face appears as a defined variable.
lisp-font-lock-keywords-tj appears as a defined variable.
The regex part of the variable seems to work as tested with
re-builder
What doesn't work:
No syntax highlighting appears for the keywords.
c-h v font-lock-defaults => provides a printed representation
that does not show lisp-font-lock-keywords-tj as a component of
that variable.
Unfortunately I have not yet found any examples to work from. I suspect
that neither the 'put nor the 'cons calls are wrong.
Any help would be appreciated.
tim
--
Tim Johnson <tim@johnsons-web.com>
http://www.alaska-internet-solutions.com
next prev parent reply other threads:[~2006-01-05 2:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-04 17:16 Adding a font-lock face to a major mode Tim Johnson
2006-01-05 2:07 ` Tim Johnson [this message]
2006-01-05 2:11 ` Adding a font-lock face to a major mode/revisited Tim Johnson
2006-01-05 16:38 ` Kevin Rodgers
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=20060105020747.GH1812@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.
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).