From: Joe Riel <joer@san.rr.com>
To: Emanuel Berg <embe8573@student.uu.se>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Basic font-lock without font-locking double-quoted strings
Date: Thu, 19 Dec 2013 21:00:15 -0800 [thread overview]
Message-ID: <20131219210015.3df76c82@gauss> (raw)
In-Reply-To: <87r498fjuc.fsf@nl106-137-194.student.uu.se>
On Fri, 20 Dec 2013 01:26:26 +0100
Emanuel Berg <embe8573@student.uu.se> wrote:
> Joe Riel <joer@san.rr.com> writes:
>
> > Why would the following minimal mode
> >
> > (define-derived-mode msdbg-mode fundamental-mode (setq
> > font-lock-keywords '(("EA"
> > . font-lock-warning-face))))
>
> Does that work at all?
Yes. One solution was to set font-lock-keywords-only to t.
That can be done when assigning to font-lock-defaults.
My solution was different; I don't need font-lock mode,
so called (font-lock-mode -1) to turn it off, then coded a
loop to fontify what I needed (the mode is just for viewing).
>
> According to the help, it should look like this:
>
> (define-derived-mode article-mode sgml-mode "Article"
> "Major mode for editing technical articles."
> (setq case-fold-search nil))
>
> But strings are highlighted in fundamental-mode
> (font-look-face-face) so at least that makes sense.
>
> You'll have to wait for a better answer, but the below
> code (the only mode I did) might interest you. When I
> did it, I was told on this list not to make it a
> generic mode but to derive from fundamental-mode,
> however, I didn't do that - first the keywords, then
> create the mode.
>
> (defvar fpscalc-keywords
> '(("\\(!.*$\\)" . 'fpscalc-comment)
> ("\\(semaphore\\)\\((\\)\\([[:word:]]+\\)\\(\\, \\)\\([[:word:]]+\\)"
> (1 'fpscalc-semaphore-keyword)
> (3 'fpscalc-semaphore-name)
> (5 'fpscalc-task-name-and-index) )
> ("declarations\\|initialise\\|semaphores\\|formulas" . 'fpscalc-program-parts)
> ("sigma\\|floor\\|ceiling\\|min\\|max" . 'fpscalc-math-functions)
> ("lp\\|ep\\|hp\\|all" . 'fpscalc-task-priority-sets)
> ("\\([[:word:]]\\)\\(\\[\\)\\(i\\)\\(\\]\\)"
> (1 'fpscalc-variable-name)
> (3 'fpscalc-i-task) )
> ("\\([[:word:]]\\)\\(\\[\\)\\(j\\)\\(\\]\\)"
> (1 'fpscalc-variable-name)
> (3 'fpscalc-j-task))
> ("\\([[:word:]]\\)\\(\\[\\)\\(.*\\)\\(\\]\\)"
> (1 'fpscalc-variable-name)
> (3 'fpscalc-task-name-and-index))
> ("\\(system \\)\\(.* \\)"
> (1 'fpscalc-system-keyword)
> (2 'fpscalc-system-name))
> ("\\(scalar\\|indexed\\|priority\\|blocking\\)\\( \\)+\\(\\(\\([[:word:]]\\( *\\, *\\)?\\)\\)*\\)"
> (1 'fpscalc-variable-type)
> (3 'fpscalc-variable-name))
> ("\\(tasks +\\)\\(\\(\\([[:word:]]\\( *\\, *\\)?\\)\\)*\\)"
> (1 'fpscalc-tasks-keyword)
> (2 'fpscalc-task-name-and-index))
> ))
>
> (define-generic-mode
> 'fpscalc-mode
> '("!")
> nil
> fpscalc-keywords
> '("\\.fps\\'")
> '((lambda ()
> (progn
> (setq indent-line-function 'fpscalc-indent-line)
> (local-set-key "\C-c\C-c" 'compute) )))
> "Major mode for .fps files and the fpscalc tool.")
>
--
Joe Riel
next prev parent reply other threads:[~2013-12-20 5:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.9709.1387497505.10748.help-gnu-emacs@gnu.org>
2013-12-20 0:26 ` Basic font-lock without font-locking double-quoted strings Emanuel Berg
2013-12-20 0:30 ` Emanuel Berg
2013-12-20 5:00 ` Joe Riel [this message]
[not found] ` <mailman.9722.1387515631.10748.help-gnu-emacs@gnu.org>
2013-12-20 17:37 ` Emanuel Berg
2013-12-19 23:58 Joe Riel
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=20131219210015.3df76c82@gauss \
--to=joer@san.rr.com \
--cc=embe8573@student.uu.se \
--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.
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.